Jump to content

OpenCredentials/SPEC

From MindAttic Docs

OpenCredentials — Product specification

The complete product, written down before it is built (owner, 2026-11-30, MAT-T360). Every epic, feature and story the finished product will have is listed here, built or not. The ticket tree mirrors this file one to one: every ID below is a ticket. Nothing gets built unless it is here, and anything taken out of here is closed wont-do in the tree. RELEASE.md says which part of this the current milestone delivers.

1. Product definition

Place in the ecosystem: A product (App) in docs/ECOSYSTEM.md §2.2: a public-service credential-leak scanner. OpenCredentials is a local, public-service credential-leak pipeline for the owner. The opencreds CLI scans public GitHub Code Search for exposed credentials, keeps only a SHA-256 fingerprint and the provider's public prefix, optionally discloses each leak to the leaker (a private vulnerability report first, a courtesy issue as the fallback) once a human has switched that category on, and rechecks findings to measure remediation. A Blazor Server review UI shares the same local SQL Server database. The finished product is a verified local scanner: running on local SQL from R:\MindAttic\Apps\OpenCredentials, with every law that makes it safe to leave running proven by tests (BIBLE.md, RFC 0001).

2. Scope boundary

2.1 In the product

  • Detection across many credential providers, hash-and-discard, opt-in password patterns.
  • Review-gated disclosure, private channel first, never twice, editable notice template.
  • Remediation rechecks, capped and stalest first, feeding time-to-remediate measurements.
  • Review UI: findings table, research charts, scanner and disclosure controls.
  • Unattended operation: rate-limit-proof loop, headless one-shot, concurrent scanners on one database, run-menu deploy to R:, settings in the Vault.
  • Proof: NUnit tests for every law (non-retention, review before disclosure, race-safe claims, remediation states).

2.2 Never in the product

  • Credential validation against any provider API (OC-LAW-4).
  • Retaining, logging or returning a raw secret, or publishing who is leaking (OC-LAW-1).
  • Rotating several PATs to beat the rate limit; GitHub Research Access is not pursued.
  • Private repos, cloning, non-GitHub sources, GitHub Enterprise.
  • Hosting on Hetzner or any server; Azure is decommissioned and the data stays on local SQL.
  • MindAttic.Log adoption; console output and the HTML report are enough for a local tool.
  • Tests for presentation and plumbing no law depends on (chart math, the static report, token resolution order, CLI duration parsing, bUnit pages beyond disclosure), and open-ended sweeps.
  • The v1/ Python scraper; reference only.

3. Users and roles

  • Operator (the owner): runs scans, decides which exposure types may be disclosed, pauses the scanner.
  • Reviewer: reads findings in the UI before anything is disclosed.
  • Researcher: reads the aggregate measurements (leak rate, time to remediate, notice-to-fix conversion).
  • Leaker: the owner of a public repo, who receives a private advisory or a courtesy issue with the fingerprint only.

4. Requirements

Status is built (closed ticket, with evidence) or MS-n: the milestone in §7 that delivers it.

E1. Detection — OC-T70 — built

F1.1 Multi-provider scanning — OC-T71 — built

  • S1.1.1 Scan many providers — OC-T72 — built. As an operator, I scan public GitHub for LLM, cloud, VCS, payment, comms, DB URI and private-key leaks. Evidence: Patterns.cs, PatternsTests (OC-T2).
  • S1.1.2 Fingerprint, never retain — OC-T73 — built (its tests land in MS-24: OC-T3). Evidence: 65b779c, 7bda6f2.
  • S1.1.3 Opt-in password patterns — OC-T74 — built. Evidence: Patterns.WithPasswords().

E2. Disclosure — OC-T75 — built

F2.1 Gated, private-first notices — OC-T76 — built

  • S2.1.1 Review before disclosure — OC-T77 — built. Evidence: NotifyPassTests (OC-LAW-2).
  • S2.1.2 Private advisory first — OC-T78 — built. Evidence: NoticeServiceDisclosureTests.
  • S2.1.3 Never notify twice — OC-T79 — built. Evidence: NoticeServiceDisclosureTests.
  • S2.1.4 Editable notice template — OC-T80 — built. Evidence: 40e0a5b (OC-T28), LampSettingsTests.

E3. Remediation tracking — OC-T81 — built

F3.1 Rechecks — OC-T82 — built

  • S3.1.1 Recheck remediation — OC-T83 — built (its tests land in MS-24: OC-T5).
  • S3.1.2 Capped rechecks — OC-T84 — built. Evidence: --max-rechecks in Scraper.cs.

E4. Review UI — OC-T85 — built

F4.1 Findings, charts and controls — OC-T86 — built

  • S4.1.1 Findings table — OC-T87 — built. Evidence: Findings.razor, FindingsPageTests, 1164dab.
  • S4.1.2 Research charts — OC-T88 — built. Evidence: Visualizations.razor, 0aa03d8.
  • S4.1.3 Scanner and disclosure controls — OC-T89 — built. Evidence: Settings.razor.

E5. Operations — OC-T90 — built

F5.1 Unattended running — OC-T91 — built

  • S5.1.1 Never crash on a rate limit — OC-T92 — built. Evidence: GitHubClient.HandleRateLimitAsync, 7bda6f2.
  • S5.1.2 Headless one-shot — OC-T93 — built. Evidence: Program.cs.
  • S5.1.3 Concurrent scanners — OC-T94 — built (its tests land in MS-24: OC-T7).
  • S5.1.4 Run menu deploy to R: — OC-T95 — built. Evidence: 7f4253f (MAT-T305).
  • S5.1.5 Settings in the Vault — OC-T96 — built. Evidence: 40e0a5b (OC-T28).

E6. Local SQL database — OC-T55 — MS-24

F6.1 Local database default — OC-T57 — MS-24

  • Task: Local SQL default connection — OC-T52. Given no override, when the CLI or UI starts, then it opens the local SQL Server OpenCredentials database with integrated security; OPENCREDS_DB and the Vault value still win.
  • Task: Docs say local SQL — OC-T20. Given the docs, then docs/overview.md and the BIBLE describe local SQL, not Azure.

F6.2 Deployed end-to-end run — OC-T58 — MS-24

  • Task: Verify local end-to-end run — OC-T62. Given a Redeploy, when one headless pass runs from Release, then migrations apply, findings are stored and the review UI shows them.

F6.3 No third-party leak data in the repo — OC-T66 — MS-24

  • Task: Remove screenshots naming leaking repos — OC-T64. Given the public repo, then no screenshot, report or data names a real third-party repo that leaks a secret; the brochure uses redacted or synthetic images.

E7. Scanner promises proven — OC-T56 — MS-24

F7.1 Non-retention and scan pass — OC-T59 — MS-24

  • Task: Fingerprint and ScanContent tests — OC-T3. Given a match, then no Finding field contains the raw key.
  • Task: Scan pass tests — OC-T4. Given a failed fetch, then the claim is released and the file is retried next pass.

F7.2 Persistence and concurrency — OC-T60 — MS-24

  • Task: Db facade tests — OC-T7. Given an already-claimed file, then ClaimScan returns false.

F7.3 Disclosure and remediation — OC-T61 — MS-24

  • Task: Notify and recheck pass tests — OC-T5. Given a removed or repo-gone finding, then no notice is sent.
  • Task: GitHubClient status mapping tests — OC-T6. Given a 404 file in a live repo, then FileGone; both 404, then RepoGone.
  • Task: NoticeService rendering tests — OC-T8. Given a template, then every token is replaced and no raw key appears.

F7.4 Polish and release 1.0 — OC-T67 — MS-24

  • Task: Docs match the verified 1.0 — OC-T68. Given the tests landed, then every partial story is marked proven and RFC 0001 is done.
  • Task: Owner sign-off, scan and review — OC-T69 (owner hands-on).

5. Non-functional requirements

  • Platform: .NET (CLI opencreds and Blazor Server UI), SQL Server on the local machine through EF Core.
  • Ethics: non-retention in code (OC-LAW-1), review before disclosure (OC-LAW-2), no validation (OC-LAW-4), hash-and-discard after Meli et al. (NDSS 2019).
  • Resilience: never crashes on a rate limit (OC-LAW-3); live-refresh loops survive database exceptions.
  • Concurrency: many scanners and one reviewer share one database race-safely (OC-LAW-5).
  • Secrets: the GitHub token and connection string resolve through MindAttic.Vault (OC-LAW-6); none in the repo.

6. Interfaces and dependencies

  • Platform concerns (docs/ECOSYSTEM.md §2.1): Credentials and settings: MindAttic.Vault. Documents: MindAttic.Export (the HTML report). Shipping: the shared run menu.
  • Uses: GitHub Code Search and Contents APIs, GitHub private vulnerability reporting and Issues, local SQL Server, MindAttic.Vault (settings app), MindAttic.Export (HTML report), the shared deploy-lib run menu.
  • Used by: nobody; it is a standalone local tool.

7. Release sequence

  1. MS-24: OpenCredentials 1.0, verified local scanner (active, and the finished product). Epics E6 OC-T55 and E7 OC-T56; ends with F7.4 polish and release. The docs describe nothing beyond it.

8. Change log

Date Change to scope Ticket
2026-11-30 Specification written from the BIBLE, USER_STORIES, RFC 0001, the charter, code and ticket history. MS-24 is the finished product; the charter's out-of-scope items are permanent and moved to §2.2. OC-T64 (screenshots naming leaking repos) joined MS-24. MAT-T383
2026-11-30 MAT-T462 single-source pass: 1 renamed (OC-T56), 0 buckets dissolved, 10 requires added (0 cross-repo), 0 platform re-points MAT-T470
From OpenCredentials/docs/SPEC.md via MindAttic.Docs; synced automatically, so edit the repo, not this page.