Skip to content

fix(models): only update resources when tags are created#9569

Merged
vicferpoy merged 2 commits intomasterfrom
PROWLER-504-resources-are-updated-every-time-a-finding-is-processed
Dec 16, 2025
Merged

fix(models): only update resources when tags are created#9569
vicferpoy merged 2 commits intomasterfrom
PROWLER-504-resources-are-updated-every-time-a-finding-is-processed

Conversation

@vicferpoy
Copy link
Member

@vicferpoy vicferpoy commented Dec 16, 2025

Context

Compliance and scan tasks were putting excessive write pressure on the database, and UPDATE "resources" was one of the top SQLs even when nothing changed on the resource.

Description

Adjusted Resource.upsert_or_delete_tags to only save the Resource when a tag mapping is actually created. Tag mappings are still upserted as before, but we no longer issue a resource UPDATE (and bump updated_at) when the tag set is unchanged, reducing write load during scans.

Checklist

UI

  • All issue/task requirements work as expected on the UI
  • Screenshots/Video of the functionality flow (if applicable) - Mobile (X < 640px)
  • Screenshots/Video of the functionality flow (if applicable) - Table (640px > X < 1024px)
  • Screenshots/Video of the functionality flow (if applicable) - Desktop (X > 1024px)
  • Ensure new entries are added to CHANGELOG.md, if applicable.

API

  • Verify if API specs need to be regenerated.
  • Check if version updates are required (e.g., specs, Poetry, etc.).
  • Ensure new entries are added to CHANGELOG.md, if applicable.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@vicferpoy vicferpoy requested a review from a team as a code owner December 16, 2025 11:56
@github-actions
Copy link
Contributor

github-actions bot commented Dec 16, 2025

✅ All necessary CHANGELOG.md files have been updated.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 16, 2025

Conflict Markers Resolved

All conflict markers have been successfully resolved in this pull request.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 16, 2025

🔒 Container Security Scan

Image: prowler-api:f2cfa16
Last scan: 2025-12-16 12:08:31 UTC

📊 Vulnerability Summary

Severity Count
🔴 Critical 4
Total 4

3 package(s) affected

⚠️ Action Required

Critical severity vulnerabilities detected. These should be addressed before merging:

  • Review the detailed scan results
  • Update affected packages to patched versions
  • Consider using a different base image if updates are unavailable

📋 Resources:

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.43%. Comparing base (d4b90ab) to head (dc832df).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9569      +/-   ##
==========================================
+ Coverage   82.82%   92.43%   +9.61%     
==========================================
  Files          23      159     +136     
  Lines         652    22678   +22026     
==========================================
+ Hits          540    20963   +20423     
- Misses        112     1715    +1603     
Flag Coverage Δ
api 92.43% <100.00%> (?)
prowler-py3.10-mongodbatlas ?
prowler-py3.11-mongodbatlas ?
prowler-py3.12-mongodbatlas ?
prowler-py3.9-mongodbatlas ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
prowler ∅ <ø> (∅)
api 92.43% <100.00%> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vicferpoy vicferpoy merged commit cbc621c into master Dec 16, 2025
37 checks passed
@vicferpoy vicferpoy deleted the PROWLER-504-resources-are-updated-every-time-a-finding-is-processed branch December 16, 2025 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants