Repository navigation
feat(views): two-way anonymise page, real IDs on the left, anonymised on the right - #108
Merged
Merged
Conversation
The anonymise page needs the same salt editor; it moves to its own component, with an id per instance so two can render at once.
…t is anonymizeText anonymises text written with real IDs. Aliases depend only on the salt, so the result matches the anonymised rageshakes. Aliases already in the text are left as they are, including ones a raw log mapped: hashing an alias again gives one that no log holds. countRealIdentifiers runs the same scan as the CLI precheck, so text that passes here also passes there. An anonymised file now carries its owner's user and device ID. They come from details.json, else from the latest Element Web login line. Log lines are sorted by timestamp first, because the order of files in an archive is not chronological.
… on the right The page could only read anonymised text back. Now both panes can be edited, and the one edited last drives the other. Text typed with real IDs is anonymised with the salt alone (debounced). Anonymised text is read back using the mappings of the loaded rageshakes and of the text typed. The anonymised side warns while real IDs are still in it. Each pane has a drop zone above it, and the zone says why the file is dropped: above the left to reveal real IDs (mapping only), above the right to anonymise and download. Text files go into the pane below. The header shows whose rageshakes are loaded, like the summary page. A dropdown lists the rageshakes and has Forget all. The batch notice is gone. A key button opens the salt. When the salt changes, every file is anonymised again, a file dropped to download is downloaded again, and the mapping of the typed text is rebuilt. A file whose re-run fails loses its stale mapping and is retried on the next salt change.
Contributor
|
🚀 PR Preview ready: |
Merging this PR will not alter performance1 warning
Comparing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Until now the anonymise page could only read anonymised text back with real IDs. With this PR it works both ways. The left pane holds text with real IDs and the right pane holds the anonymised version. You can edit either one, and the pane you edited last drives the other. Text typed with real IDs is anonymised with the salt alone, so its aliases match the anonymised rageshakes. The salt can now be changed from the page itself, and a salt change anonymises everything again.
As before, raw files and mappings stay in the tab's memory only.
Changes
refactor(components): extract the salt field from the burger menu:SaltFieldis now a separate component, used by both the menu and the page.feat(utils): anonymise text with the salt, and read whose rageshake it is: addsanonymizeText, which leaves aliases already in the text as they are, andcountRealIdentifiers, which runs the same scan as the CLI precheck. An anonymised file now carries its owner's user and device ID. They come fromdetails.json, else from the latest Element Web login line (sorted by timestamp, because archive order is not chronological).feat(views): two-way anonymise page, real IDs on the left, anonymised on the right: two editable panes, each with a drop zone above it. The zone above the left pane loads a rageshake for its mapping only. The zone above the right pane anonymises the rageshake and downloads the result. A text file goes into the pane below its zone. The header shows whose rageshakes are loaded, has a dropdown listing them with Forget all, and a key button that opens the salt. The batch notice is gone. When the salt changes, every file is anonymised again, a file dropped to download is downloaded again, and the typed text's mapping is rebuilt.For reviewers
Testing
npm run build,npm run lintandnpm test -- --run --coveragepass (2646 tests, coverage thresholds met). Each commit also typechecks and passes tests on its own.#/anonymize:@alice:matrix.orgon the left and see an alias appear on the right;.tar.gzon each zone and check that only the right zone downloads;