Skip to content

fix: disable .env autoload in compiled binaries#1799

Merged
firecow merged 1 commit intomasterfrom
fix/disable-dotenv-compiled-binary
Mar 9, 2026
Merged

fix: disable .env autoload in compiled binaries#1799
firecow merged 1 commit intomasterfrom
fix/disable-dotenv-compiled-binary

Conversation

@firecow
Copy link
Copy Markdown
Owner

@firecow firecow commented Mar 9, 2026

Summary

  • The bunfig.toml fix from fix: disable Bun automatic .env loading #1794 only works when running via bun run (bun resolves it from process.cwd())
  • Compiled bun executables auto-load .env from cwd by default, regardless of bunfig.toml
  • This adds --no-compile-autoload-dotenv to all build commands to disable .env loading at compile time

Test plan

  • Built binary locally with the flag, confirmed .env in cwd is no longer loaded
  • Verified variable substitution (${VAR:-default}) resolves correctly in env output

Summary by cubic

Disable .env autoloading in compiled bun binaries by adding --no-compile-autoload-dotenv to all build scripts. This prevents env leaks from the current directory and aligns compiled behavior with our bunfig.toml config used by bun run.

  • Bug Fixes
    • Added the flag to every compile target in package.json (Linux x64/arm64, macOS x64/arm64, Windows, generic build).
    • Compiled binaries no longer load .env from cwd; behavior now matches bun run.

Written for commit c704693. Summary will update on new commits.

The bunfig.toml added in #1794 only applies when bun resolves it from
process.cwd(), which doesn't help for compiled executables. Bun compiled
binaries auto-load .env from cwd by default, leaking project variables
into the environment.

Use --no-compile-autoload-dotenv in all build commands to disable this
at compile time.
@firecow firecow self-assigned this Mar 9, 2026
Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

No issues found across 1 file

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 9, 2026

@firecow firecow merged commit ea1b2e9 into master Mar 9, 2026
16 checks passed
@firecow firecow deleted the fix/disable-dotenv-compiled-binary branch March 9, 2026 08:57
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Mar 24, 2026
This MR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|---|---|
| [npm:gitlab-ci-local](https://github.com/firecow/gitlab-ci-local) | `4.67.2` → `4.70.0` | ![age](https://developer.mend.io/api/mc/badges/age/npm/gitlab-ci-local/4.70.0?slim=true) | ![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/gitlab-ci-local/4.70.0?slim=true) | ![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/gitlab-ci-local/4.67.2/4.70.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/gitlab-ci-local/4.67.2/4.70.0?slim=true) |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>firecow/gitlab-ci-local (npm:gitlab-ci-local)</summary>

### [`v4.70.0`](https://github.com/firecow/gitlab-ci-local/releases/tag/4.70.0)

[Compare Source](firecow/gitlab-ci-local@4.69.0...4.70.0)

#### What's Changed

- Add `GCL_VARIABLE_<name>` env var support, replace `yargs .env("GCL")` by [@&#8203;firecow](https://github.com/firecow) in [#&#8203;1805](firecow/gitlab-ci-local#1805)
- fix: prefix rsync paths with ./ by [@&#8203;ednxzu](https://github.com/ednxzu) in [#&#8203;1801](firecow/gitlab-ci-local#1801)
- chore(deps): update all non-major by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;1802](firecow/gitlab-ci-local#1802)
- chore(deps): lock file maintenance by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;1798](firecow/gitlab-ci-local#1798)

#### New Contributors

- [@&#8203;ednxzu](https://github.com/ednxzu) made their first contribution in [#&#8203;1801](firecow/gitlab-ci-local#1801)

**Full Changelog**: <firecow/gitlab-ci-local@4.69.0...4.70.0>

### [`v4.69.0`](https://github.com/firecow/gitlab-ci-local/releases/tag/4.69.0)

[Compare Source](firecow/gitlab-ci-local@4.68.1...4.69.0)

#### What's Changed

- fix: disable .env autoload in compiled binaries by [@&#8203;firecow](https://github.com/firecow) in [#&#8203;1799](firecow/gitlab-ci-local#1799)
- Add `--wait-for-services-timeout` option to CLI by [@&#8203;dernilz](https://github.com/dernilz) in [#&#8203;1796](firecow/gitlab-ci-local#1796)
- ci: add Node.js and Bun version matrix to smoke test by [@&#8203;firecow](https://github.com/firecow) in [#&#8203;1797](firecow/gitlab-ci-local#1797)
- chore(deps): update github/codeql-action action to v4.32.6 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;1793](firecow/gitlab-ci-local#1793)

**Full Changelog**: <firecow/gitlab-ci-local@4.68.1...4.68.2>

### [`v4.68.1`](https://github.com/firecow/gitlab-ci-local/releases/tag/4.68.1)

[Compare Source](firecow/gitlab-ci-local@4.68.0...4.68.1)

#### What's Changed

- chore(deps): update all non-major by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;1792](firecow/gitlab-ci-local#1792)
- fix: disable Bun automatic .env loading by [@&#8203;firecow](https://github.com/firecow) in [#&#8203;1794](firecow/gitlab-ci-local#1794)

**Full Changelog**: <firecow/gitlab-ci-local@4.68.0...4.68.1>

### [`v4.68.0`](https://github.com/firecow/gitlab-ci-local/releases/tag/4.68.0)

[Compare Source](firecow/gitlab-ci-local@4.67.2...4.68.0)

#### What's Changed

- chore(deps): lock file maintenance by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;1785](firecow/gitlab-ci-local#1785)
- fix: docker cp fails on read-only directories by [@&#8203;firecow](https://github.com/firecow) in [#&#8203;1773](firecow/gitlab-ci-local#1773)
- make services run as container user instead of root by [@&#8203;peterbbeu](https://github.com/peterbbeu) in [#&#8203;1781](firecow/gitlab-ci-local#1781)
- chore(deps): update github/codeql-action action to v4.32.5 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;1786](firecow/gitlab-ci-local#1786)
- Migrate test runner from bun:test to vitest by [@&#8203;firecow](https://github.com/firecow) in [#&#8203;1784](firecow/gitlab-ci-local#1784)
- Route parser warnings through WriteStreams instead of console.log by [@&#8203;firecow](https://github.com/firecow) in [#&#8203;1788](firecow/gitlab-ci-local#1788)
- Use test.concurrent for independent integration tests by [@&#8203;firecow](https://github.com/firecow) in [#&#8203;1769](firecow/gitlab-ci-local#1769)
- Fix Docker volume leak on SIGTERM, SIGHUP, and concurrent cleanup by [@&#8203;cegofrhs](https://github.com/cegofrhs) in [#&#8203;1787](firecow/gitlab-ci-local#1787)
- Add TypeScript type checking to CI by [@&#8203;firecow](https://github.com/firecow) in [#&#8203;1789](firecow/gitlab-ci-local#1789)
- Convert remaining tests to concurrent and tune vitest by [@&#8203;firecow](https://github.com/firecow) in [#&#8203;1790](firecow/gitlab-ci-local#1790)
- fix: flaky log-padding test assertions by [@&#8203;firecow](https://github.com/firecow) in [#&#8203;1791](firecow/gitlab-ci-local#1791)

#### New Contributors

- [@&#8203;cegofrhs](https://github.com/cegofrhs) made their first contribution in [#&#8203;1787](firecow/gitlab-ci-local#1787)

**Full Changelog**: <firecow/gitlab-ci-local@4.67.2...4.68.0>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My42MS43IiwidXBkYXRlZEluVmVyIjoiNDMuODYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
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.

2 participants