Skip to content

fix(sandbox): scope Daytona snapshots by account - #465

Closed
pawxnsingh wants to merge 1 commit into
truefoundry:mainfrom
pawxnsingh:fix/daytona-snapshot-namespace
Closed

pawxnsingh wants to merge 1 commit into
truefoundry:mainfrom
pawxnsingh:fix/daytona-snapshot-namespace

Conversation

@pawxnsingh

@pawxnsingh pawxnsingh commented Aug 27, 2026 •

Copy link
Copy Markdown

Summary

Daytona snapshot names are global, while TrueForge previously derived the snapshot build name from only the sandbox image digest. Two Daytona accounts using the same TrueForge image therefore converged on the same name, which could resolve to another account's inaccessible snapshot and return Access denied.

This scopes the derived name to both the Daytona credential and image digest using HMAC-SHA256. The credential is used only as the HMAC key and is never serialized into the snapshot name.

No maintainer approval or tracking issue is linked yet.

Changes

  • Derive deterministic snapshot names from the Daytona credential and image digest.
  • Preserve convergence for replicas using the same account and image.
  • Add regression coverage proving different credentials produce different build names.
  • Add a patch changeset for trueforge-core.

How was this tested?

  • pnpm --filter @truefoundry/trueforge-core exec jest --config jest.config.cjs packages/trueforge-core/tests/core/sandbox/daytonaSnapshotRegistration.test.ts --runInBand — 5 tests passed.
  • pnpm --filter @truefoundry/trueforge-core typecheck — passed.
  • Live TrueForge configuration reached Daytona snapshot ready state, and Daytona sandboxes successfully ran CSV, XLSX, and MCP-to-PostgreSQL integration turns.

Checklist

  • I have read the contributing guidelines
  • Full workspace build, test, lint, and format checks pass locally (focused tests and trueforge-core typecheck passed; CI will run the complete matrix)
  • Tests added/updated where it makes sense
  • No hand-edits to generated code
  • Docs / .env.example updated if configuration or behavior changed (not applicable: no configuration shape changed)

Note

Medium Risk
Changes sandbox snapshot registration naming on the Daytona provider path; deployments without a persisted build_ref may register under a new name and need a fresh build, but the fix addresses real cross-account snapshot collisions.

Overview
Daytona snapshot names are global, so TrueForge previously derived trueforge-build-* names from the sandbox image digest alone. Different Daytona accounts sharing the same TrueForge image could collide on that name and hit another account’s snapshot (e.g. Access denied).

This PR mixes the Daytona API key into derivation via HMAC-SHA256 over the digest (key material never appears in the name). Replicas with the same credential and image still get one deterministic name; omitted buildRef now resolves to a 40-character hex suffix instead of the raw digest. Persisted build_ref behavior is unchanged.

Tests assert the new name shape and that different API keys produce different registration names; a patch changeset documents the fix.

Reviewed by Cursor Bugbot for commit b4070e9. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b4070e9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@truefoundry/trueforge-core Patch
@truefoundry/trueforge Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pawxnsingh

Copy link
Copy Markdown
Author

Closing this PR because the change is outside the scope of our hackathon product work. Sorry for the noise.

@pawxnsingh pawxnsingh closed this Aug 27, 2026
@pawxnsingh
pawxnsingh deleted the fix/daytona-snapshot-namespace branch August 27, 2026 01:46
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.

1 participant