Skip to content

fix(platform): redact sandbox placements for developers - #4234

Merged
yannickmonney merged 2 commits into
mainfrom
fix/sandbox-capacity-placement-redaction
Oct 4, 2026
Merged

yannickmonney merged 2 commits into
mainfrom
fix/sandbox-capacity-placement-redaction

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • redact sandbox device placements from Developer capacity responses
  • preserve Owner/Admin placement visibility
  • cover private placements and Member denial (403 without capacity, deployment-limit or SQL calls) in the route role matrix

Verification

  • installed Node: node ../../node_modules/vitest/vitest.mjs run backend/domains/sandbox/routes.test.ts --project server --maxWorkers=1 from services/platform: 26/26 tests pass
  • focused oxfmt --check and oxlint --type-aware pass for the changed route test
  • staged conflict-marker and formatter hooks pass; local SAST hook completes; git diff --check passes
  • previous independent review proved the Developer leak regression and schema/client/UI compatibility at the preceding head; distinct exact-head re-review requested for this repair
  • no hosted CI rerun or cancellation

Closes #3679

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Independent verdict: REQUEST CHANGES

Reviewed exact head 214c5be, confirmed at start and immediately before posting. Reviewer: TALE-560, Codex #9 b7c66e31, distinct from implementation agent/run Codex #14 c0c99cd0 / bb902d0a. Read TALE-217 in full; its source issue is #3679.

Required corrections

  1. P2 — Complete the actual role regression with Member. services/platform/backend/domains/sandbox/routes.test.ts:185 tests denied roles editor and viewer, but never member. Member is a supported role (lib/shared/schemas/organizations.ts:6); viewer is not in that schema. The acceptance contract explicitly requires Member capacity 403 and regression coverage of each role. Add member to the denied-role matrix, retaining assertions that no capacity/deployment/query calls occur. The production gate currently denies Member correctly by inspection; this is a missing privacy/authorization regression, not a claim that Member currently receives data.
  2. P2 — Correct the closing reference in the PR body. It currently says Closes #217, which is the unrelated closed “Implement Comprehensive Audit Logging System for B2B Compliance” issue. TALE-217 is a task number, not its GitHub issue number. Use Closes #3679 so the actual privacy report is linked and closed on merge.

Positive evidence

  • The added placements override closes the demonstrated Developer session→device leak; existing runtimeSessions redaction also removes its deviceId. Owner/Admin retain both arrays, including absent optional placements; Member is rejected by the unchanged compute-reader gate. The real client parses through the closed shared Zod object, dropping unknown top-level fields; remaining capacity fields are counts, measurements, enum labels and an observation timestamp.
  • Real route/client tests 40/40 passed using installed Node /opt/node/bin/node, one worker. The author's Bun-runner z.enum collection failure is reproducible, but is not a Node test failure. Setting PATH=/opt/node/bin:$PATH makes the existing focused suite work.
  • Regression sensitivity observed: substitute only the pre-fix routes.ts while retaining head tests → 1 failure / 24 passes, specifically Developer receives the private placement. Restored exact-head production source afterward.
  • Head jsdom consumer tests 27/27 passed (sandboxes-settings.test.tsx, sandbox-capacity.test.tsx), one worker, 2 GiB heap. The isolated worktree needed a review-only Vite filesystem allowlist for reused dependencies. No browser launched. Developer skips workspace queries/table; Owner/Admin keep placement rendering; denied readers see AccessDenied.
  • Supplemental synthetic-fetch proof uses the real sandboxCapacity parser and real shared schema: unknown fields stripped; retained Owner/Admin and empty-array Developer shapes accepted; redacted shape contains neither private session nor private device identifier. This supplement is not a substitute for the missing committed Member regression.
  • Focused oxfmt --check, oxlint --type-aware, schema-only TypeScript check and git diff --check passed. EN/DE/FR sandbox docs already describe Developer aggregate-only access without private workspace details; none documents the wire placements field, so no docs edits are required.

Limits / unrun proof

No full-workspace typecheck, full suite, backend integration/database, live HTTP authentication, sandbox/device/stack/container, browser, E2E or visual proof. TypeScript compilation covers the shared schema only, not the entire route import graph. Five hosted Candidate source / Resolve source checks remain pending at the last passive read; no green-CI claim. No CI rerun/cancellation, push, merge or task/card move. Repair remains with the implementation owner; this verdict does not decide the protected native human approval.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Independent re-review: ACCEPT

Reviewed exact head 5ba2356, confirmed at the start (06:40Z) and again immediately before posting. Reviewer: TALE-585, agent #5 718fc56b. That is distinct from the author, Codex #14 c0c99cd0 (runs bb902d0a, eaac2532), and from the round-1 reviewer, Codex #9 b7c66e31. The contract is TALE-217 / #3679. Round 1 requested changes at 214c5be8: #4234 (comment)

Round-1 findings

  1. Member regression: resolved. routes.test.ts:187 now runs withholds infrastructure reads from %s for ['member', 'editor', 'viewer']. member is a real role (lib/shared/schemas/organizations.ts:6).
    • For Member, the test asserts 403 on /capacity, /limits, /quota-usage and /sessions/view.
    • It also asserts that the capacity client, the deployment-limits client and the route's own SQL are never called.
    • Proof that it bites: a mutant that admits member to requireComputeReader (routes.ts:68, || role === 'member') fails exactly withholds infrastructure reads from member (expected 200 to be 403): 1 failed / 25 passed. The same mutant passes all 25/25 round-1 tests at 214c5be8. That is the gap this repair closes.
  2. Closing reference: resolved. The body says Closes #3679 and cites no other #N. GitHub's closingIssuesReferences for this PR is exactly bug(platform): sandbox capacity exposes private workspace IDs to Developers through placements #3679 (open). feat: Implement Comprehensive Audit Logging System for B2B Compliance #217 no longer appears.

Unchanged behaviour, no scope creep

  • git diff 214c5be8 5ba23565 is one line in one file: it.each(['editor', 'viewer']) became it.each(['member', 'editor', 'viewer']).
  • routes.ts is byte-identical to round 1. The Developer redaction (placements: hasAdminCapability(c) ? snapshot.placements : [], routes.ts:104) and the Owner/Admin path are therefore unchanged. So are their assertions (routes.test.ts:139-185).
  • The whole PR against its base 8a580fcc2 is 2 files, +12 −1: the one-line fix and its test.

The regression fails on main

  • routes.ts is identical at the PR base and at current main d29a3c8fe. Main is 4 commits ahead, and none of them touch the sandbox domain, auth, permissions or the other modules routes.ts imports.
  • With main's routes.ts and this head's tests: 1 failed / 25 passed, exactly allows developer to inspect the authenticated organization.
  • The received body carries placements: [{ sessionId: 'private-project-session', deviceId: 'private-device' }] where [] is expected. I restored the file afterwards, and the worktree diff is empty.

Exact-head run

  • From services/platform, with Node v24.21.0: node ../../node_modules/vitest/vitest.mjs run backend/domains/sandbox/routes.test.ts --project server --maxWorkers=1.
  • Setup: a sparse worktree at this head, with node_modules linked from a worktree on the same base and lockfile.
  • Result: 26/26 passed, including withholds infrastructure reads from member.
  • oxfmt --check on routes.ts and routes.test.ts passes.

Non-blocking note

The route test mocks requireSession and requireOrgMember. Its query no-call assertion therefore covers the route's own SQL (the quota-usage count), not the membership lookup, which the mock never performs. That is the right scope for a route test. Read "no SQL calls" in the PR body in that sense. No change is requested.

Limits / unrun proof

  • Ran: only the targeted route test file at this head, plus the main-routes and Member-gate mutants.
  • Not re-run at this head: the round-1 client-parser/schema proof and the jsdom consumer suites. Their inputs are unchanged since 214c5be8, because the interdiff touches only the test file.
  • Not run at all: full suites, workspace typecheck, oxlint, DB integration, live auth HTTP, browser/E2E, sandbox/device/stack.
  • Hosted CI at this head: 5 Candidate source / Resolve source checks were still queued at 06:43Z. I make no green-CI claim, did not wait on the queue, and did not rerun or cancel anything.
  • No push, merge or card move. A formal GitHub review is impossible here, because the agents share the author's account, so this comment is the record. The protected native human approval stays with its reviewer.

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.

bug(platform): sandbox capacity exposes private workspace IDs to Developers through placements

1 participant