Skip to content

fix(export): continue after invalid identifier to avoid stale env sync#1610

Merged
chaliy merged 1 commit into
mainfrom
2026-05-08-propose-fix-for-stale-variable-export-issue
May 8, 2026
Merged

fix(export): continue after invalid identifier to avoid stale env sync#1610
chaliy merged 1 commit into
mainfrom
2026-05-08-propose-fix-for-stale-variable-export-issue

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented May 8, 2026

Motivation

  • Interpreter post-processing always syncs export operands into env, but the export builtin previously returned immediately on invalid identifiers causing later valid NAME=VALUE operands to be skipped and stale values to be exported.
  • Align export behavior with Bash semantics and preserve readonly handling by making per-operand failures non-fatal to further argument processing.

Description

  • Change crates/bashkit/src/builtins/export.rs to stop returning early on invalid identifiers and instead append an error to stderr, set exit_code = 1, and continue processing remaining args.
  • Preserve existing readonly-error reporting and behavior (still sets exit_code = 1 and continues).
  • Add a regression test export_continues_after_invalid_identifier_and_exports_good_args in crates/bashkit/tests/blackbox_security_tests.rs that exercises GOOD=old; export 1BAD=x GOOD=new and asserts the command exits nonzero while GOOD is updated and exported.

Testing

  • Ran the targeted test with cargo test -p bashkit --test blackbox_security_tests finding_readonly_bypass::export_continues_after_invalid_identifier_and_exports_good_args and it passed (ok).

Codex Task

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 8, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 981276b Commit Preview URL May 08 2026, 09:20 PM

@chaliy chaliy force-pushed the 2026-05-08-propose-fix-for-stale-variable-export-issue branch from 7b9c0f0 to 981276b Compare May 8, 2026 21:20
@chaliy chaliy merged commit ea36ea2 into main May 8, 2026
34 checks passed
@chaliy chaliy deleted the 2026-05-08-propose-fix-for-stale-variable-export-issue branch May 8, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant