fix: handle unrecognized BSM tokens causing empty audit.jsonl#1
Merged
Conversation
Add AuditIdentity interface (signerType, signingId, teamId, cdhash) and identity field to AuditEvent to support AUT_IDENTITY (0xed) tokens.
These three token types appear in virtually every macOS audit record but were unhandled, causing the parser to skip entire records and produce zero JSON output. - AUT_DATA (0x21): skip variable-length arbitrary data - AUT_IN_ADDR (0x2a): skip 4-byte IPv4 address - AUT_IDENTITY (0xed): parse code signing identity into event Closes EVP-45
8 new tests covering all three previously-unhandled token types: - AUT_DATA with byte, short, int32, and int64 unit sizes - AUT_IN_ADDR IPv4 address token - AUT_IDENTITY with populated and empty fields - Realistic macOS execve record combining all new tokens
- src/bsm-parser.ts: add bounds check to parseData for malformed tokens - src/bsm-parser.ts: add comment explaining basicUnit fallback behavior - src/bsm-parser.ts: add bounds checks before getUint16 calls in parseIdentity - src/bsm-parser.test.ts: fix Biome formatting
- Pin bun-version to 1.3.11 in both workflows - Run tests with --coverage in release workflow to match CI
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.
Summary
AUT_DATA(0x21),AUT_IN_ADDR(0x2a),AUT_IDENTITY(0xed)defaultbranch in the token dispatch skipped the entire remaining record on any unrecognized token, producing zero JSON outputAUT_IDENTITYis fully parsed into a newidentityfield onAuditEvent(signerType, signingId, teamId, cdhash)Closes EVP-45
Test plan
audit.jsonlis no longer empty