fix: Handle missing ScanID/TaskID in AddFinding to prevent persistence errors#27
Conversation
Refactors AddFinding to populate missing ScanID and TaskID from the analysis context. Adds a defensive fallback to a Nil UUID if IDs are still missing, preventing "unable to encode empty string into binary format for uuid" errors during database persistence. Logs a warning when the fallback is used to aid in debugging.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
This PR addresses a runtime error where findings could fail to persist if
ScanIDorTaskIDwere missing (empty strings), causingpgxto fail when encoding for UUID columns.Changes:
internal/analysis/core/context.go:AddFindingnow checks for missingTaskID(in addition to existingScanIDcheck) and attempts to fill it fromac.Task.00000000-0000-0000-0000-000000000000(Nil UUID).This ensures findings are always persisted with valid UUID formats, even if the context is incomplete, preventing data loss and application errors.
PR created automatically by Jules for task 979387406518472121 started by @xkilldash9x