Repository navigation
Fix P1s: shared-save null bypass, push cleanup, invite secret leak - #40
Merged
Merged
Conversation
- Treat explicit baseVersion:null as absent in /api/files and /api/file: it previously bypassed both the shared 409 guard and the atomic compare (checkBaseVersion treats null as no-check), allowing silent teammate overwrites - Only delete a just-created repo after confirming it is empty (repoHasCommits probe; 409 means fresh shell). A push accepted before failing, or an unverifiable probe, keeps the repo with an explicit message instead of deleting possible commits - Stop spreading memberSecret in the /api/share/invite JSON body; the credential travels only in the HttpOnly cookie, the client uses just code + playgroundId
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
- 409 counts as empty only with the known empty-repo message; other 409s and anomalous 200 payloads stay unknown (fail safe) - Confirmed-empty but failed delete reports explicitly instead of claiming an unverifiable state
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.
Addresses the two cubic P1s from #39 plus the invite credential leak:
routes/files.ts,routes/github-repos.ts): an explicitbaseVersion: nullskipped both the shared 409 guard (=== undefinedcheck) and the atomic compare (checkBaseVersiontreats null as no-check) — a silent teammate overwrite. Null is now normalized to absent at both save endpoints, so it hits the same 409 reload prompt as an omitted version.github.tsrepoHasCommits+ create/promote catch): on push failure the shell is probed first (commits endpoint; 409 = confirmed empty). Only a confirmed-empty shell is deleted; a repo that may hold commits or can't be verified is kept, with a message saying exactly which.routes/share.ts): the JSON body spread the fullcreateInviteresult including the owner's member credential (readable by page JS despite the HttpOnly cookie). The body now carries onlycode+expiresAt+playgroundId; the credential still travels in the cookie, which the client never needed from JSON.Tests: null-baseVersion 409s for both save endpoints, invite body has no secret,
repoHasCommitsunit cases (commits/empty/denied/network-down), and a newtests/repo-create.test.tscovering create ×3 probe outcomes + promote kept-commits. 358/358 pass, tsc clean.Summary by cubic
Fixes three P1 issues: a shared-save null bypass, unsafe repo cleanup on failed push, and a leaked invite credential.
baseVersion: nullnow behaves like an omitted version on both/api/filesand/api/file, so shared saves hit the same stale-version 409 instead of silently overwriting a teammate's edits.POST /api/share/inviteno longer spreads the full invite record into the JSON body; it returns onlycode,expiresAt, andplaygroundId. The owner's member credential travels only in the HttpOnly cookie.Written for commit 0f923be. Summary will update on new commits.