microsoft / microsoft/WinAppVSCE

cert generate: guard against older CLIs that lack --if-exists / --json

Open
#248 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
13
Forks
3
Avg merge
6d 1h
Merged PRs (30d)
11

Description

Raised by a PR review of the winapp.certGenerate modernization.

Problem

buildCertGenerateArgs (src/cert-utils.ts) now unconditionally emits two options:

args.push('--if-exists', options.ifExists ?? 'error');
args.push('--json');

Both require a reasonably recent CLI. There is no minimum-version guard and no capability probe, so against an older CLI the command fails at argument parsing with an opaque error rather than a message the user can act on.

This is reachable in practice because the CLI is not always the bundled one:

  • scripts/download-cli.ps1 defaults to latest, but release builds can pass an older CliReleaseTag.
  • getWinappCliPath can fall back to a winapp found on PATH, which is entirely outside our control.

Note this is newly-introduced risk rather than a regression: the previous implementation passed no options at all, so it worked against any CLI.

Suggested fix

Pick whichever is cheapest to maintain:

  1. Document and enforce a minimum CLI version for the extension, checked once at activation.
  2. Probe capability (e.g. parse cert generate --help) and degrade gracefully — fall back to the old no-options invocation when the flags are unavailable.
  3. At minimum, detect the argument-parsing failure and translate it into "your winapp CLI is too old for this command; expected >= X.Y.Z, found ".

Option 3 alone would remove the opaque-failure problem for very little code.

Related

  • #242 (custom passwords)
  • #243 (--output / --valid-days / --export-cer)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/cert-utils.ts at buildCertGenerateArgs, then trace how the CLI path is selected through getWinappCliPath and scripts/download-cli.ps1. Decide whether to enforce a minimum version, probe capabilities, or translate argument failures, and verify that an older external or downloaded winapp CLI produces an actionable result instead of an opaque parsing error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.