Commit 32dfa39
authored
visual-artifacts v1: PR 2 core phase renderers (think/review/security/qa/ship) (#218)
* visual-artifacts: PR 2 core phase renderers (think/review/security/qa/ship)
Wires renderers for the remaining core phases so /think, /review,
/security, /qa, and /ship artifacts can each be inspected as a
static HTML view. Same trust + path-safety contract as PR 1.
Shared helpers in bin/lib/visual-render.sh:
- nano_visual_normalize_artifact: jq-based coercion that turns a
legacy or malformed artifact into a predictable shape (summary,
context_checkpoint, scope_drift, findings, conflicts as objects /
arrays). Every renderer reads the normalized form.
- nano_visual_severity_class: maps blocking/critical/high/etc to a
CSS class so review/security/qa agree on color and styling.
- nano_visual_safe_pr_url: allowlist for ship pr_url. Only
https://github.com/* renders as a clickable link; every other URL
renders as escaped text with an explicit "host not in allowlist"
note.
- nano_visual_safe_screenshot_path: stricter allowlist for future
QA screenshot rendering (PR 3 may wire this).
Body renderers in bin/render-artifact.sh:
- render_think_body: value proposition, scope mode chip, narrowest
wedge, key risk, premise validation, archetype card with optional
example reference, out-of-scope list.
- render_review_body: 4-counter summary (blocking / should fix /
nitpicks / positive), scope drift status chip with out-of-scope
and missing file lists, severity-styled findings.
- render_security_body: 5-counter summary (critical / high / medium
/ low / total), findings with category chips (OWASP A0n /
STRIDE), proof_of_concept and reproduce blocks wrapped in
<details><pre> so multi-line escaped content stays readable.
- render_qa_body: mode / status chips, WTF likelihood, 5-counter
test/bug breakdown, findings with reproduce + root_cause +
fixed flag.
- render_ship_body: report_only mode renders a short report card
(no release-packet styling); normal mode renders PR title / number
/ URL / status / CI passed. Unsafe PR URLs are rendered as text
with data-testid="unsafe-pr-url" so callers can audit.
- render_findings_section: shared helper for review/security/qa.
- render_context_checkpoint: shared helper for the trailing card.
CI extensions:
- 8 new e2e cells (think, review, security, qa, ship normal, ship
report_only, ship malicious URL, XSS across all 5 phases).
- 5 new template safety checks (nano_visual_safe_pr_url usage,
rel="noopener noreferrer", nano_visual_severity_class, CSS for
.finding.sev-bad and .counter).
- Template safety lint now allows the `# url-allowlist` marker so
the legitimate code-level case pattern does not trip the
"no http(s) URLs" check.
Test counts:
- e2e: 86 -> 152 (66 new checks across 8 phase + XSS cells)
- template safety: 20 -> 25
- Total contract surface: 177 checks
* visual-artifacts: escape ship ci_passed before HTML interpolation
Codex PR 2 pass 1 finding. /ship's schema only requires summary
to be an object, so a malformed artifact with
"ci_passed":"<script>alert(1)</script>" rendered raw markup. Every
other JSON-derived ship field passes through nano_html_escape; the
boolean-typed ci_passed was the one gap.
Pipe ci_passed through nano_html_escape like every other scalar.
Adds a regression cell with a string-typed ci_passed containing a
script tag; the rendered HTML must contain the escaped form and
must not contain the raw tag.
Test count: 152 -> 154.1 parent 621fdbe commit 32dfa39
4 files changed
Lines changed: 895 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
361 | 383 | | |
362 | 384 | | |
363 | 385 | | |
| |||
370 | 392 | | |
371 | 393 | | |
372 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
373 | 487 | | |
374 | 488 | | |
375 | 489 | | |
| |||
0 commit comments