Skip to content

prism-cli 1.20.1: threat-model drill-down header at the top, overview in its own card, safe markdown - #122

Open
Enclavet wants to merge 1 commit into
mainfrom
fix/threat-model-drilldown
Open

Enclavet wants to merge 1 commit into
mainfrom
fix/threat-model-drilldown

Conversation

@Enclavet

Copy link
Copy Markdown
Contributor

prism-cli 1.20.1. Fixes the threat-model drill-down (#security/run/<repo>/<id>-manual-security-threat-model) a user hit on live data.

Root cause of the empty header

The header's field list (.rundl, a grid) sits in the left cell of the .runhead grid. The threat model's system overview (about 119,000 characters of markdown in the real result) was drawn in the right cell. That cell grew to about 25,000 px tall. The left cell stretched to match, and so did the dl, which spread its six rows across that height: Branch at 5,289 px, Account at 10,364 px, Job at 25,590 px. Only "Repo" was on screen. The data was all there: the result has the branch, commit, account, region, service times and service_duration_s, and securityRunDetail already maps them. Code reviews looked right only because they have no overview.

What changes

Now
Header align-items:start / align-content:start, and the overview is out of it. One layout for code reviews, threat models and pentests.
Overview Its own full-width card: the first paragraph, then Show full overview / Show less.
Markdown markdown-lite.ts builds headings, paragraphs, lists, inline code and bold with createElement and text nodes only. It sets no attributes and never uses innerHTML. Fences and tables show as preformatted text; links show their text and images their alt text.
Threats Each threat shows its affected components and assets when saved. Threat-model results save impactedAssets (as assets) from now on; older results say they were not saved.

Tests

  • npm test (aws guard): 884/884. New threat-model-drilldown.test.ts:
    • The renderer, given hostile input (<script>, <img onerror>, a javascript: link, an image), produces text nodes and the allowed tags only, with no attributes and no URLs.
    • The page test uses a real-shaped detail (18 threats, a 300-line overview). It checks the header fields, the overview collapsed then full, the 18 threats with the critical filter at 7, and the assets.
  • npm run docs:check: 0 problems.
  • Full e2e: 70/70. The new tmdetail suite seeds a real-shaped threat model (7 critical, 10 high, 1 medium; long markdown with hostile bits):
    • TM1: header fields at the top.
    • TM2: overview card, collapsed and expandable, text only.
    • TM3: 18 threats, a working filter, statement, recommendation, assets and evidence.
    • TM4: no sideways scroll at 1280 or 390 px, and 4.5:1 contrast in light mode.
    • The code-review and pentest drill-down checks (R3–R9) still pass.

Demo screenshots: test-reports/threat-model-drilldown/ (1280 light and dark, 390 dark).

Docs: USER_GUIDE (a run's page); CLI-REFERENCE version.

… in its own card, safe markdown

- The header's field list (.rundl) is a grid inside the .runhead grid; the
  long overview made the right column tens of thousands of pixels tall, the
  dl stretched to match and its rows spread the fields down the page.
  align-content/align-items start; the overview moves out of the header.
- Overview card for threat models and pentests: first paragraph, Show full
  overview; markdown drawn with createElement/text nodes only (headings,
  paragraphs, lists, inline code, bold, fences/tables as pre; links and
  images as their text).
- Threats show their affected components and assets; threat-model results
  save impactedAssets from now on.
@github-actions

Copy link
Copy Markdown

✅ PRISM Eval Gate -- PASS

Score: 0.93 | Findings: 4 (0 high, 0 medium)

Summary: The overview renderer is safe: it uses text nodes only, with no innerHTML and no attributes, and assets are redacted before they are saved. The only issues are minor robustness, performance and duplic

File Line Severity Category Issue
cli/src/security/threat-model.ts 459 low reliability t.impactedAssets.length throws a TypeError if a threat row has no impactedAssets (older or partial Security Agent output). Guard it with t.impactedAssets?.length or default it to [] .
cli/src/dashboard/markdown-lite.ts 61 low performance With onlyFirst , every line runs nodes.some(...) , so parsing is quadratic in the node count. The overview text is untrusted and has no length cap. Track a hasParagraph flag, and consider capping
cli/src/dashboard/markdown-lite.ts 69 low maintainability The magic numbers 2 and 6 in the heading level offset ( Math.min(6, h[1].length + 2) ) have no named constants.
cli/src/dashboard/security-runs-page.ts 193 low maintainability The assets list and the evidence list below it repeat the same flatMap pattern that joins items with ', ' and wraps each in code . Extract a shared helper. The hardcoded version string '1.20.1' i

Powered by kiro-cli headless - Model: auto - Threshold: 0.82


✅ Secret scan -- no credentials found in this PR's commits.

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