Skip to content

fix(trigger): keep secret text out of env sync errors and refuse an unknown sync target - #9672

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/trigger-env-sync-hardening
Nov 4, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/trigger-env-sync-hardening

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow-ups to #9632 (Trigger.dev env sync from the app's Secrets Manager secret), from a final review of the release branch.

  • Keep secret text out of the error. A malformed env-vars secret failed with the JSON parser's message, which quotes the text around the fault (part of a value), and the Trigger.dev deploy prints that error to a public CI log. The error now names only the failure.
  • Refuse a malformed sync-target list. TRIGGER_ENV_SYNC_TARGETS was split on commas with no validation, so Staging or a typo silently kept the environment on the old path. parseTriggerEnvSyncTargets (next to APP_ENV_SECRET_IDS) accepts only the exact comma list the deploy workflows' credential checks match, and refuses a padded, empty, or unknown entry (checked by own key, so constructor cannot pass); the deploy exits on it (syncEnvVars swallows throws) and logs which path it took. resolveTriggerEnvFromAppSecret uses the same own-key lookup.
  • Accurate docs. The sync TSDoc now says the CLI applies variables when it uploads the version (before promotion) and that the sync only adds or updates; fetchRuntimeSecrets retries every failed request (not only transient ones); the worker-marker comments point at TRIGGER_CONSTANT_VARS; FUNCTION_EXECUTION_ENV notes it applies only outside the sync list.

Type of Change

  • Bug fix

Testing

  • packages/runtime-secrets: keeps the secret text out of a malformed-JSON error (red on the old code: the message contained the value); parseTriggerEnvSyncTargets reads the exact list, treats an unset gate as none, and refuses padded, empty, and unknown entries (red with trimming restored, or with in instead of an own-key check). 13/13.
  • type-check for packages/runtime-secrets and apps/sim; lint and type-check (pre-push hooks); remaining audits in CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…nknown sync target

A malformed env-vars secret failed with the JSON parser's message, which quotes the text around
the fault, and the Trigger.dev deploy prints that error to a public CI log; the error now names
only the failure. TRIGGER_ENV_SYNC_TARGETS was split on commas without trimming or validation, so
a typo or a space silently kept an environment on its old configuration; it is now parsed by
parseTriggerEnvSyncTargets, which trims entries and refuses a name with no mapped secret (by own
key, so prototype names cannot pass), and the deploy logs which path it took.

Comments now say the CLI applies synced variables when it uploads the version and that the sync
never deletes, describe the retry as every failed request, and point the worker marker at
TRIGGER_CONSTANT_VARS.
@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 4, 2026 10:52am UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues remain.

Summary

The PR keeps secret text out of JSON errors and rejects malformed TRIGGER_ENV_SYNC_TARGETS lists.

  • Trigger.dev deploys reject invalid sync targets before choosing a secret.
  • Malformed secret errors no longer include snippets of secret text.
  • Sync and worker notes explain when settings apply and where the worker marker comes from.

Reviews (2) · Last reviewed commit: "fix(trigger): accept only the exact sync..." · Reviewed by Greptile

…lows match

The workflows grant the secret-read credentials by matching TRIGGER_ENV_SYNC_TARGETS as an exact
comma list, so a trimmed parser could accept a padded entry the credential step skipped and fail
inside the sync instead. The parser now refuses a padded, empty, or unknown entry with a message
naming the expected format.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 32cb270 into staging Nov 4, 2026
81 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/trigger-env-sync-hardening branch November 4, 2026 18:13

This branch was previously deployed

1 inactive deployment
Preview — 44bb5dc2 Deployed Nov 4, 2026 by vercel[bot]
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