Skip to content

feat(enrichment): flag managed-database connection strings in secret-scan - #3486

Closed
luciferlive112116 wants to merge 1 commit into
JSONbored:mainfrom
luciferlive112116:feat/enrichment-secret-scan-db-connection-uris
Closed

feat(enrichment): flag managed-database connection strings in secret-scan#3486
luciferlive112116 wants to merge 1 commit into
JSONbored:mainfrom
luciferlive112116:feat/enrichment-secret-scan-db-connection-uris

Conversation

@luciferlive112116

Copy link
Copy Markdown
Contributor

Summary

Extends the secret-scan analyzer with 6 new high-confidence rules for managed-database connection strings
that embed credentials. These follow the existing cloudinary_url rule (scheme://<id>:<secret>@<host>): a
committed connection string with an embedded password is a high-severity credential leak.

kind matches provider
mongodb_atlas_uri mongodb+srv://<user>:<pass>@…mongodb.net MongoDB Atlas
neon_postgres_uri postgres://<user>:<pass>@…neon.tech Neon
supabase_postgres_uri postgres://<user>:<pass>@…supabase.co Supabase
upstash_redis_uri rediss://default:<pass>@…upstash.io Upstash
planetscale_mysql_uri mysql://<user>:<pass>@…psdb.cloud PlanetScale
cockroachdb_uri postgres://<user>:<pass>@…cockroachlabs.cloud CockroachDB Cloud

Why these are false-positive-safe. Each rule requires all three of:

  1. a non-empty user:password pair — the charset excludes < and >, so an angle-bracket docs placeholder
    (<user>:<password>, MongoDB's own documented format) does not match;
  2. a distinctive managed-provider host (mongodb.net, neon.tech, supabase.co, upstash.io, psdb.cloud,
    cockroachlabs.cloud) — so an ordinary self-hosted/local URI (postgres://user:pass@localhost) is never
    flagged;
  3. a host-boundary terminator (?![a-z0-9.-]) — so a look-alike suffix host (…mongodb.net.evil.com) can't
    match via the provider-host prefix.

All three conditions are asserted in the negative test (angle-bracket placeholders, localhost/127.0.0.1
hosts, and a suffix-host look-alike all produce zero findings), and a positive test asserts each provider's real
connection-string shape produces exactly one finding of its own kind. This mirrors the merged cloudinary_url
rule, which already treats a credential-embedding URL as a high-confidence secret.

All 6 are new kinds (verified against the analyzer's current rule kinds — no duplicate) and inserted before
the generic-assignment rule so the specific kind wins. SecretFinding.kind is a free-form string, so there is
no types.ts/render.ts/analyzer-metadata.json change — a two-file, rules-only diff.

No linked issue: additive detection-coverage extending an existing analyzer along its own established lines; each
rule is a self-evident, industry-standard credential shape with no public API/schema/deploy surface change — fits
the repo's preferred (not required) linked-issue policy.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • 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.
  • I linked an issue, or this is small enough that the summary explains why an issue is not needed.

Validation

  • git diff --check
  • npm run typecheck
  • npm run rees:test — the review-enrichment build + analyzer suite (see note below)
  • npm run test:coverage (N/A — this analyzer is in review-enrichment/, outside the root src/** Codecov scope)
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • Ran locally: git diff --check (clean), the review-enrichment TypeScript build (exit 0), and the secret-scan
    suite via node --test106/106 pass, including a table test asserting each of the 6 new connection-string
    formats produces exactly one finding of its own kind at high confidence, and a negative test asserting
    angle-bracket placeholders, local/self-hosted hosts, and a suffix-host look-alike produce none.
  • Not run locally: the UI, root typecheck, and the metadata:check step of rees:test. This change adds only
    RULES entries (no analyzer descriptor field), so the committed analyzer-metadata.json / UI mirror are
    unchanged (a local regeneration produces a zero-content diff) and metadata:check passes on CI (Linux). On
    this Windows dev box metadata:check reports a spurious line-ending difference; it fails identically on
    unmodified main. analyzer-metadata.json was NOT modified.

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.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

Notes

  • Detection-only additions: 6 new stateless RULES following the existing specific→generic pattern; no existing
    rule or the analyzer descriptor changed, so current findings and analyzer-metadata.json are unaffected. Each
    new kind reports only file:line + the public-safe kind, never the matched value.
  • Test fixtures are assembled from fragments at run time (never a contiguous secret-shaped literal in source),
    so GitHub push protection does not flag this fixture file.

…scan

Add six high-confidence RULES for managed-database connection strings that
embed credentials, following the existing cloudinary_url rule
(scheme://<id>:<secret>@<host>) — a committed connection string with an
embedded password is a high-severity credential leak.

- mongodb_atlas_uri: mongodb+srv://<user>:<pass>@...mongodb.net
- neon_postgres_uri: postgres://<user>:<pass>@...neon.tech
- supabase_postgres_uri: postgres://<user>:<pass>@...supabase.co
- upstash_redis_uri: rediss://default:<pass>@...upstash.io
- planetscale_mysql_uri: mysql://<user>:<pass>@...psdb.cloud
- cockroachdb_uri: postgres://<user>:<pass>@...cockroachlabs.cloud

Each rule requires a non-empty user:password pair (charset excludes < and >,
so an angle-bracket docs placeholder does not match), a distinctive
managed-provider host (so a local/self-hosted URI is never flagged), and a
host-boundary terminator (so a look-alike suffix host cannot match). The
negative test asserts placeholders, localhost/127.0.0.1 hosts, and a suffix-host
look-alike all produce zero findings. All kinds are new and inserted before the
generic-assignment rule. SecretFinding.kind is a plain string, so there is no
types/render/metadata change.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 5, 2026
@loopover-orb

loopover-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 Gittensory review result - reject/close recommended

Review updated: 2026-07-05 09:39:11 UTC

2 files · 1 AI reviewer · 3 blockers · readiness 80/100 · CI green · clean

🛑 Suggested Action - Reject/Close

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.
  • AI reviewers agree on a likely critical defect: PR description: this PR does not close or clearly link an eligible open issue
  • please add the maintainer-authorized issue link or explain why this is exempt from the repo's issue-scope requirement. — Resolve the flagged defect, or override if the AI reviewers are mistaken, then re-run the gate.

Review summary
This adds narrowly scoped high-confidence secret-scan rules for managed database URLs and covers both positive provider examples and key near-misses. The regexes are consistent with the existing URL-secret pattern and the host-boundary lookahead addresses the most important suffix-host false positive. I would not mark this merge-ready because the PR description does not close or clearly link an eligible open issue, which is a repo-level requirement for contributor PRs.

Blockers

  • PR description: this PR does not close or clearly link an eligible open issue; please add the maintainer-authorized issue link or explain why this is exempt from the repo's issue-scope requirement.
Nits — 4 non-blocking
  • nit: review-enrichment/src/analyzers/secret-scan.ts:981 says the Upstash user segment may be empty, but the summary claims every rule requires a non-empty user:password pair; either require `default`/non-empty here or update the rationale so the rule contract is not contradictory.
  • nit: review-enrichment/test/secret-scan.test.ts:1647 only checks one suffix-host near-miss for MongoDB; add at least one Postgres-family suffix case so the repeated host-boundary pattern is exercised outside the first rule.
  • review-enrichment/src/analyzers/secret-scan.ts:981: change the Upstash pattern to require the documented `default` user if you want the rule to match the PR's stated contract, e.g. `re: /\brediss?:\/\/default:[^\s@​/<>]+@​[a-z0-9.-]+\.upstash\.io(?![a-z0-9.-])/i`.
  • review-enrichment/test/secret-scan.test.ts:1647: add a Neon/Supabase suffix-host near-miss such as `postgres:​//dbuser:${p}@​ep-x.neon.tech.evil.com/db` to prove the shared boundary behavior.

Why this is blocked

  • PR description: this PR does not close or clearly link an eligible open issue; please add the maintainer-authorized issue link or explain why this is exempt from the repo's issue-scope requirement.
  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.
Signal Result Evidence
Code review ❌ 3 blockers 1 reviewer
Linked issue ✅ No-issue rationale PR body explains why no issue is linked.
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 (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: 158 registered-repo PR(s), 83 merged, 21 issue(s).
Contributor context ✅ Confirmed Gittensor contributor luciferlive112116; Gittensor profile; 158 PR(s), 21 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Review context
  • Author: luciferlive112116
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: JavaScript, MDX, Python, Rust, TypeScript
  • Official Gittensor activity: 158 PR(s), 21 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Await review-lane availability.
  • 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

@loopover-orb

loopover-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Gittensory is closing this pull request on the maintainer's behalf (No linked issue detected; Maintainer requires a linked issue; AI reviewers agree on a likely critical defect: PR description: this PR does not close or clearly link an eligible open issue; please add the maintainer-authorized issue link or explain why this is exempt from the repo's issue-scope requirement.). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

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

None yet

Development

Successfully merging this pull request may close these issues.

1 participant