Skip to content

Reporting: traffic-light scorecard, health overlay, CSV/JSON export (§8.1, §8.3) - #21

Open
Yoshiofthewire wants to merge 17 commits into
kyguard/inventoryfrom
kyguard/scorecard
Open

Yoshiofthewire wants to merge 17 commits into
kyguard/inventoryfrom
kyguard/scorecard

Conversation

@Yoshiofthewire

@Yoshiofthewire Yoshiofthewire commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

In one line: Every account now gets one traffic-light class (Green managed / Yellow vaulted / Red listed) with a health overlay, served as a dashboard JSON and as audited CSV/JSON exports that always agree.

§13 Phase 1A items: "Traffic light, health … scorecard and CSV/JSON export (§8.1–§8.3)". Acceptance test 12.

What changed

  • New internal/reporting: one dataset builder, one classifier, one filter, one CSV writer.
  • Green = schedule in the current verified policy and at least one release receipt; else Yellow = current envelope; else Red. Decommissioned accounts are counted separately, never classified. Classes always sum to the active count; percentages always sum to 100.
  • Health is one overlay value (broker-reported problem, then checkout_open, pending_first_rotation, overdue, else healthy); it never changes the class.
  • GET /api/reports/scorecard (any session) with filters class, health, pool, attr.<key>, owner.<key>; format=json|csv returns the same rows as a download, audited (report.exported) before the body is sent. CSV formula cells are neutralized.
  • Non-admins see only accounts they own or whose policy lists a principal enrolled under their own issuer and subject — never a subject alone.
  • GET /api/jobs (admin): rotation runs and checkout leases for the jobs screen.

Review this

Checked: acceptance 12 end to end (TestScorecard: sums, dashboard = JSON = CSV for one department filter, two export audits, owner and listed-principal visibility, a same-subject user from another IdP sees nothing); 15 mutations killed.
Not checked: the classifier against real broker-produced receipts (fixtures write store rows directly).
Decided for you: DECISIONS 205–208 (overdue definition, one health value, issuer+subject match, dashboard view not audited but every download is).
You need to: nothing.

Detail
# Mutation Killed by
B1 owners lose their accounts TestScorecard
B2 listed principals see nothing TestScorecard
B3 non-admins see everything TestScorecard
B4 issuer given to any SSO provider TestScorecard
B5 principal matched by subject alone TestSameIdentityNeedsIssuerAndSubject
B6 Green without a release TestClassify
B7 Green without a schedule TestClassify
B8 decommissioned accounts classified TestScorecard
B9 export not audited TestScorecard
B10 CSV formula cells left live TestFilterAndCSV
B11 jobs open to any session TestScorecard
B12 percentages may sum to 99 TestPercentagesAlwaysSumTo100
B13 oldest release picked instead of newest TestReportFactsNewestRelease
B14 decommissioned count ignores the filter TestScorecard
B15 scorecard route back to requireAuthenticated (break-glass session without a reason gets the dashboard, 200) TestReportingRoutesWaitForBreakGlassReason

Guide finding (unbounded scan of every release receipt) fixed in 3c633ac: SQL now returns only each account's newest release row. Second round (bf69f17): pool and attribute filters now apply to the decommissioned count; a class or health filter counts none.

Routes marked TODO(hawthorn §7.5): GET /api/reports/scorecard, GET /api/jobs.
Round 4 (a7db71b): security P2. A break-glass session counts as an admin, so the scorecard and its JSON and CSV exports now use requireSession from #20 (403 break_glass_reason_required until the session states its reason, 200 after). The test is table-driven over the dashboard, format=json and format=csv (B15).

Round 6 (alder): main came in through #20.

  • GET /api/reports/scorecard and GET /api/jobs go through main's route registry (session class, no step-up window; they are reads). Without this, TestEveryRouteIsClassified fails.
  • callerIssuer returns users.sso_issuer, so a non-KySignOn SSO user is listed on a policy too, still only by issuer and subject. TestScorecard gives carol and dave their stored issuers.
  • DECISIONS: Inventory: accounts, assets, descriptors and attributes (§8.2, §10) #20's two new entries are 204a/204b, so 205–208 here keep their numbers; 207 is reworded for users.sso_issuer.
# Mutation (round 6, throwaway copy) Killed by
R1 callerIssuer returns a fixed issuer, so a subject alone matches TestScorecard: dave (carol's subject, another IdP) sees carol's account

Checks (round 6): full suites at the bottom (#20) and top (#24) of the stack; see those PRs.

🤖 Generated with Claude Code

@Yoshiofthewire

Yoshiofthewire commented Nov 25, 2026 •

Copy link
Copy Markdown
Member Author

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪

🧪 PR contains tests

⚡ No major issues detected


Advisory only: this comment never gates the pull request.
gpt-6.1-sol using pr-agent on behalf of Yoshi

@Yoshiofthewire

Yoshiofthewire commented Nov 25, 2026 •

Copy link
Copy Markdown
Member Author

Security review - cleared

Detail withheld: this repository is public, and posting an unfixed finding here would be public disclosure. The full report was posted to the hand-off board at https://myslop.urlxl.us/f/pr-reviewer-busnes-app-kyguard-server-21, where it is readable by the operator and expires seven days after the last post.


gpt-6.1-sol using security-audit on behalf of Yoshi

@Yoshiofthewire

Yoshiofthewire commented Nov 25, 2026 •

Copy link
Copy Markdown
Member Author

Autonomous review - 1/1 personas cleared

  • security: cleared

Merging remains a human decision; this bot never approves.


gpt-6.1-sol using security-audit on behalf of Yoshi

Yoshiofthewire and others added 4 commits November 25, 2026 08:21
…§8.1, §8.3)

internal/reporting builds one authorized dataset (admins see every
account; others the accounts they own or whose current policy lists a
principal enrolled with their own issuer and subject), classifies each
active account Green / Yellow / Red by schedule plus release evidence,
then current envelope, overlays one health value, and filters by class,
health, pool, account attributes and owner attributes.

GET /api/reports/scorecard serves the dashboard; format=json|csv serves
the same rows and totals as an audited download. Percentages always sum
to 100; CSV formula cells are neutralized. GET /api/jobs lists rotation
runs and checkout leases for the jobs screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The scorecard read every release receipt and kept the newest in Go, so
the work grew with rotation history. The query now returns only each
account's newest release row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A pool or attribute filter now applies to the decommissioned count; a
class or health filter matches no decommissioned account, since they
have neither.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Yoshiofthewire and others added 6 commits November 25, 2026 14:24
# Conflicts:
#	internal/store/inventory_test.go
# Conflicts:
#	internal/store/inventory.go
A break-glass session counts as an admin, so before stating its reason
it could read the deployment-wide scorecard and its exports. The route
now uses requireSession (403 break_glass_reason_required).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Note

🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire

Security finding (P2, internal/api/report_handlers.go) fixed in a7db71b, with the test in TestReportingRoutesWaitForBreakGlassReason. A mutant that removes the fix makes the test fail.

Yoshiofthewire and others added 6 commits November 25, 2026 17:14
…suer

main's route registry (#18) refuses routes registered outside it, and
main now stores the SSO issuer on the user (§7.2), so a principal is
matched by the caller's stored issuer and subject, not only for KySignOn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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