Skip to content

Added size limit check for sarif upload and implemented nil pointer checks for regions#1838

Merged
timbastin merged 2 commits intomainfrom
add-saveguards-to-sarif-upload
Apr 2, 2026
Merged

Added size limit check for sarif upload and implemented nil pointer checks for regions#1838
timbastin merged 2 commits intomainfrom
add-saveguards-to-sarif-upload

Conversation

@Dboy0ZDev
Copy link
Copy Markdown
Collaborator

Size limit check only prevents big sarifs from being saved to the database. The fill sized data will still reach the backend server and land in memory unless prevented by ratelimiting / size limiting through a reverse-proxy or else.

Copilot AI review requested due to automatic review settings April 1, 2026 16:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to harden SARIF ingestion by preventing nil-pointer panics when extracting snippet/region data and by introducing a maximum-size gate for first-party SARIF uploads.

Changes:

  • Added a nil check for PhysicalLocation.Region when building snippet metadata for first-party vuln ingestion.
  • Added a 16 MB size limit check in the SARIF upload controller path (FirstPartyVulnScan) using JSON re-marshalling.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
services/scan_service.go Adds guarding logic around missing SARIF Region when extracting snippet coordinates/content.
controllers/scan_controller.go Adds a SARIF payload size check (16 MB) before proceeding with scan processing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread services/scan_service.go Outdated
Comment thread controllers/scan_controller.go Outdated
Comment thread controllers/scan_controller.go Outdated
@timbastin timbastin merged commit 50c7b9e into main Apr 2, 2026
39 of 53 checks passed
@Dboy0ZDev Dboy0ZDev deleted the add-saveguards-to-sarif-upload branch April 2, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants