Harden CLI safety and release checks - #12
Merged
Merged
Conversation
Require confirmation for version deletion and reject unsafe credential-store reads. Tighten Control URL, local HTTP, tail event, Workflow pagination, and Wrangler version handling. Pin release actions and fail stable tags before publish when changelog notes are missing. Keep diagnostic fallbacks and user documentation aligned with the resulting behavior. Signed-off-by: Lu Zhang <lu@wdl.dev>
There was a problem hiding this comment.
Pull request overview
Hardens CLI credential handling, destructive operations, input validation, Wrangler compatibility, and release automation.
Changes:
- Adds confirmation and validation safeguards across delete, Tail, Workflow, URL, and token-store paths.
- Enforces Wrangler v4 and improves Windows
npxresolution. - Pins GitHub Actions and validates stable changelog notes before publishing.
Reviewed changes
Copilot reviewed 43 out of 45 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
tsconfig.json |
Type-checks release scripts. |
eslint.config.js |
Lints release scripts. |
bin/wdl.js |
Fails closed on required namespace resolution. |
lib/common.js |
Adds shared page-limit normalization. |
lib/config-state.js |
Adds diagnostic token-store fallback. |
lib/credentials.js |
Tightens URL and credential resolution. |
lib/token-store.js |
Validates store paths and permissions. |
lib/wrangler/command.js |
Enforces Wrangler v4 and Windows npx support. |
commands/config.js |
Reports token-store diagnostic errors. |
commands/delete.js |
Confirms version deletion and rejects dry-run. |
commands/deploy.js |
Preserves local Worker URL origins. |
commands/doctor.js |
Aligns diagnostics with new safety checks. |
commands/r2.js |
Uses shared limit validation. |
commands/tail.js |
Caps cumulative SSE event data. |
commands/workflows.js |
Validates pagination limits. |
scripts/changelog-section.js |
Extracts and validates release notes. |
.github/workflows/ci.yml |
Pins official actions. |
.github/workflows/release.yml |
Pins actions and gates release notes. |
tests/unit/helpers.js |
Shares invalid pagination fixtures. |
tests/unit/cli-common.test.js |
Updates confirmed deletion coverage. |
tests/unit/cli-config-doctor.test.js |
Covers diagnostic and Wrangler behavior. |
tests/unit/cli-credentials.test.js |
Covers URL and unsafe-store handling. |
tests/unit/cli-delete.test.js |
Covers version confirmation safeguards. |
tests/unit/cli-deploy.test.js |
Covers .local Worker URL behavior. |
tests/unit/cli-r2.test.js |
Expands limit normalization coverage. |
tests/unit/cli-release.test.js |
Tests changelog extraction. |
tests/unit/cli-tail.test.js |
Tests SSE event-size limits. |
tests/unit/cli-token-store.test.js |
Tests store permission and type checks. |
tests/unit/cli-workflows.test.js |
Tests Workflow pagination validation. |
tests/unit/cli-wrangler-command.test.js |
Tests v4 and Windows npx handling. |
tests/integration/cli-live.test.js |
Confirms retained-version deletion. |
GUIDE.md |
Documents hardened behavior. |
GUIDE-zh.md |
Synchronizes Chinese guidance. |
docs/deploy.md |
Updates deployment safety guidance. |
docs/deploy-zh.md |
Synchronizes Chinese deployment guidance. |
docs/r2.md |
Documents output overwrite semantics. |
docs/r2-zh.md |
Synchronizes Chinese R2 guidance. |
docs/token.md |
Documents store trust requirements. |
docs/token-zh.md |
Synchronizes Chinese token guidance. |
docs/workflows.md |
Documents pagination limits. |
docs/workflows-zh.md |
Synchronizes Chinese Workflow guidance. |
CONTRIBUTING.md |
Updates module ownership documentation. |
CHANGELOG.md |
Records safety and release changes. |
AGENTS.md |
Updates credential-store security guidance. |
.claude/skills/wdl-deploy/SKILL.md |
Updates agent-facing CLI guidance. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Read token stores through a validated no-follow file descriptor. Reject unsafe control URL components without echoing embedded credentials. Clarify token-store ownership remediation and local endpoint behavior. Signed-off-by: Lu Zhang <lu@wdl.dev>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 43 out of 45 changed files in this pull request and generated no new comments.
Suppressed comments (1)
commands/delete.js:71
- The new interactive prompt writes the namespace, worker, and version directly to the terminal.
confirmActionescapes only the non-TTYaction;readTtyLineemitspromptverbatim, so a positional populated from an untrusted shell variable can inject terminal control sequences before confirmation. Escape the interpolated values as is done for other CLI diagnostics.
prompt: `Are you sure you want to delete version "${ns}/${worker}@${version}"? [y/N] `,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--dry-runflagconfig explainanddoctoruseful when an attempted token-store read is malformed, unreadable, or unsafeWhy
The audit found several places where an accepted option was silently ignored, a trusted local credential source was not revalidated safely on read, or diagnostics and release automation did not enforce their documented contracts. This change closes those gaps without moving Control-plane business policy into the CLI.
The final token-store read path rejects symlink and non-regular credential files, avoids FIFO blocking, validates the opened file descriptor, and keeps secure user-managed config-directory symlinks working.
Validation
npm run format:checknpm run lintnpm run typechecknpm test(601 tests)umask 002npm audit --audit-level=moderatenpm pack --dry-runactionlint .github/workflows/ci.yml .github/workflows/release.ymlgit diff main --checkHosted live integration was not rerun after the final filesystem/URL hardening; its retained-version cleanup invocation now passes the required
--yesflag.DCO: the commits are signed off.