Repository navigation
fix(api): apply the guest file view to checkpoint file routes - #538
Merged
Merged
Conversation
Checkpoint file routes checked only checkpoint.view, so a guest could read files that the workspace .gitignore hides, through checkpoints/:id/fs/*. Resolve the caller's file view like the workspace routes and apply it in the shared checkpoint helpers. A filtered view hides paths matched by the workspace .gitignore, read per request, so a rule added later also hides older checkpoints. Filtered views skip the precomputed and cached diffs, which hold unfiltered paths. Filtered access on local sandboxes is denied, because their .gitignore is not on this server.
A checkpoint committed before a .gitignore rule is filtered by the current workspace rule on every read, including after an owner read has populated the caches.
markbang
force-pushed
the
fix/checkpoint-fs-visibility
branch
from
November 20, 2026 06:08
d53426e to
32c8807
Compare
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.
Summary
Reads of checkpoints committed before a .gitignore rule are filtered at read time against the current workspace .gitignore (test:
reads of a checkpoint committed before a .gitignore rule are filtered by the current rule).Checkpoint file routes (
/checkpoints/:id/fs/{tree,file,diff,diff/file}) checked onlycheckpoint.view. The workspace file routes also apply the caller's file view, so filtered viewers were not held to the workspace.gitignoreon checkpoint reads.resolveFileViewVisibilitymoves topermissions.tsso both file routes share it..gitignoreused is the workspace's current one, read per request (the same rule as the live view). A rule added later also hides already-checkpointed content.visibility: "full"explicitly.Evidence
.gitignore.After: the same request returns
404 path_not_found, and the tree and diff summary omit the path. Full view returns the same results as before.apps/api/tests/checkpoint-fs-visibility.integration.ts(real git repo, real.gitignore):tree,file,diff, anddiff/filemainand passes herenode scripts/test/run.mjs ... tests/fs-pagination.integration.ts tests/checkpoint-fs-visibility.integration.ts: 8 tests pass.src/checkpoint-diff.test.ts: 5 tests pass.biome checkon touched files: clean.tsc --noEmitinapps/api: the same pre-existing errors asmainin this environment (unbuilt workspace packages); none new.Merge Danger
Door: two-way. Revert restores the previous behaviour; no data or schema change.
Blast Radius: checkpoint file and diff routes for non-owner viewers, plus the
checkpoint-fshelpers' signature (all callers in this PR). Owner and full-view responses are unchanged. Filtered diffs are computed from git on each request instead of the cache, so guest diff latency rises slightly. Filtered access to checkpoints of local sandboxes is now denied (403), as the workspace routes already do.