Repository navigation
fix(native): refuse Hack key files as env sources and match Compose dotenv comments - #849
Conversation
A service env_file or the automatic .env is refused with a closed reason before any inspection or read when it is named like the project key (.hack.secret.key, at any depth, case-folded and NFC-normalized), a legacy project-relative store or key, or lies under a Hack home that is inside the project root. Start, preflight, restart preflight and fresh exec share the check. The decision uses paths only and opens nothing. Refs HACK-2062. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A tab before # in an unquoted value is now part of the value, matching Docker Compose. A table-driven test checks 86 dotenv cases against results recorded with Docker Compose v5.6.1; the remaining differences are deliberate refusals and are documented. Refs HACK-2062. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@codex review |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
ASCII-only folding let a non-ASCII case alias of the Hack home (for example Ä and ä on case-insensitive APFS) through. Fold full Unicode case after NFC normalization; over-matching only refuses more. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Ready for lead: 4cffd62 The #781 follow-ups (HACK-2062), based on What changed (details in the PR body)
Decisions to confirm
What I ran (Linux, pinned Bun 1.4.4,
Not verified
I will not push to this branch again. |
|
Addendum to the ready note at |
The privacy check reads /home/ segments as possible personal paths. Rename the synthetic Hack home fixtures; the assertions are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Ready for lead: c2f11e7 This replaces the ready note at
I will not push to this branch again. |
|
Mac batch result at c2f11e7: one assertion conflicts with #794. On this head alone Wanted: accept 🤖 Generated with Claude Code |
…ey-source refusal With first-use setup guidance (#794), native start also runs 'runtime setup inspect --json' before refusing. The test now accepts only 'project plan' and that read-only inspection after start, and still fails on any other runtime call such as a pool, file-delivery or start request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Ready for lead: e1dec86 This replaces the note at
I will not push to this branch again. |
Two follow-ups accepted when #781 (native Compose env files, HACK-2062) merged.
1. Hack key files are never environment sources
A service
env_fileor the automatic.envis refused with a closed reason, "Hack key and secret-store files cannot be environment sources", before any inspection, cache reuse or read, when it is:.hack.secret.keyat any depth. This covers the checkout key, the shared key under the git common directory and the primary checkout's key;.hack-secrets.enc.jsonor.hack-secrets-file.key(the legacy project-relative encrypted store and key);HACK_HOME, else~/.hack) when the Hack home lies inside the project root. A Hack home equal to the project root refuses every source.Paths are compared after Unicode NFC normalization and full Unicode case folding, so a case or normalization alias (
Äandä, for example) is refused too. An absent optional entry with such a name is refused rather than skipped. The check sits in the sharedreadofnative-compose-environment.ts, which start, preflight, restart preflight and fresh exec all reach throughprepareNativeProjectInput. The refusal names only the authored source path.flowchart TD S["env_file entry or automatic .env"] --> L["Literal path admission (inside project root)"] L --> K{"Hack key or secret-store file?"} K -->|"yes"| R["Closed refusal, nothing read"] K -->|"no"| G["Guarded read: ownership, modes, no symlinks, single link"] G --> P["Parse and private delivery"] class R failDecisions for the lead:
~/.hack(the base reads nothing there). So the final check is lexical. As a result:2. Compose dotenv grammar parity
tests/native-compose-env-parity.test.tsis table-driven: 86 cases, each expectation recorded offline with Docker Compose v5.6.1,docker compose config --format json, with an unreachableDOCKER_HOST. The test itself does not use Docker. The cases cover quoting and escapes,exportprefixes, inline comments, multi-line quoted values, empty versus unset, bare names, and the${VAR:-x},${VAR-x},${VAR:?err},${VAR?err},${VAR:+x}and${VAR+x}operators.#started a comment in native. Compose starts an unquoted inline comment only at a space followed by#, soA=val\t# cisval\t# cin Compose but wasvalin native. The automatic.envfollows the same rule in Compose (checked), so one fix covers both.A="v"x); Compose silently drops it. Native also refuses non-identifier keys, as already documented. Both refusals fail closed and are now listed indocs/native/environment-files.md.Docs:
docs/native/environment-files.md(the new rule, a parity section and prerelease change notes), its diagram (.mmdupdated and re-rendered withpele-render --theme light, which reproduces the previous SVG byte for byte), and the short v5 pagedocs/versions/v5/native/preflight.md.Verification (Linux, pinned Bun 1.4.4)
doctor --native-preflightreports theenvironment_file_inputblocker with the reason, and foregroundupexits 1 with only the runtime review call. The key file's content never appears in output or argv.umask 022; under a002umask, 3 existing tests fail on the base as well, because group-writable fixture directories are refused.docs:prepare+docs:check: pass.Not verified: macOS, the real-VM env-file scenario (the lead runs it), and the full root suite.
🤖 Generated with Claude Code