Skip to content

fix(enrichment): accept full Go module path punctuation in dependency scan#2121

Merged
JSONbored merged 2 commits into
JSONbored:mainfrom
real-venus:fix/dependency-scan-go-module-path-chars
Jul 1, 2026
Merged

fix(enrichment): accept full Go module path punctuation in dependency scan#2121
JSONbored merged 2 commits into
JSONbored:mainfrom
real-venus:fix/dependency-scan-go-module-path-chars

Conversation

@real-venus

Copy link
Copy Markdown
Contributor

Summary

The go.mod line parser in the REES dependency scanner used a lowercase-only path character class:

const GO_RE = /^([a-z0-9.\/-]+)\s+v([0-9][^\s]*)/;

This was narrower than Go's actual module-path grammar in two ways. Go's golang.org/x/mod/module.modPathOK permits ASCII letters (case-sensitive), digits, and the punctuation set - . _ ~ (plus / as separator) — but the class accepted only . and -, rejecting uppercase segments and the _/~ punctuation.

Go module paths legitimately contain all of these — github.com/BurntSushi/toml, github.com/Masterminds/semver, github.com/foo_bar/baz, golang.org/x/~exp, or any capitalized GitHub owner. A non-matching line is silently dropped from extractDependencyChanges, so the dependency never reaches any dependency-fed analyzer — the OSV.dev CVE scan, license, provenance, and native-build checks. The result is a real review blind spot: a vulnerable dependency with such a path added in a PR would never be flagged.

This widens the class to [A-Za-z0-9._~\/-], matching modPathOK exactly:

const GO_RE = /^([A-Za-z0-9._~\/-]+)\s+v([0-9][^\s]*)/;

The change is strictly more permissive, so existing lowercase paths are unaffected, and the case-sensitive name is preserved verbatim for the OSV lookup.

A regression test asserts uppercase, underscore, and tilde Go module paths are now parsed.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • No linked issue — a small, self-evident parser fix; the rationale is in the Summary.

Validation

  • git diff --check
  • npm --prefix review-enrichment test (build → validate sourcemaps → analyzer-metadata check → full REES suite) — green; the new uppercase/_/~ regression test passes.
  • Rebased on the latest main — no conflict (coexists with the merged PyPI-extras PYPI_RE change; both regex fixes and both tests retained).
  • Root npm run test:ci jobs — not exercised by this change; it is confined to review-enrichment/**, which is outside the root src/** Codecov patch scope. Verified by CI.

If any required check was skipped, explain why:

  • The change is entirely within review-enrichment/src/analyzers/dependency-scan.ts and its test; the relevant local gate is the REES suite (rees:test), which is green. The root src/** coverage jobs do not cover this package.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • No auth/cookie/CORS/GitHub App/Cloudflare/session changes.
  • No API/OpenAPI/MCP behavior change.
  • No UI changes.
  • No docs/changelog changes.

… scan

The go.mod line parser used a lowercase-only path class
(`/^([a-z0-9.\/-]+)\s+v.../`) that was narrower than Go's actual module-path
grammar in two ways: it rejected uppercase segments and the `_`/`~`
punctuation that `golang.org/x/mod/module.modPathOK` permits (the full ASCII
set is `- . _ ~` plus letters and digits).

Go module paths are case-sensitive and legitimately contain these characters
(github.com/BurntSushi/toml, github.com/Masterminds/semver,
github.com/foo_bar/baz, golang.org/x/~exp). A non-matching line is silently
dropped from extractDependencyChanges, so the dependency never reaches any
dependency-fed analyzer — the OSV.dev CVE scan, license, provenance, and
native-build checks. The result is a real review blind spot: a vulnerable
dependency with such a path added in a PR would never be flagged.

Widen the class to `[A-Za-z0-9._~\/-]`, matching modPathOK exactly. The change
is strictly more permissive, so existing lowercase paths are unaffected, and
the case-sensitive name is preserved verbatim for the OSV lookup. A regression
test asserts uppercase, underscore, and tilde paths are now parsed.
@loopover-orb

loopover-orb Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-01 19:22:43 UTC

2 files · 1 AI reviewer · no blockers · readiness 66/100 · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
The change correctly widens the Go dependency parser to preserve uppercase module path segments and the `_`/`~` punctuation that the previous regex silently skipped. The parser remains a line-based heuristic consistent with the surrounding dependency extraction code, and the regression test exercises all newly admitted character categories through the real `extractDependencyChanges` path. No reachable breakage is visible in the changed code.

Nits — 3 non-blocking
  • nit: `review-enrichment/src/analyzers/dependency-scan.ts:51` says the class matches `modPathOK` exactly, but this regex only matches the allowed character set and still does not enforce the rest of Go's module-path validation rules.
  • In `review-enrichment/src/analyzers/dependency-scan.ts:51`, soften the comment from “matching modPathOK exactly” to “covering the modPathOK character set” so the implementation and comment stay aligned.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (size label size:XS; no linked issue context).
Validation posture ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 34 registered-repo PR(s), 12 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor real-venus; Gittensor profile; 34 PR(s), 0 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: real-venus
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 34 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Explain no-issue PR.
  • Await review-lane availability.
  • Triage stale or unlinked PRs.
  • Refresh registry data or choose a registered active repo.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@dosubot dosubot Bot added the lgtm label Jul 1, 2026
@JSONbored
JSONbored merged commit ef8ae7c into JSONbored:main Jul 1, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jul 1, 2026
@real-venus
real-venus deleted the fix/dependency-scan-go-module-path-chars branch July 7, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants