Skip to content

fix: a temporary master password is shown once - #887

Merged
blaipr merged 1 commit into
mainfrom
fix/a-temporary-master-password-is-shown-once
Aug 26, 2026
Merged

fix: a temporary master password is shown once#887
blaipr merged 1 commit into
mainfrom
fix/a-temporary-master-password-is-shown-once

Conversation

@blaipr

@blaipr blaipr commented Aug 26, 2026

Copy link
Copy Markdown
Member

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.

`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.
@blaipr
blaipr merged commit 06b5084 into main Aug 26, 2026
8 checks passed
@blaipr
blaipr deleted the fix/a-temporary-master-password-is-shown-once branch August 26, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant