Skip to content

chore(ci): secret scanning + vulnerable-package check + coverage (Tier 1)#96

Merged
phuongnse merged 7 commits into
mainfrom
chore/tier1-security-coverage
May 24, 2026
Merged

chore(ci): secret scanning + vulnerable-package check + coverage (Tier 1)#96
phuongnse merged 7 commits into
mainfrom
chore/tier1-security-coverage

Conversation

@phuongnse

@phuongnse phuongnse commented May 24, 2026

Copy link
Copy Markdown
Owner

Summary

Tier 1 security + coverage additions to PR CI. All three run automatically without GHAS provisioning.

  • Gitleaks (new secret-scan job) — scans full diff for committed secrets. Free for personal accounts on private repos; license note added for future org move.
  • Vulnerable packages (step in existing dotnet job) — dotnet list package --vulnerable --include-transitive fails CI on any known CVE, catching the contributor-adds-bad-package-at-PR-time case that Dependabot only catches post-merge.
  • Coverage collection — appends --collect:"XPlat Code Coverage" to dotnet test and uploads cobertura as artifact (dotnet-coverage). No threshold enforced yet — see CONTRIBUTING.md § Coverage for why (need measured baseline first).

Linked spec

No feature — Tier 1 follow-up to PR #95 (architecture conventions). References:

Requirements & rules followed

  • Spec → code — no AC. Process additions.
  • Gate 0 — N/A.
  • Gate 1 — workflow YAML lint clean (no local action; CI will validate). Drift script green.
  • Gate 2 — Docs updated in same PR: CONTRIBUTING.md, agent-checklist.md.
  • Gate 3 — no new durable rule.
  • Workarounds — none.
  • No new TODO / FIXME / NotImplementedException / placeholder / stub under src/, tests/, frontend/src/

What's next

Summary by CodeRabbit

  • Chores

    • Enabled automated .NET code coverage collection and upload as a CI artifact.
    • Added PR secret scanning that blocks commits with detected secrets.
    • Added automated vulnerability detection for dependencies that can fail CI on findings.
    • Added an explicit package pin to mitigate a reported high-severity dependency issue.
  • Documentation

    • Updated contribution guide with coverage collection details and guidance for future thresholds.
    • Updated CI gate playbook to reflect the new automated security and quality checks.

Review Change Stack

Tier 1 security + coverage additions. All three run on every PR with no
GHAS dependency.

  - .NET job: appends `--collect:"XPlat Code Coverage"` and uploads the
    cobertura report as `dotnet-coverage` artifact. NO threshold enforced
    yet — see CONTRIBUTING.md § Coverage for why (need measured baseline
    before locking a floor).

  - .NET job: `dotnet list package --vulnerable --include-transitive`
    step that fails CI on any known CVE in the dependency graph,
    including transitives. Dependabot covers ongoing advisory tracking;
    this catches the case where a contributor adds a package with a
    known vulnerability at PR time.

  - New secret-scan job: Gitleaks scans the full diff for committed
    secrets (API keys, passwords, tokens). Free for personal accounts on
    private repos (phuong-labs is currently a personal namespace); a
    comment notes the GITLEAKS_LICENSE requirement if the org moves to
    paid plan.

CONTRIBUTING.md gets a new "Coverage" section explaining the
defer-threshold rationale. agent-checklist.md's CI-only gates list grows
to cover the three new automated gates.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d0354d83-e325-4d36-a5df-e3d45b584a37

📥 Commits

Reviewing files that changed from the base of the PR and between 0192990 and 8c830c9.

📒 Files selected for processing (2)
  • Directory.Packages.props
  • src/Shared/Axis.Shared.Infrastructure/Axis.Shared.Infrastructure.csproj

📝 Walkthrough

Walkthrough

Adds CI gates: enable XPlat coverage collection and upload Cobertura XML; run NuGet vulnerable-package detection to fail on advisories; add a TruffleHog secret-scan job for PRs; add a central System.Formats.Asn1 pin; and update CONTRIBUTING.md and agent checklist to document these gates.

Changes

CI Quality and Security Gates

Layer / File(s) Summary
Code coverage collection and artifact upload
.github/workflows/build-and-test.yml
dotnet test adds --collect:"XPlat Code Coverage"; coverage.cobertura.xml files from TestResults/**/ are uploaded as a dotnet-coverage artifact always; a step runs dotnet list package --vulnerable --include-transitive and fails the job when advisories appear.
Secret scanning job with TruffleHog
.github/workflows/build-and-test.yml
New secret-scan job checks out with full history (fetch-depth: 0) and runs trufflesecurity/trufflehog across the PR base..head commit range with --only-verified, failing on findings.
Documentation updates for new CI gates
CONTRIBUTING.md, docs/playbooks/agent-checklist.md
Adds a “Coverage” subsection to CONTRIBUTING.md describing coverlet collection and artifact upload (no threshold enforced yet); expands agent-checklist CI-only gates to include secret scanning, vulnerable-package detection, coverage artifact upload, and expanded doc-drift rules.
Central security package pin
Directory.Packages.props, src/Shared/Axis.Shared.Infrastructure/Axis.Shared.Infrastructure.csproj
Adds an ItemGroup pinning System.Formats.Asn1 to 8.0.1 and an explicit PackageReference in Axis.Shared.Infrastructure with CVE commentary to force the patched version across project references.

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant DotnetTest
  participant ArtifactUpload
  participant NuGetScanner
  participant TruffleHog
  GitHubActions->>DotnetTest: run `dotnet test --collect:"XPlat Code Coverage"`
  DotnetTest->>ArtifactUpload: emit `coverage.cobertura.xml` in TestResults/**
  GitHubActions->>ArtifactUpload: upload `dotnet-coverage` artifact
  GitHubActions->>NuGetScanner: run `dotnet list package --vulnerable --include-transitive`
  NuGetScanner->>GitHubActions: advisory rows -> fail job if any
  GitHubActions->>TruffleHog: run trufflesecurity/trufflehog on base..head (--only-verified)
  TruffleHog->>GitHubActions: findings -> fail job
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • phuong-labs/axis#95: Related enforcement of the GetAwaiter().GetResult() ban in CI checks and scripts.
  • phuong-labs/axis#48: Earlier updates to agent checklist and CI gate definitions that this PR extends.

Poem

🐰 I hopped through CI with a gentle tap,

TruffleHog sniffed every branch and gap,
Coverlet splashed Cobertura light,
Artifacts boxed and sent at night,
A rabbit cheers — secure and apt.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main changes: adding three Tier 1 CI checks (secret scanning, vulnerable-package detection, and coverage collection) with supporting documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/tier1-security-coverage

Comment @coderabbitai help to get the list of available commands and usage tips.

phuongnse and others added 5 commits May 24, 2026 12:36
PR #96 CI run failed with: "missing gitleaks license. Go grab one at
gitleaks.io and store it as a GitHub Secret named GITLEAKS_LICENSE".

gitleaks-action v2 added a paid license requirement for all account
types (the comment I left claiming "free for personal accounts" was
based on stale information — the action's breaking update happened
after that doc page snapshot). Confirmed by the action's own error
output pointing at the announcement page.

Switch to TruffleHog: also widely used for secret scanning, MIT-licensed,
no paid plan required for any account type. `--only-verified` queries
the alleged service for token validity before reporting, cutting the
classic high-false-positive rate that makes secret scanners noisy.

Updated agent-checklist.md to match.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Previous commit used a hallucinated SHA that didn't exist in the
trufflesecurity/trufflehog repo. Pin to the actual v3.95.3 commit.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Job name was 'Secret scanning (TruffleHog)' — the tool name in the
required-check string means a future tool swap breaks branch protection
rules silently (the rule keeps requiring the old name, which no longer
exists, but appears 'satisfied' because the missing check looks skipped).

Rename to 'Secret scanning'; move tool reference into a comment and the
step name. Same pattern as our '.NET — Build and Test' (tool-agnostic,
not '.NET — dotnet test').

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@phuongnse phuongnse changed the title chore(ci): Gitleaks + vulnerable-package check + coverage (Tier 1) chore(ci): secret scanning + vulnerable-package check + coverage (Tier 1) May 24, 2026
The vulnerable-packages CI check added earlier in this PR did its job:
flagged High-severity GHSA-447r-wph3-92pm in System.Formats.Asn1 7.0.0
across every project that transitively pulls OpenIddict or the ASP.NET
cryptography stack. This commit fixes the underlying CVE — not the check.

  - Directory.Packages.props: add <PackageVersion> entry for 8.0.1 so
    the version is centrally tracked alongside the other deps.

  - Axis.Shared.Infrastructure.csproj: add explicit <PackageReference>
    Include="System.Formats.Asn1"/>. The patched version propagates to
    every consumer through the project-reference chain.

Why explicit reference rather than CentralPackageTransitivePinningEnabled:
that property pins ALL transitives globally, which caused PageBuilder
(scaffold project with no real source) to resolve unrelated packages
back to .NET Framework 1.x versions. The targeted explicit reference
gets the CVE patched without touching unrelated resolution graphs.

Comment text in Directory.Packages.props uses prose rather than literal
CLI flags because XML comments forbid the two-hyphen sequence (it would
terminate the comment early). MSBuild's parser silently broke when an
earlier draft of this comment contained that sequence — surfaced as
NU1015 errors with seemingly unrelated package references.

Verified: `dotnet list package --vulnerable --include-transitive` now
reports "no vulnerable packages" across all 47 projects.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@phuongnse phuongnse merged commit 31f51c6 into main May 24, 2026
7 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