Skip to content

feat(security): OpenSSF Best Practices + Scorecard scaffolding (RAN-53)#34

Merged
aksOps merged 2 commits into
mainfrom
ran53-openssf-best-practices
Apr 26, 2026
Merged

feat(security): OpenSSF Best Practices + Scorecard scaffolding (RAN-53)#34
aksOps merged 2 commits into
mainfrom
ran53-openssf-best-practices

Conversation

@aksOps

@aksOps aksOps commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Lands the OpenSSF Best Practices + Scorecard hardening for otelcontext, mirroring the codeiq RAN-46 recipe (PRs #74/#91/#92), language-adapted to Go 1.25 + React 19. Hard gate is the bestpractices.dev passing badge (project 12646); Scorecard is observational with a stretch target of ≥ 8.0/10.

Closes RAN-53.

What lands in this PR

  • .github/workflows/scorecard.ymlossf/scorecard-action SHA-pinned, push to main + Mondays 06:00 UTC + manual; step-security/harden-runner egress audit; SARIF → Security tab + 5d artifact.
  • .github/workflows/security.yml — six-job OSS-CLI stack, all actions SHA-pinned, top-level permissions: read-all:
    • osv-scannergo.mod + ui/package-lock.json (OSV.dev / GHSA, not NVD)
    • trivy — filesystem scan, severity: HIGH,CRITICAL, exit-code: 1, ignore-unfixed: true
    • semgrepp/security-audit + p/owasp-top-ten + p/golang
    • gitleaks — full git history (CLI binary, not the paid action)
    • jscpd — threshold 3%, --min-tokens 100, scoped to internal/ + ui/src/, excludes tests/vendor/build/legacy internal/graph/
    • sbomanchore/sbom-action SPDX + CycloneDX, 90-day artifact
  • .github/dependabot.yml — gomod (root) + npm (ui/) + github-actions, weekly Mon 08:00 UTC, grouped by ecosystem.
  • SECURITY.md — vulnerability reporting policy (GitHub Security Advisories preferred, email fallback ak.nitrr13@gmail.com with [otelcontext security] subject tag, supported versions, in/out scope, hardening references).
  • .bestpractices.jsonproject_id: 12646, level: passing, accurate evidence map across all six categories. No stale Sonar/Dep-Check entries (codeiq's first cut had those — fixed here).
  • scripts/setup-git-signed.sh — repo-local config helper for signed commits; supports ssh / openpgp / x509; honours the contributor's existing global git identity.
  • README.md — replace placeholder "OpenSSF Scan" badge (was pointing at ci.yml) with real Security (OSS-CLI) + OpenSSF Best Practices (project 12646) badges; fix LICENSELICENSE.md link; add Security section.
  • CLAUDE.md — new ## Security & Supply Chain section: tool table with merge-gate semantics, Scorecard baseline + stretch target, branch-protection note, evidence pointers.

Verification

  • go vet ./... — PASS
  • go build . — PASS (binary 45 MB, unchanged)
  • All workflow YAML parses; .bestpractices.json parses; bash -n scripts/setup-git-signed.sh clean.
  • Diff is config-only (no Go code changed).

Out of scope — board-admin auth required

These acceptance items need GitHub repo admin OAuth or bestpractices.dev OAuth and cannot be done from a PR. They are flagged here for board action; this PR satisfies AC items 3–9 by-file:

  1. bestpractices.dev passing badge promotion — registration is in_progress for project 12646. The self-assessment in .bestpractices.json is passing across all six categories; the badge level transition requires a board admin to log into bestpractices.dev with the OSS-Random identity and answer the questionnaire confirming evidence pointers.
  2. Branch protection on main requiring signed commits — needs gh api -X PUT repos/RandomCodeSpace/otelcontext/branches/main/protection ... from a repo admin.
  3. Repo-level Dependabot security updates + secret-scanning push-protection — repo settings, not file changes.

Notes

  • LICENSE.md copyright is 2026 OSS Random (not Amit Kumar as the issue pre-amble references). I deliberately did not rewrite it under this PR — flagging for confirmation. If the maintainer prefers Amit Kumar (RandomCodeSpace), that is a one-line follow-up, not a security gate.
  • Existing ci.yml is left untouched; new workflows complement, do not replace, it.
  • Branched off origin/main (4e0a4a2). Plan document captured at RAN-53 plan.

Test plan

  • After merge, watch first run of Scorecard supply-chain security and Security (OSS-CLI) on main — expect Scorecard to publish a baseline score (target ≥ 8.0/10).
  • Confirm bestpractices.dev project 12646 page reflects the new evidence (post board-admin OAuth pass).
  • Run scripts/setup-git-signed.sh locally — verifies signing chain end-to-end (non-destructive, no refs touched).
  • Spot-check Dependabot opens its first weekly grouped PR per ecosystem.

…RAN-53)

Mirrors the codeiq RAN-46 OSS-CLI security stack, language-adapted to Go 1.25
+ React 19. Hard gate is the bestpractices.dev passing badge (project 12646);
Scorecard is observational with a stretch target of >= 8.0/10.

- .github/workflows/scorecard.yml — ossf/scorecard-action SHA-pinned, push +
  weekly Mon 06:00 UTC + manual; harden-runner egress audit; SARIF to Security
  tab + 5d artifact.
- .github/workflows/security.yml — six-job OSS-CLI stack (osv-scanner on
  go.mod + ui/package-lock.json, trivy fs HIGH/CRITICAL, semgrep
  security-audit + owasp-top-ten + golang, gitleaks full history, jscpd
  threshold 3% scoped to internal/ + ui/src/, anchore SBOM SPDX + CycloneDX
  90d). All actions SHA-pinned; top-level permissions: read-all.
- .github/dependabot.yml — gomod (root) + npm (ui/) + github-actions, weekly
  grouped, security updates always-on.
- SECURITY.md — vulnerability reporting policy (GitHub Advisories preferred,
  email fallback, supported versions, scope, hardening references).
- .bestpractices.json — project_id 12646, level passing, accurate evidence
  map across the six categories.
- scripts/setup-git-signed.sh — repo-local config helper for signed commits
  (ssh / openpgp / x509); honours contributor's existing global git identity.
- README.md — replace placeholder OpenSSF Scan badge with real Security
  (OSS-CLI) + Best Practices (12646) badges; fix LICENSE.md link; add
  Security section.
- CLAUDE.md — new "Security & Supply Chain" section: tool table, Scorecard
  baseline + stretch target, branch protection note, evidence pointers.

Verified: go vet ./... PASS, go build ./... PASS (config-only diff).

Out of scope (board-admin auth required, escalated in PR description):
  - bestpractices.dev passing badge promotion (manual OAuth at
    bestpractices.dev with OSS-Random identity)
  - Branch protection on main requiring signed commits
  - Repo-level Dependabot security updates + secret-scanning push-protection

Co-Authored-By: Paperclip <noreply@paperclip.ing>

# Restrict the default GITHUB_TOKEN to read-only; the steps below request the
# narrow scopes they actually need.
permissions: read-all
schedule:
- cron: '21 4 * * 1' # Mondays 04:21 UTC — catch newly-disclosed CVEs

permissions: read-all
… (RAN-56)

Three required gates were red on PR #34, blocking RAN-53:

OSV-Scanner — 28 known vulns across 8 packages (3 High, 5 Med, 1 Low,
19 Unknown), all fixable. Patched in this commit:

  - github.com/jackc/pgx/v5         5.7.2 → 5.9.2  (GHSA-j88v-2chj-qfwx,
                                                   CVE-2026-33816 Critical
                                                   per Trivy: memory-safety)
  - go.opentelemetry.io/otel/sdk    1.42.0 → 1.43.0 (GHSA-hfvc-g4fc-pqhx,
                                                   CVE-2026-39883 High:
                                                   BSD kenv PATH hijack)
  - go directive                    1.25.0 → 1.25.9 (covers all 19 stdlib
                                                   GO-2025-* / GO-2026-*
                                                   advisories; CI's
                                                   setup-go reads
                                                   go-version-file: go.mod)
  - otel cohort (otel, otel/metric, otel/sdk/metric, otel/trace) bumped
    to 1.43.0 alongside otel/sdk to keep the cohort version-aligned.

Trivy filesystem (HIGH,CRITICAL, ignore-unfixed: true) — 2 findings, both
subsumed by the OSV fixes above.

ui/package-lock.json — npm update on the four flagged dev-only transitives
(within existing caret ranges in package.json):

  - vite             6.4.1 → 6.4.2  (GHSA-p9ff-h696-f583 8.2 High,
                                     GHSA-4w7w-66w2-5vf9 6.3 Med)
  - picomatch        4.0.3 → 4.0.4  (GHSA-c2c7-rcm5-vvqj 7.5,
                                     GHSA-3v7f-55p6-f55p 5.3)
  - brace-expansion  1.1.12 → 1.1.14, 5.0.4 → 5.0.5
                                    (GHSA-f886-m6hf-6m8v 6.5)
  - postcss          8.5.8 → 8.5.10 (GHSA-qx2v-qp2m-jg93 6.1)

Verification (local, with the same osv-scanner v2.3.5 + trivy that CI runs):
  - osv-scanner --lockfile=go.mod --lockfile=ui/package-lock.json:
      "No issues found"
  - trivy fs . --severity HIGH,CRITICAL --exit-code 1 --ignore-unfixed:
      go.mod 0, ui/package-lock.json 0; exit 0
  - go test -race -timeout 180s ./... and loadsim build: green
  - go vet ./...: clean

Out of scope for this commit: the failing SonarCloud check on PR #34 is an
external GitHub App that CLAUDE.md explicitly excludes from the security
stack. Removal of the SonarCloud app at the repo level requires board-admin
action and is being handed off to CEO in the RAN-56 comment thread.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@aksOps aksOps merged commit 1439ce1 into main Apr 26, 2026
16 of 17 checks passed
@aksOps aksOps deleted the ran53-openssf-best-practices branch April 26, 2026 02:50
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.

2 participants