🐛 PUT-1586 + PUT-1599: Share dialog says what it can grant, and what it did - #3647
Merged
jfcastro92 merged 2 commits intoAug 26, 2026
Conversation
A recipient given "can edit & share" could not pass that level on: the dialog offered it, the server refused it, and the refusal was a bare 403 Forbidden that reads as a bug. Handing out manage needs authority over manage, which only the owner has — the refusal is right, the dead end and the silence were not. The dropdown now withholds it from anyone who does not own the item; a row already set to it keeps it, so opening the dialog cannot downgrade the owner's own grant, and a mixed selection follows its strictest item. The server says why, and only to someone who can already share the item — a stranger still gets the ACL's own safe error, which does not admit the node exists. Verified against a running server: a delegate grants read and write as before, and manage now answers cannot_delegate_manage with a sentence naming the owner as the one who can.
Sharing a file with someone who already had it answered "Shared with X", the same as a first share, so the dialog claimed to have done something it had not. The service already knew — it computes isNew to decide whether to notify the recipient — but the flag stopped at the controller. It now travels on share results only; a listing describes standing access and says nothing about it. Which of the three things happened is settled client-side, since the mode each recipient holds is already on screen: created access, raised or lowered it, or changed nothing. That keeps the previous mode off the wire, and an older backend that omits isNew still reads as a share, which is what these dialogs said before.
Contributor
Coverage Report for puter.js SDK
File Coverage
|
||||||||||||||||||||||||||||||||||||||
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
Salazareo
approved these changes
Aug 26, 2026
jfcastro92
merged commit Aug 26, 2026
3d28b2b
into
juancastro/put-1590-sharing-shared-files-are-not-different-than-regular-files
11 checks passed
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.
Two share-dialog bugs that share the same two files. Third in the stack — base is #3646, which is based on #3644. Review those first; this diff is only its own two commits.
Fixes PUT-1586 and PUT-1599.
PUT-1586 — a delegate could not pass on "can edit & share"
Reproduced against a running server before changing anything, and the ticket's "cannot share" turns out to be narrower than it reads: a recipient holding
managere-shares fine atreadandwrite. Onlymanagefails.Refusing is deliberate — handing out
manageneeds authority overmanage, which only the owner has, so delegation is one level deep by construction. The defects were around it: the dropdown offered the level, and the refusal was a bare 403 that reads as a bug.managekeeps the option, so a delegate opening the dialog cannot silently downgrade the owner's own grant, and a mixed selection follows its strictest item.cannot_delegate_manage, "Only the owner can grant edit & share access" — told only to someone who can already share the item, so a stranger still gets the ACL's own safe error that does not admit the node exists. There is a test for that leak.After:
If the intent was that a delegate should be able to pass on edit & share, this is the wrong fix — that is a permission-model change, and worth deciding before anyone writes it. This PR keeps the existing policy and fixes the affordance.
PUT-1599 — "Shared with X" when nothing changed
Sharing the same file with the same person twice answered exactly as a first share. Verified the wire was the problem, not the dialog: both calls returned byte-identical payloads.
The service already knew — it computes
isNewto decide whether to notify the recipient — but the flag stopped at the controller. It now travels on share results; a listing describes standing access, so it stays out ofgetShares().Which of the three things happened is settled client-side, because the mode each recipient holds is already on screen:
That keeps the previous mode off the wire. The lookup matches on the resolved username from the response rather than what was typed, so an email belonging to a known account still finds their row.
Live, after the change:
Verification
Both fixes were driven through the real dialog in a browser, not just asserted at the API. The GUI loads puter.js from the CDN, which predates
isNew, so every page in the run has that URL routed to the localdist/puter.dev.js— otherwise the dialogs are exercising an SDK that cannot carry what this PR added. The run asserts that before doing anything else, and aborts if the page ends up on the CDN build.Owner and delegate are separate accounts in separate browser contexts; the share modal is opened the way a user opens it, by right-clicking a row and choosing "Share…".
["read","write","manage"]["read","write"]6/6 checks passed. Each check is shown below, in the order above.1 — the owner is offered all three levels. "Can edit & share" is theirs to give.
2 — a first share. "Shared with v6uq49v", as before.
3 — the same access again. "v6uq49v already has this access" — this is PUT-1599; it used to repeat the message above.
4 — a different level. "Updated access for v6uq49v".
5 — the delegate's dialog. The picker offers "Can view" and "Can edit" only; "Can edit & share" is gone. This is PUT-1586. Their own row below still reads "Can edit & share", which is deliberate — an existing grant is never silently downgraded by opening the dialog.
6 — the delegate sharing what they may. "Shared with vsdw6be" at view level.
Check 5 runs as the owner's own session on an item someone else owns and has given them
manage— the same branch a delegate takes, without a second GUI login. Its access list shows the delegate's own row still reading "Can edit & share": a row already set to it keeps the option, so opening the dialog cannot silently downgrade the owner's grant.Alongside that:
is_newflips across repeat shares and that listings omit it; the delegate test pinscannot_delegate_manage, plus a test that a stranger asking formanagedoes not get that code.share_outcome, 2 for themanagefilter. 360 passing.isNewasserted in the sharing suite;check:puterjs:typesclean.readandwritestill succeed for a delegate,manageanswerscannot_delegate_manage;is_newistruethenfalseacross repeat shares and absent from listings.