Draft
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.
Describe the change
Adds support for passing a per-request password to decrypt password-protected PDFs during scanning. This is implemented as a general-purpose metadata passthrough mechanism that any scanner can use for per-request parameters.
Changes across 4 layers
Go Frontend (
src/go/cmd/strelka-frontend/main.go): StoresAttributes.metadatafrom the gRPC request into Redis asmetadata:{id}usingSetNX, following the same pattern as YARA data. This makes client-provided metadata available to the backend.Python Backend (
src/python/bin/strelka-backend): Readsmetadata:{root_id}from Redis indistribute()and injects it into each scanner's options asoptions['metadata']. Kept as a nested key to prevent client-supplied values from overriding config-based scanner options.ScanPdf Scanner (
src/python/strelka/scanners/scan_pdf.py): Readspasswordfromoptions['metadata']and usesfitz.authenticate(password)to decrypt encrypted PDFs. Adds three new flags:decrypted_with_password— PDF was encrypted and successfully decryptedpassword_auth_failed— password was provided but incorrectencrypted_pdf_no_password— PDF is encrypted but no password was provided (replaces the previous genericpdf_load_error)Python Client (
misc/python-client/client.py): Adds-p/--passwordCLI flag that populatesAttributes.metadata["password"]in the gRPC request.No proto changes required —
Attributes.metadata(map<string, string>) was already defined in the protobuf but unused until now. No generated code changes needed.Dependencies: None. The
Attributes.metadatafield andfitz.authenticate()(PyMuPDF) are both pre-existing capabilities that were not previously wired together.Describe testing procedures
12 unit tests added in
src/python/strelka/tests/test_scan_pdf.pycovering all password scenarios:Checklist