fix(mongock-importer): skip IGNORED audit entries safely#932
Open
davidfrigolet wants to merge 1 commit into
Open
fix(mongock-importer): skip IGNORED audit entries safely#932davidfrigolet wants to merge 1 commit into
davidfrigolet wants to merge 1 commit into
Conversation
`MongockImporterMongoDB.toAuditEntry` returns `null` for entries whose state is `IGNORED` (via `MongockAuditEntry.shouldBeIgnored()`), but the returned list is iterated downstream without a null check. Booting an application against a Mongock audit history containing an `IGNORED` entry therefore crashed with: NullPointerException: Cannot invoke "AuditEntry.getSystemChange()" because "auditEntryFromOrigin" is null inside the `migration-mongock-to-flamingock-community` system change. Changes: - **MongockImporterMongoDB**: filter `null`s out of the stream produced by `getAuditHistory()` and emit an INFO log when an entry is dropped because of `IGNORED`. The skipped entry's `changeId` is reported so operators know which legacy change was bypassed. - **MongockImportChange**: defensive null-filter at the caller so the same protection applies to any current or future `AuditHistoryReader` implementation (Couchbase, DynamoDB). - **MongoDBImporterTest**: regression test seeding the basic scenario plus one `IGNORED` entry. Asserts the `IGNORED` entry is absent from the Flamingock audit store and the rest of the audit history imports normally. No public API change. Behavior is purely additive (null-safety + log) relative to the previous code path.
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.
MongockImporterMongoDB.toAuditEntryreturnsnullfor entries whose state isIGNORED(viaMongockAuditEntry.shouldBeIgnored()), but the returned list is iterated downstream without a null check. Booting an application against a Mongock audit history containing anIGNOREDentry therefore crashed with:NullPointerException: Cannot invoke
"AuditEntry.getSystemChange()" because "auditEntryFromOrigin" is null