# test625 — explicit `--env` CRLF rejection

Date: 2026-08-09
Issue: #621
Source commit: f04ec2e6baa8e35968c29c54b0f12763b5a65363
Docker tag: anet-test625:dev
Docker image: sha256:786b9bc1f21f82a8dbc445627a61c75ec2d4d040181d4b793219a6046fe52025
Embedded source: TEST625_SOURCE_COMMIT=f04ec2e6baa8e35968c29c54b0f12763b5a65363
Runner artifact SHA256: 8653db18eebe71e4b2458b060324881d06302d790736f0cce01266a73035f07e

## Result

- TypeScript `tsc --noEmit`: PASS.
- Helper and writer-wiring contracts: 10 pass / 0 fail / 24 assertions.
- Production CLI/node-server/worker build: PASS.
- Real isolated Hub + built CLI rejected a newline-bearing explicit `--env`
  before either `config.json` or `.env` existed.
- The rejection log did not echo the synthetic injected value.
- A safe explicit credential still created a mode-600 dotenv containing
  exactly one assignment and no injected key.
- All `.env`-writing create flows converge on `saveCreatedNode` and
  `rewritePlainSecretsToEnvRef`. Named create reaches the earlier vendor
  collector and the shared writer preflight. Batch and the legacy
  missing-profile wizard call `saveProfile` directly and do not write a node
  `.env`.
- The concrete no-name invocation `anet node create --runtime ... --env ...`
  cannot enter the current interactive wizard: the parser treats `--runtime`
  as the positional id and rejects usage before prompting or writing state.
  The Docker test invokes this exact form and verifies nonzero exit, no secret
  echo, and no node config or dotenv file. The writer-boundary guard remains
  defense in depth for future or bypass callers that can reach the writer.
- Disabling only the named-create collector still rejected the malicious value
  at the shared writer preflight before node directory, `.gitignore`, process
  environment, config, or dotenv mutation.
- Disabling both the named-create collector and the writer planner, rebuilding
  the real CLI, and repeating the command produced a second `INJECTED=...`
  dotenv line. This is a true behavior mutation, not a source-string assertion.
- Restoring the validation and rebuilding restored fail-closed behavior with
  no profile or dotenv write.

```text
L2 no-name CLI flags cannot enter the interactive wizard
L4 defense-in-depth: bypassing direct collection still fails at the writer preflight
WRITER_PREFLIGHT_PASS: direct collector bypass still rejected before create side effects
L5 witnessed-red: bypassing both guards injects a second dotenv line
MUTATION_RED: dotenv-writer-crlf rc=1 (injected dotenv line witnessed)
L6 restored green
RESULT: PASS
```

All credentials and injected values were synthetic fixtures inside Docker.
No production service, database, token, global package, or deployment was
touched.
