Repository navigation
filescan: read legacy Office files and files embedded in Office documents - #371
Merged
Merged
Conversation
…ents .doc, .xls and .ppt were reported unsupported_type, and files embedded in docx/xlsx/pptx weren't opened. - cfbfile.go: a bounded OLE compound file reader (header, FAT and DIFAT, directory tree, mini stream). Every sector number is range-checked and every chain bounded by the file's sector count; streams are capped at max_file_bytes. - .doc: text through Word's piece table (8-bit and UTF-16 pieces); field codes dropped and results kept, like instrText in docx; paragraph and cell marks as breaks; fEncrypted means password_protected. - .xls (BIFF8): the shared string table, including strings continued in CONTINUE records with their own 8/16-bit flag; LABEL and STRING cells; NUMBER, RK, MULRK and cached FORMULA values (whole numbers as digits, so a card number stored as a number is found); FILEPASS means password_protected. Excel 5/95 (Book) stays unsupported. - .ppt: TextChars and TextBytes atoms; CryptSession10 or EncryptedSummary means password_protected. - OLE packages (Package, Ole10Native) are unwrapped and scanned. - Encrypted OOXML is detected from the parsed directory; the stream-name search stays as the fallback for files that don't parse. - Embedded files (word/xl/ppt/embeddings) are scanned as entries. Ones with findings or protected by a password/RMS are recorded; unreadable objects (equations, drawings) aren't, so everyday documents don't become unscannable. Tests build real compound files (mini stream and regular sectors) for each format, encryption flags, packages, embeddings and malformed files (loops, bad sectors, oversized streams). Fuzz seeds now include compound files; 90 s of fuzzing found no crashers, and the slowest saved input scans in 0.2 ms. Refs #327 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
neamul602
enabled auto-merge
November 2, 2026 10:07
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
Merged
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.



Approval-free task 3 of the File DLP epic (#327). It needs no new dependency: everything is the standard library.
Before this,
.doc,.xlsand.pptwere reported asunsupported_type, and files embedded in.docx/.xlsx/.pptxweren't opened.What's read now
.doc.docx; paragraph and cell marks become breaksfEncryptedis set.xls(BIFF8)FILEPASSrecord.pptCryptSession10record or anEncryptedSummarystreamPackage,Ole10Native)word/xl/ppt/embeddings) are scanned as entries. Ones with findings, or protected by a password or Rights Management, are recorded and count towards the document's status. Unreadable embedded objects (equations, drawings) don't make the document unscannable; otherwiseon_unscannablewould trip on everyday documents.unsupported_type: Excel 5/95, Outlook.msgand other OLE files, and PDF (which needs a library, so a dependency and license review).Safety (hostile input)
cfbfile.gois a bounded compound-file reader:max_file_bytes.Malformed files are reported as
corrupt.Test plan
make verify-crossand the changelog check pass.sentinelgo dlp testcan't check this: it reads a file as plain text with the clipboard engine, not with the file scanner.)Refs #327
🤖 Generated with Claude Code