Skip to content

fix(diagnostics): validate Stellar CLI SemVer output strictly - #298

Merged
dDevAhmed merged 11 commits into
mainfrom
maintainer/stellar-version-semver-hardening-2026-11-13
Nov 14, 2026
Merged

dDevAhmed merged 11 commits into
mainfrom
maintainer/stellar-version-semver-hardening-2026-11-13

Conversation

@dDevAhmed

@dDevAhmed dDevAhmed commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Tighten Stellar CLI version parsing to require valid SemVer 2.0.0 core and suffix identifier syntax while retaining the existing optional v prefix.
  • Reject malformed versions with leading zeroes in core components, empty suffix identifiers, malformed dotted metadata, and numeric prerelease identifiers with leading zeroes.
  • Add focused regression coverage for valid and invalid SemVer outputs.
  • Reconcile the remaining useful coverage from contributor PR test(diagnostics): expand stellar cli version diagnostic fixtures (#100) #228 without copying its broad fixture library: add explicit unsupported-floor cases, structured/proxy-error output, non-zero exit codes (including valid stdout on failure), and ENOENT/EACCES secret-redaction cases.

Scope and safety

Verification

  • Changes are committed on maintainer/stellar-version-semver-hardening-2026-11-13.
  • GitHub Actions is running the repository quality, platform, CodeQL, scope/ownership, and smoke checks. No passing result is claimed until those checks complete.

Summary by CodeRabbit

  • Bug Fixes
    • Stellar CLI version checks now accept valid semantic versions, including prerelease and build metadata, and reject malformed versions.
    • Diagnostic output avoids exposing sensitive error and stderr details.
  • Tests
    • Added coverage for unsupported versions, invalid or unexpected output, and command execution failures.

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Stellar version parser now enforces semantic-version syntax and returns the normalized core version. New tests cover valid and malformed versions, unsupported versions, command failures, unrecognized output, and sensitive-text exclusion.

Changes: Stellar diagnostics

Layer / File(s) Summary
Version parsing and diagnostic coverage
src/diagnostics/stellar.ts, tests/stellar-diagnostic-semver.test.ts, tests/stellar-diagnostic-failure-matrix.test.ts
The parser rejects leading zeros in core components and accepts valid prerelease and build metadata. Tests cover normalized versions, malformed output, versions below the supported floor, command failures, and omission of sensitive text from serialized diagnostics.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · up to 22e09

The change makes Stellar CLI version detection stricter, so malformed version output is now reported as unrecognized. Valid versions keep reporting the normalized core version, and new tests cover the main failure cases. No merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change: stricter SemVer validation of Stellar CLI version output in diagnostics. The raw summary confirms parseStellarVersion now enforces semantic-version syntax, rejecting lead…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: stricter SemVer validation of Stellar CLI version output in diagnostics. The raw summary confirms parseStellarVersion now enforces semantic-version syntax, rejecting leading zeros in core components, and the added tests cover valid and malformed versions. The title is specific and matches the main change, so it passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: afa2207b-0e15-4a4f-a762-4a3620a82024
Commits

Reviewing files that changed from the base of the PR and between dde43ac and 22e09bb.

Files selected for processing: 3

  • src/diagnostics/stellar.ts
  • tests/stellar-diagnostic-failure-matrix.test.ts
  • tests/stellar-diagnostic-semver.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@dDevAhmed
dDevAhmed marked this pull request as ready for review November 13, 2026 19:48

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@dDevAhmed
dDevAhmed merged commit 8633e2e into main Nov 14, 2026
12 checks passed
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.

1 participant