feat: add printable checklists for SFC certifications#320
feat: add printable checklists for SFC certifications#320madjin wants to merge 18 commits intosecurity-alliance:developfrom
Conversation
- New utils/generate-printable-checklists.js script that reads cert MDX files and generates print-optimized HTML checklists - 3-column CSS layout with smart section chunking (splits at midpoint if >6 controls) - Runs as postdocs:build hook, outputs to docs/dist/printable/ - Includes print button, org/owner/date fields, and notes area per section 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add Print button to CertList component linking to printable HTML - Style print button to match existing Import/Export buttons - Fix output path to docs/public/printable/ for vocs compatibility - Move generate-printables before vocs build for production support - Add docs/public/printable/ to gitignore (generated files) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@madjin is attempting to deploy a commit to the Security Alliance Team on Vercel. A member of the Team first needs to authorize it. |
- Escape title/subtitle for XSS prevention - Sanitize certName for safe URL/filename use - Filter invalid control objects - Coerce text input to String in escapeHtml 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
This is cool (and the output looks great), but why deploy as a separate doc and button, rather than a standard print style sheet that is used when someone chooses Print in the browser? Generally, it's considered not-great-practice to replicate browser furniture. Does it trigger if I hit cmd-p ? (maybe it does - I couldn't see from my skim of the code - dismiss at will). |
|
It's a nit, but (more) correct behaviour would be to deploy that style sheet if someone prints the main page. https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Media_queries/Printing |
Per reviewer feedback, adds @media print styles so cmd-p on main pages produces clean output: - Hides nav, sidebar, banner, footer, action buttons - Full-width content with print margins - White background, black text - Shows URLs after external links - Prevents awkward page breaks 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Hide additional vocs chrome elements (gutterTop, curtains, search) - Hide cert interactive elements (progress bars, toggles, inputs) - Force sections to expand when printing - Clean control card styling with subtle separators - Prevent page breaks inside control cards - Reduce padding for better content density 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Hey @madjin super sorry for the delay! The printable version looks amazing! Thank you so much! But I found 1 bug: if you have frameworks on darkmode, the printable versions are unreadable 😅
I'm gonna suggest some fixes in the pr review |
DicksonWu654
left a comment
There was a problem hiding this comment.
The fixes to the black background for darkmode print
Co-authored-by: Dickson Wu <33645481+DicksonWu654@users.noreply.github.com>
Co-authored-by: Dickson Wu <33645481+DicksonWu654@users.noreply.github.com>
Co-authored-by: Dickson Wu <33645481+DicksonWu654@users.noreply.github.com>
Co-authored-by: Dickson Wu <33645481+DicksonWu654@users.noreply.github.com>
Co-authored-by: Dickson Wu <33645481+DicksonWu654@users.noreply.github.com>
Co-authored-by: Dickson Wu <33645481+DicksonWu654@users.noreply.github.com>
This reverts commit af5379f.
Co-authored-by: Dickson Wu <33645481+DicksonWu654@users.noreply.github.com>
Co-authored-by: Dickson Wu <33645481+DicksonWu654@users.noreply.github.com>
Adds the first and most critical review suggestion that was missed: force color-scheme: light only !important on :root for print media. This ensures browsers render print preview in light mode regardless of user's system theme preference. Co-authored-by: Dickson Wu <33645481+DicksonWu654@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Security Review: PR #320 - Printable ChecklistsOverviewQuick security review of the printable checklist generator for potential hardening. Findings1. Path Sanitization Gap (Medium)File: The const certName = file.replace('.mdx', ''); // unsanitized
const outputPath = path.join(OUTPUT_DIR, `${certName}.html`); Fix: Apply existing sanitizer to both uses: const certName = sanitizeCertName(file.replace('.mdx', '')); 2. Input Validation (Low)Control properties from YAML are escaped but not type-checked. Malformed frontmatter could cause unexpected behavior. Optional hardening: if (typeof c.title !== 'string') continue; What's Already Good
RecommendationApply the one-line path sanitization fix. Everything else is defense-in-depth and optional. |
Option 2: Consider Separating from Dev BuildCurrently "docs:dev": "... && vocs dev", // no printables Why? Reduces attack surface during normal dev - the generator only executes when deploying. Devs can Can also make it a CI-only thing + manual command only for even more protection |
- Apply sanitizeCertName() to output file path (not just URL) - Add type validation for control.title from YAML frontmatter - Move generate-printables from docs:dev to docs:build only Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Implemented the security hardening suggestions:
Devs can still run |




Summary
Features
/printable/{cert-name}.htmldocs/public/printable/Files Changed
utils/generate-printable-checklists.js- New generator scriptcomponents/cert/CertList.tsx- Print button addedcomponents/cert/control.css- Print button stylingpackage.json- Build script integration.gitignore- Ignore generated filesTest plan
pnpm run docs:devand verify Print button appears on cert pagespnpm run docs:buildand verify files indocs/dist/printable/🤖 Generated with Claude Code
Preview