Skip to content

fix: reserve -p for --password and refuse a password typed on the command line - #277

Merged
Harshi-Shah-CS merged 2 commits into
v2-devfrom
CL-7174
Nov 2, 2026
Merged

Harshi-Shah-CS merged 2 commits into
v2-devfrom
CL-7174

Conversation

@Harshi-Shah-CS

Copy link
Copy Markdown
Contributor

Ticket: CL-7174

What

  • launch:functions:serve --port no longer has a short flag. In V2, -p means --password on launch:env:update and nothing else. A V1-style launch:functions:serve -p 4000 now stops with Nonexistent flag: -p and exit 2. The PORT environment variable still wins over --port, as in V1.

  • launch:env:update no longer echoes a password typed on the command line. --password takes no value: the password comes from the hidden prompt or, without a terminal, from standard input. Typing one after it used to reach oclif, which printed it back:

    • -p <value>, --password <value> and --password=<value> printed Unexpected argument: <value>.
    • -p<value> printed Nonexistent flag: -<value>.

    That put the password in the terminal or CI log. LaunchCommand now refuses all four forms before parsing, with exit 2 and a fixed message that never repeats the value: --password takes no value. Enter the password at the hidden prompt, or pipe it on standard input.

  • -p on its own, last, or before another flag still reads the password as before, so printf '%s' "$PASSWORD" | csdx launch:env:update … -u <user> -p is unchanged. The check only runs on commands that declare --password. Every other command leaves -p to oclif.

Tests

  • src/core/password-argv.test.ts: the four refused forms, with a random value, and three accepted placements of -p/--password.
  • src/core/launch-command.test.ts: a command without --password leaves -p <value> to the parser.
  • test/integration/environments-update.test.ts: -p <random value> exits 2 with the fixed message, the value appears in neither stdout nor stderr, and no request is sent.
  • test/integration/functions-serve-port.test.ts: -p 4000 is a nonexistent flag with exit 2. serve.test.ts asserts --port has no short flag.
  • Full suite: 3,817 tests pass. Lint and tsc are clean. The Talisman and trufflehog scans against v2-dev are clean, and the .talismanrc checksums are in the commits that changed each file.
  • Harness: the workspace scripts/launch-cli-manual-tests cases 75 and 90 cover both changes (separate workspace PR). Case 90 passes 15/15 against this branch.

Known edge, deliberately left: a value that oclif would reject anyway, such as --name -preview, now gets the --password message instead of oclif's "Flag --name expects a value". It's still exit 2.

#claude_code#
🤖 Generated with Claude Code

Harshi-Shah-CS and others added 2 commits November 2, 2026 12:26
…port

V2 keeps -p for --password on launch:env:update only, so the port is now set
with --port alone. A V1-style `launch:functions:serve -p 4000` stops with
"Nonexistent flag: -p" and exit 2. The PORT environment variable still wins
over --port, as before. The examples and the README usage block now show
--port.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
--password on launch:env:update takes no value: the password comes from the
hidden prompt or, without a terminal, from standard input. A value typed
after it (-p <value>, --password <value>, --password=<value> or -p<value>)
used to reach oclif, which printed it back as "Unexpected argument: <value>"
or "Nonexistent flag: -<value>", putting the password in the terminal or CI
log. LaunchCommand now refuses those forms before parsing, on commands that
declare --password, with exit 2 and a message that never repeats the value.
-p on its own, last, or before another flag still reads the password as
before. Commands without --password leave -p to the flag parser.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Harshi-Shah-CS
Harshi-Shah-CS requested review from a team as code owners November 2, 2026 07:07
@snyk-io

snyk-io Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 6 9 25 ✅ Passed
🟡 Medium Severity 5 7 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 9
  • Medium without fixes: 7
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

@Harshi-Shah-CS Harshi-Shah-CS changed the title fix: reserve -p for --password and refuse a password typed on the command line (+Claude) fix: reserve -p for --password and refuse a password typed on the command line Nov 2, 2026
@Harshi-Shah-CS
Harshi-Shah-CS merged commit efc2cb4 into v2-dev Nov 2, 2026
7 checks passed
@Harshi-Shah-CS
Harshi-Shah-CS deleted the CL-7174 branch November 2, 2026 07:22
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.

3 participants