Repository navigation
Conversation
The body of process_sigmf_archive that reads the tar members and builds the sigmf-recording object was indented one level too far out, so it ran for every attribute of the object rather than only for the SigMF-archive one. Whenever the submitted object's first attribute is anything other than SigMF-archive, sigmf_tarfile is still unbound when files = sigmf_tarfile.getmembers() executes, raising UnboundLocalError; the broad except then reports it to the analyst as the generic "An error occured when processing the SigMF archive", hiding a perfectly valid archive that sits later in the attribute list. The finding suggested moving only the assignment, but the loop and the object construction that follow it depend on the same branch, so the whole block belongs inside the if. The change is whitespace only and restores the intended fall through to "No SigMF-archive attribute found". Verified with flake8 on the module and the full test suite against a local modules server: 161 passed, 4 skipped, 5 subtests passed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018dfYpyaSZd1nxSRLr8suj8
This branch has not been deployed
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.
BLUF — SigMF archive enrichment fails or succeeds depending on the order of attributes in the object.
process_sigmf_archiveinmisp_modules/modules/expansion/sigmf_expand.py, the archive-processing block is indented one level too shallow, so it runs for every attribute rather than only the SigMF-archive one, raisingUnboundLocalErroronsigmf_tarfilewhenever another attribute comes first.sigmf-archiveobject get the expectedsigmf-recordingobject instead of a generic "An error occured when processing the SigMF archive" message that depended on attribute ordering.The archive-processing logic in
process_sigmf_archivewas indented at the wrong level:Because the block from
files = sigmf_tarfile.getmembers()through the finalreturnwas indented one level too shallow, it ran for every attribute in the object'sAttributelist, not only for theSigMF-archiveone. Whenever an attribute other thanSigMF-archivewas iterated first,sigmf_tarfilewas not yet defined and the code raisedUnboundLocalError, which the surrounding broadexcept Exceptionswallowed into the generic"An error occured when processing the SigMF archive"message.Impact: any MISP analyst enriching a
sigmf-archiveobject whoseAttributelist has a non-archive attribute before theSigMF-archiveattribute gets a useless generic error instead of the expectedsigmf-recordingobject — the module effectively fails on ordering it shouldn't care about.Fix: re-indent the archive-processing block (getting the tar members, building the meta/data attributes, constructing and returning the
sigmf-recordingobject) so it lives inside theif attribute["object_relation"] == "SigMF-archive":branch, alongside the code that opens the tarfile. This is a whitespace-only change; no logic was altered.Verification
flake8 --extend-exclude=misp_modules/lib/,tests/,website/ misp_modules/modules/expansion/sigmf_expand.py— clean, no output.161 passed, 4 skipped, 5 subtests passed in 121.78s (0:02:01).Found during a review of the repository; other findings are being submitted as separate PRs.
🤖 Generated with Claude Code