mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 11:39:01 +01:00 
			
		
		
		
	improve anonymization
This commit is contained in:
		
							parent
							
								
									78b6614eea
								
							
						
					
					
						commit
						7f06952d9e
					
				
							
								
								
									
										0
									
								
								bin/create-anonymization-script.js
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								bin/create-anonymization-script.js
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -1,160 +1,42 @@ | |||||||
| 
 |  | ||||||
| UPDATE etapi_tokens SET tokenHash = 'API token hash value'; | UPDATE etapi_tokens SET tokenHash = 'API token hash value'; | ||||||
| UPDATE notes SET title = 'title' WHERE noteId != 'root' AND noteId NOT LIKE '\_%' ESCAPE '\'; | UPDATE notes SET title = 'title' WHERE title NOT IN ('root', '_hidden', '_share'); | ||||||
| UPDATE blobs SET content = 'text' WHERE content IS NOT NULL; | UPDATE blobs SET content = 'text' WHERE content IS NOT NULL; | ||||||
| UPDATE revisions SET title = 'title'; | UPDATE revisions SET title = 'title'; | ||||||
| 
 | 
 | ||||||
| UPDATE attributes SET name = 'name', value = 'value' | UPDATE attributes SET name  = 'name', value = 'value' WHERE type = 'label' | ||||||
|                   WHERE type = 'label' |   AND name NOT IN | ||||||
|                     AND name NOT IN ('inbox', |       ('inbox', 'disableVersioning', 'calendarRoot', 'archived', 'excludeFromExport', 'disableInclusion', 'appCss', | ||||||
|                                      'disableVersioning', |        'appTheme', 'hidePromotedAttributes', 'readOnly', 'autoReadOnlyDisabled', 'cssClass', 'iconClass', | ||||||
|                                      'calendarRoot', |        'keyboardShortcut', 'run', 'runOnInstance', 'runAtHour', 'customRequestHandler', 'customResourceProvider', | ||||||
|                                      'archived', |        'widget', 'noteInfoWidgetDisabled', 'linkMapWidgetDisabled', 'revisionsWidgetDisabled', | ||||||
|                                      'excludeFromExport', |        'whatLinksHereWidgetDisabled', 'similarNotesWidgetDisabled', 'workspace', 'workspaceIconClass', | ||||||
|                                      'disableInclusion', |        'workspaceTabBackgroundColor', 'workspaceCalendarRoot', 'workspaceTemplate', 'searchHome', 'workspaceInbox', | ||||||
|                                      'appCss', |        'workspaceSearchHome', 'sqlConsoleHome', 'datePattern', 'pageSize', 'viewType', 'mapRootNoteId', | ||||||
|                                      'appTheme', |        'bookmarkFolder', 'sorted', 'sortDirection', 'sortFoldersFirst', 'sortNatural', 'sortLocale', 'top', | ||||||
|                                      'hidePromotedAttributes', |        'fullContentWidth', 'shareHiddenFromTree', 'shareAlias', 'shareOmitDefaultCss', 'shareRoot', 'shareDescription', | ||||||
|                                      'readOnly', |        'shareRaw', 'shareDisallowRobotIndexing', 'shareIndex', 'displayRelations', 'hideRelations', 'titleTemplate', | ||||||
|                                      'autoReadOnlyDisabled', |        'template', 'toc', 'color', 'keepCurrentHoisting', 'executeButton', 'executeDescription', 'newNotesOnTop', | ||||||
|                                      'cssClass', |        'clipperInbox', 'internalLink', 'imageLink', 'relationMapLink', 'includeMapLink', 'runOnNoteCreation', | ||||||
|                                      'iconClass', |        'runOnNoteTitleChange', 'runOnNoteChange', 'runOnNoteContentChange', 'runOnNoteDeletion', 'runOnBranchCreation', | ||||||
|                                      'keyboardShortcut', |        'runOnBranchDeletion', 'runOnChildNoteCreation', 'runOnAttributeCreation', 'runOnAttributeChange', 'template', | ||||||
|                                      'run', |        'inherit', 'widget', 'renderNote', 'shareCss', 'shareJs', 'shareFavicon'); | ||||||
|                                      'runOnInstance', | UPDATE attributes SET name = 'name' WHERE type = 'relation' | ||||||
|                                      'runAtHour', |   AND name NOT IN | ||||||
|                                      'customRequestHandler', |       ('inbox', 'disableVersioning', 'calendarRoot', 'archived', 'excludeFromExport', 'disableInclusion', 'appCss', | ||||||
|                                      'customResourceProvider', |        'appTheme', 'hidePromotedAttributes', 'readOnly', 'autoReadOnlyDisabled', 'cssClass', 'iconClass', | ||||||
|                                      'widget', |        'keyboardShortcut', 'run', 'runOnInstance', 'runAtHour', 'customRequestHandler', 'customResourceProvider', | ||||||
|                                      'noteInfoWidgetDisabled', |        'widget', 'noteInfoWidgetDisabled', 'linkMapWidgetDisabled', 'revisionsWidgetDisabled', | ||||||
|                                      'linkMapWidgetDisabled', |        'whatLinksHereWidgetDisabled', 'similarNotesWidgetDisabled', 'workspace', 'workspaceIconClass', | ||||||
|                                      'revisionsWidgetDisabled', |        'workspaceTabBackgroundColor', 'workspaceCalendarRoot', 'workspaceTemplate', 'searchHome', 'workspaceInbox', | ||||||
|                                      'whatLinksHereWidgetDisabled', |        'workspaceSearchHome', 'sqlConsoleHome', 'datePattern', 'pageSize', 'viewType', 'mapRootNoteId', | ||||||
|                                      'similarNotesWidgetDisabled', |        'bookmarkFolder', 'sorted', 'sortDirection', 'sortFoldersFirst', 'sortNatural', 'sortLocale', 'top', | ||||||
|                                      'workspace', |        'fullContentWidth', 'shareHiddenFromTree', 'shareAlias', 'shareOmitDefaultCss', 'shareRoot', 'shareDescription', | ||||||
|                                      'workspaceIconClass', |        'shareRaw', 'shareDisallowRobotIndexing', 'shareIndex', 'displayRelations', 'hideRelations', 'titleTemplate', | ||||||
|                                      'workspaceTabBackgroundColor', |        'template', 'toc', 'color', 'keepCurrentHoisting', 'executeButton', 'executeDescription', 'newNotesOnTop', | ||||||
|                                      'searchHome', |        'clipperInbox', 'internalLink', 'imageLink', 'relationMapLink', 'includeMapLink', 'runOnNoteCreation', | ||||||
|                                      'workspaceInbox', |        'runOnNoteTitleChange', 'runOnNoteChange', 'runOnNoteContentChange', 'runOnNoteDeletion', 'runOnBranchCreation', | ||||||
|                                      'workspaceSearchHome', |        'runOnBranchDeletion', 'runOnChildNoteCreation', 'runOnAttributeCreation', 'runOnAttributeChange', 'template', | ||||||
|                                      'sqlConsoleHome', |        'inherit', 'widget', 'renderNote', 'shareCss', 'shareJs', 'shareFavicon'); | ||||||
|                                      'datePattern', |  | ||||||
|                                      'pageSize', |  | ||||||
|                                      'viewType', |  | ||||||
|                                      'mapRootNoteId', |  | ||||||
|                                      'bookmarkFolder', |  | ||||||
|                                      'sorted', |  | ||||||
|                                      'top', |  | ||||||
|                                      'fullContentWidth', |  | ||||||
|                                      'shareHiddenFromTree', |  | ||||||
|                                      'shareAlias', |  | ||||||
|                                      'shareOmitDefaultCss', |  | ||||||
|                                      'shareRoot', |  | ||||||
|                                      'internalLink', |  | ||||||
|                                      'imageLink', |  | ||||||
|                                      'relationMapLink', |  | ||||||
|                                      'includeMapLink', |  | ||||||
|                                      'runOnNoteCreation', |  | ||||||
|                                      'runOnNoteTitleChange', |  | ||||||
|                                      'runOnNoteContentChange', |  | ||||||
|                                      'runOnNoteChange', |  | ||||||
|                                      'runOnChildNoteCreation', |  | ||||||
|                                      'runOnAttributeCreation', |  | ||||||
|                                      'runOnAttributeChange', |  | ||||||
|                                      'template', |  | ||||||
|                                      'inherit', |  | ||||||
|                                      'widget', |  | ||||||
|                                      'renderNote', |  | ||||||
|                                      'shareCss', |  | ||||||
|                                      'shareJs', |  | ||||||
|                                      'shareFavicon', |  | ||||||
|                                      'executeButton', |  | ||||||
|                                      'keepCurrentHoisting', |  | ||||||
|                                      'color', |  | ||||||
|                                      'toc', |  | ||||||
|                                      'excludeFromNoteMap', |  | ||||||
|                                      'docName', |  | ||||||
|                                      'launcherType', |  | ||||||
|                                      'builtinWidget', |  | ||||||
|                                      'baseSize', |  | ||||||
|                                      'growthFactor' |  | ||||||
|                       ); |  | ||||||
| 
 |  | ||||||
| UPDATE attributes SET name = 'name' |  | ||||||
|                     AND name NOT IN ('inbox', |  | ||||||
|                                      'disableVersioning', |  | ||||||
|                                      'calendarRoot', |  | ||||||
|                                      'archived', |  | ||||||
|                                      'excludeFromExport', |  | ||||||
|                                      'disableInclusion', |  | ||||||
|                                      'appCss', |  | ||||||
|                                      'appTheme', |  | ||||||
|                                      'hidePromotedAttributes', |  | ||||||
|                                      'readOnly', |  | ||||||
|                                      'autoReadOnlyDisabled', |  | ||||||
|                                      'cssClass', |  | ||||||
|                                      'iconClass', |  | ||||||
|                                      'keyboardShortcut', |  | ||||||
|                                      'run', |  | ||||||
|                                      'runOnInstance', |  | ||||||
|                                      'runAtHour', |  | ||||||
|                                      'customRequestHandler', |  | ||||||
|                                      'customResourceProvider', |  | ||||||
|                                      'widget', |  | ||||||
|                                      'noteInfoWidgetDisabled', |  | ||||||
|                                      'linkMapWidgetDisabled', |  | ||||||
|                                      'revisionsWidgetDisabled', |  | ||||||
|                                      'whatLinksHereWidgetDisabled', |  | ||||||
|                                      'similarNotesWidgetDisabled', |  | ||||||
|                                      'workspace', |  | ||||||
|                                      'workspaceIconClass', |  | ||||||
|                                      'workspaceTabBackgroundColor', |  | ||||||
|                                      'searchHome', |  | ||||||
|                                      'workspaceInbox', |  | ||||||
|                                      'workspaceSearchHome', |  | ||||||
|                                      'sqlConsoleHome', |  | ||||||
|                                      'datePattern', |  | ||||||
|                                      'pageSize', |  | ||||||
|                                      'viewType', |  | ||||||
|                                      'mapRootNoteId', |  | ||||||
|                                      'bookmarkFolder', |  | ||||||
|                                      'sorted', |  | ||||||
|                                      'top', |  | ||||||
|                                      'fullContentWidth', |  | ||||||
|                                      'shareHiddenFromTree', |  | ||||||
|                                      'shareAlias', |  | ||||||
|                                      'shareOmitDefaultCss', |  | ||||||
|                                      'shareRoot', |  | ||||||
|                                      'internalLink', |  | ||||||
|                                      'imageLink', |  | ||||||
|                                      'relationMapLink', |  | ||||||
|                                      'includeMapLink', |  | ||||||
|                                      'runOnNoteCreation', |  | ||||||
|                                      'runOnNoteTitleChange', |  | ||||||
|                                      'runOnNoteContentChange', |  | ||||||
|                                      'runOnNoteChange', |  | ||||||
|                                      'runOnChildNoteCreation', |  | ||||||
|                                      'runOnAttributeCreation', |  | ||||||
|                                      'runOnAttributeChange', |  | ||||||
|                                      'template', |  | ||||||
|                                      'inherit', |  | ||||||
|                                      'widget', |  | ||||||
|                                      'renderNote', |  | ||||||
|                                      'shareCss', |  | ||||||
|                                      'shareJs', |  | ||||||
|                                      'shareFavicon', |  | ||||||
|                                      'executeButton', |  | ||||||
|                                      'keepCurrentHoisting', |  | ||||||
|                                      'color', |  | ||||||
|                                      'toc', |  | ||||||
|                                      'excludeFromNoteMap', |  | ||||||
|                                      'docName', |  | ||||||
|                                      'launcherType', |  | ||||||
|                                      'builtinWidget', |  | ||||||
|                                      'baseSize', |  | ||||||
|                                      'growthFactor' |  | ||||||
|                                     ); |  | ||||||
| 
 |  | ||||||
| UPDATE branches SET prefix = 'prefix' WHERE prefix IS NOT NULL AND prefix != 'recovered'; | UPDATE branches SET prefix = 'prefix' WHERE prefix IS NOT NULL AND prefix != 'recovered'; | ||||||
| UPDATE options SET value = 'anonymized' WHERE name IN | UPDATE options SET value = 'anonymized' WHERE name IN | ||||||
|       ('documentId', 'documentSecret', 'encryptedDataKey', |       ('documentId', 'documentSecret', 'encryptedDataKey', | ||||||
|  | |||||||
							
								
								
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -1,12 +1,12 @@ | |||||||
| { | { | ||||||
|   "name": "trilium", |   "name": "trilium", | ||||||
|   "version": "0.61.7-beta", |   "version": "0.61.8-beta", | ||||||
|   "lockfileVersion": 2, |   "lockfileVersion": 2, | ||||||
|   "requires": true, |   "requires": true, | ||||||
|   "packages": { |   "packages": { | ||||||
|     "": { |     "": { | ||||||
|       "name": "trilium", |       "name": "trilium", | ||||||
|       "version": "0.61.7-beta", |       "version": "0.61.8-beta", | ||||||
|       "hasInstallScript": true, |       "hasInstallScript": true, | ||||||
|       "license": "AGPL-3.0-only", |       "license": "AGPL-3.0-only", | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|  | |||||||
| @ -9,6 +9,7 @@ function getFullAnonymizationScript() { | |||||||
|     // we want to delete all non-builtin attributes because they can contain sensitive names and values
 |     // we want to delete all non-builtin attributes because they can contain sensitive names and values
 | ||||||
|     // on the other hand builtin/system attrs should not contain any sensitive info
 |     // on the other hand builtin/system attrs should not contain any sensitive info
 | ||||||
|     const builtinAttrNames = BUILTIN_ATTRIBUTES |     const builtinAttrNames = BUILTIN_ATTRIBUTES | ||||||
|  |         .filter(attr => !["shareCredentials"].includes(attr.name)) | ||||||
|         .map(attr => `'${attr.name}'`).join(', '); |         .map(attr => `'${attr.name}'`).join(', '); | ||||||
| 
 | 
 | ||||||
|     const anonymizeScript = ` |     const anonymizeScript = ` | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam