fix: a public link needs the permission to view the password it shares - #941
Merged
Merged
Conversation
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.
A public link is the account's password, handed to whoever holds the URL. Creating one decrypts the password with the master key and seals it into the link's vault, and the creator can open the link like anyone else.
Which accounts can be linked was already bounded:
getDataForLink()reads throughAccountFilterUser, asgetPasswordForId()does. The profile's own view-password permission, though, was only checked where the password is shown directly. The account view offers the link button only onisShowLink() && isShowViewPass(), but none of the three create paths checked the second half:POST publicLink/create, which answers with the new hashSo a profile allowed to publish links (
PUBLICLINK_CREATE) but not to view passwords could read the password of every account it could list, by linking it.Change
PublicLink::create()now refuses withAccountPermissionExceptionunlesscheckUserAccess(ACCOUNT_VIEW_PASS)passes. All three doors reach it. Refresh is unchanged: it re-seals an existing link and hands the caller nothing new.Tests
create()asks forACCOUNT_VIEW_PASSand is refused without it, before anything is decrypted.NoSuchItemException. Otherwise it would pass on the new check instead of the account filter it exists to prove.AccountAccessTestandPublicLinkRoundTripTestnow carry a profile.Aclrefuses a session without one, administrators included.Both new tests were mutation-verified: they fail without the fix.