mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	improve anonymization
This commit is contained in:
		
							
								
								
									
										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 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 revisions SET title = 'title'; | ||||
|  | ||||
| UPDATE attributes SET name = 'name', value = 'value' | ||||
|                   WHERE type = 'label' | ||||
|                     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 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 attributes SET name  = 'name', value = 'value' WHERE type = 'label' | ||||
|   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', 'workspaceCalendarRoot', 'workspaceTemplate', 'searchHome', 'workspaceInbox', | ||||
|        'workspaceSearchHome', 'sqlConsoleHome', 'datePattern', 'pageSize', 'viewType', 'mapRootNoteId', | ||||
|        'bookmarkFolder', 'sorted', 'sortDirection', 'sortFoldersFirst', 'sortNatural', 'sortLocale', 'top', | ||||
|        'fullContentWidth', 'shareHiddenFromTree', 'shareAlias', 'shareOmitDefaultCss', 'shareRoot', 'shareDescription', | ||||
|        'shareRaw', 'shareDisallowRobotIndexing', 'shareIndex', 'displayRelations', 'hideRelations', 'titleTemplate', | ||||
|        'template', 'toc', 'color', 'keepCurrentHoisting', 'executeButton', 'executeDescription', 'newNotesOnTop', | ||||
|        'clipperInbox', 'internalLink', 'imageLink', 'relationMapLink', 'includeMapLink', 'runOnNoteCreation', | ||||
|        'runOnNoteTitleChange', 'runOnNoteChange', 'runOnNoteContentChange', 'runOnNoteDeletion', 'runOnBranchCreation', | ||||
|        'runOnBranchDeletion', 'runOnChildNoteCreation', 'runOnAttributeCreation', 'runOnAttributeChange', 'template', | ||||
|        'inherit', 'widget', 'renderNote', 'shareCss', 'shareJs', 'shareFavicon'); | ||||
| UPDATE attributes SET name = 'name' WHERE type = 'relation' | ||||
|   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', 'workspaceCalendarRoot', 'workspaceTemplate', 'searchHome', 'workspaceInbox', | ||||
|        'workspaceSearchHome', 'sqlConsoleHome', 'datePattern', 'pageSize', 'viewType', 'mapRootNoteId', | ||||
|        'bookmarkFolder', 'sorted', 'sortDirection', 'sortFoldersFirst', 'sortNatural', 'sortLocale', 'top', | ||||
|        'fullContentWidth', 'shareHiddenFromTree', 'shareAlias', 'shareOmitDefaultCss', 'shareRoot', 'shareDescription', | ||||
|        'shareRaw', 'shareDisallowRobotIndexing', 'shareIndex', 'displayRelations', 'hideRelations', 'titleTemplate', | ||||
|        'template', 'toc', 'color', 'keepCurrentHoisting', 'executeButton', 'executeDescription', 'newNotesOnTop', | ||||
|        'clipperInbox', 'internalLink', 'imageLink', 'relationMapLink', 'includeMapLink', 'runOnNoteCreation', | ||||
|        'runOnNoteTitleChange', 'runOnNoteChange', 'runOnNoteContentChange', 'runOnNoteDeletion', 'runOnBranchCreation', | ||||
|        'runOnBranchDeletion', 'runOnChildNoteCreation', 'runOnAttributeCreation', 'runOnAttributeChange', 'template', | ||||
|        'inherit', 'widget', 'renderNote', 'shareCss', 'shareJs', 'shareFavicon'); | ||||
| UPDATE branches SET prefix = 'prefix' WHERE prefix IS NOT NULL AND prefix != 'recovered'; | ||||
| UPDATE options SET value = 'anonymized' WHERE name IN | ||||
|       ('documentId', 'documentSecret', 'encryptedDataKey', | ||||
|   | ||||
							
								
								
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -1,12 +1,12 @@ | ||||
| { | ||||
|   "name": "trilium", | ||||
|   "version": "0.61.7-beta", | ||||
|   "version": "0.61.8-beta", | ||||
|   "lockfileVersion": 2, | ||||
|   "requires": true, | ||||
|   "packages": { | ||||
|     "": { | ||||
|       "name": "trilium", | ||||
|       "version": "0.61.7-beta", | ||||
|       "version": "0.61.8-beta", | ||||
|       "hasInstallScript": true, | ||||
|       "license": "AGPL-3.0-only", | ||||
|       "dependencies": { | ||||
|   | ||||
| @@ -9,6 +9,7 @@ function getFullAnonymizationScript() { | ||||
|     // 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 | ||||
|     const builtinAttrNames = BUILTIN_ATTRIBUTES | ||||
|         .filter(attr => !["shareCredentials"].includes(attr.name)) | ||||
|         .map(attr => `'${attr.name}'`).join(', '); | ||||
|  | ||||
|     const anonymizeScript = ` | ||||
|   | ||||
		Reference in New Issue
	
	Block a user