fix: a temporary master password is shown once - #887
Merged
Conversation
`TemporaryMasterPass::create()` puts the generated key into the issuing administrator's session, so that the page rendered after the generating request can show it. There is nowhere else to keep it for that one hop — it is deliberately never persisted in plaintext, only its bcrypt hash and a blob that is useless without it. Nothing ever removed it again. There was no clear to call: the whole codebase has exactly one set and one get for `tempmasterpass`. And `ConfigManager\IndexController` reads it on every load of the Configuration page — `getGridTabs()` builds every tab the user can reach in one pass, so it does not even depend on which tab is being viewed. So a value meant to be shown once was rendered into the HTML again on every later visit, for the life of that session: after it had expired, after its recipients had used it, and after the master password had been rotated, none of which touches the session copy. Reading it now takes it. The method is `takeTemporaryMasterPass()` rather than a getter with a surprise in it, since the name is the only thing that stops the next caller assuming otherwise — and there is exactly one caller. What this does not change: the value is one global secret for the instance, and the group picker on the issuing form chooses who it is *mailed* to, not who may use it — `checkKey()` takes no user and `LoginMasterPass::loadTemporary()` checks none. That is sysPass's design, one shared master password with a per-user wrapped copy, not a missing check. Checked by dropping the clear: the new test fails on the second read.
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.
TemporaryMasterPass::create()puts the generated key into the issuing administrator'ssession, so that the page rendered after the generating request can show it. There is
nowhere else to keep it for that one hop — it is deliberately never persisted in
plaintext, only its bcrypt hash and a blob that is useless without it.
Nothing ever removed it again. There was no clear to call: the whole codebase has exactly
one set and one get for
tempmasterpass. AndConfigManager\IndexControllerreads it onevery load of the Configuration page —
getGridTabs()builds every tab the user canreach in one pass, so it does not even depend on which tab is being viewed. So a value
meant to be shown once was rendered into the HTML again on every later visit, for the life
of that session: after it had expired, after its recipients had used it, and after the
master password had been rotated, none of which touches the session copy.
Reading it now takes it. The method is
takeTemporaryMasterPass()rather than a getterwith a surprise in it, since the name is the only thing that stops the next caller
assuming otherwise — and there is exactly one caller.
What this does not change: the value is one global secret for the instance, and the
group picker on the issuing form chooses who it is mailed to, not who may use it —
checkKey()takes no user andLoginMasterPass::loadTemporary()checks none. That issysPass's design, one shared master password with a per-user wrapped copy, not a missing
check.
Checked by dropping the clear: the new test fails on the second read.