Repository navigation
security(ci): verify WOFF and WOFF2 magic bytes for committed font as… - #500
Closed
seuninfoo-svg wants to merge 1 commit into
Closed
seuninfoo-svg wants to merge 1 commit into
seuninfoo-svg wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #478
PR: WOFF/WOFF2 Magic Bytes Verification for Committed Font Assets
Summary
Add a static repository check for committed font assets. Files named
.woffor.woff2can be used to conceal JavaScript or other malicious content. Real font files have recognizable binary signatures (magic bytes) that can be checked without executing them.Problem
.woffor.woff2extensions can disguise executable contentSolution
Created
scripts/check-font-magic-bytes.mjs— a static binary validator that:.woffand.woff2files (excludesfixtures/andnode_modules/).woff2→wOF2(hex:77 4f 46 32).woff→wOFF(hex:77 4f 46 46)Files Added
Files Modified
package.json— Addedfont:checkandfont:testscriptsUsage
Example Output
Clean Repository
Invalid Font
Test Coverage
passes for valid WOFF2 fixturewOF2magic bytes acceptedpasses for valid WOFF fixturewOFFmagic bytes acceptedfails for text-disguised-as-WOFF.woffrejectedfails for text-disguised-as-WOFF2.woff2rejectedpasses when no font filesreports only the invalid pathexits non-zero on failurereads bytes onlyIntegration
Runs in CI to verify committed font assets:
Design Decisions
fixtures/andnode_modules/— Test fixtures and dependencies not checked by defaultfsmodule@sub-rosa/logging— Consistent JSON diagnosticsAcceptance Criteria ✅
.woff2files must begin withwOF2magic bytes.wofffiles must begin withwOFFmagic bytesfont:check,font:test)