fix(cloud-security): honor finding exceptions in integration task checks#3135
Merged
Conversation
A finding marked as an exception (e.g. a deliberately-public S3 bucket) was suppressed in the Cloud Tests findings view but still failed the corresponding integration TASK check — both the compliance task status and the "N failed" card — because only cloud-security-query applied exceptions. Centralize the exception logic into one source of truth (ActiveExceptionSet / loadActiveExceptionSet) and apply it everywhere a check result becomes pass/fail: - Cloud Tests findings view refactored to use it (removes the duplicate; the two systems are now matched by construction). - Manual run-check + scheduled Trigger task: task status excludes excepted findings (shared decideTaskStatus / countEffectiveFailures helpers), so a task whose only failures are excepted goes done — identical in both paths. - Task-check display (getTaskCheckRuns): excepted results are flagged and dropped from the run's failed count/status; the UI renders them as "Exception". Additive + fail-safe: with no exceptions the behavior is byte-for-byte identical, and if the exception lookup errors it suppresses nothing (never hides a real finding). Raw check results/counts are left untouched in the DB; exceptions only affect derived status + display. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
2 issues found across 10 files
Confidence score: 2/5
- In
apps/api/src/integration-platform/controllers/task-integrations.controller.ts, the failed→success rewrite can mark execution-error runs as successful when they have zero findings, which can hide real runtime failures and mislead downstream monitoring/reporting—gate the rewrite on explicit "excepted findings" state (not just zero findings) before merging. - In
apps/api/src/trigger/integration-platform/run-task-integration-checks.ts, status may remain unchanged when all findings are excepted and there are no passing results, so scheduled runs can miss the intended "excepted-only => done" transition and appear stuck/incomplete—add explicit handling for the all-excepted/no-pass path and verify with a scheduled-run test case before merging.
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two P1 issues from cubic: 1. getTaskCheckRuns rewrote a failed run to success whenever the effective failed count was 0 — which also matched an execution-error run (status failed, failedCount 0 because the error produced no findings), hiding real runtime failures. Gate the rewrite on exceptedCount > 0 so only genuinely all-excepted runs are downgraded; error runs stay failed. 2. decideTaskStatus returned null (leave unchanged) when all findings were excepted AND there were no passing results, so an all-excepted task could stay stuck in its prior (failed) status. Add the raw totalFindings signal: if the check evaluated any resource and nothing effectively fails, it goes done; only a run that evaluated nothing (e.g. all errored) stays unchanged. Applied in both the manual and scheduled paths. Added tests: all-excepted/no-passing -> done (helper + manual run), and an execution-error run stays failed in the display. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
@cubic-dev-ai review it |
Contributor
@tofikwest I have started the AI code review. It will take a few minutes to complete. |
Contributor
|
🎉 This PR is included in version 3.82.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Problem
A customer (PRIMER) marked a deliberately-public S3 bucket as an exception (
primer-production-reports-bucket, reason "reports deliberately public"), but the "S3 — public access blocked" task check still failed — both the "1 failed" card and the compliance task status — on every run after the exception was created.Root cause:
FindingExceptionwas honored only in the Cloud Tests findings view (cloud-security-query.getFindings). The integration task-check path (run paths + display) never consulted exceptions, so an excepted finding was hidden in one surface but kept failing the task in another.Fix — one source of truth, applied everywhere a finding becomes pass/fail
This is the scalable part: the exception key format + active-filter now live in one place, so a future change can't honor an exception in one surface and miss another.
ActiveExceptionSet/loadActiveExceptionSet(cloud-security/finding-exceptions.ts) — the single definition of "is this finding excepted?" (keyed byconnectionId :: checkId :: resourceId, active = not revoked / not expired).countEffectiveFailures+decideTaskStatus, so a task whose only failures are excepted goes done — identical logic in both paths.getTaskCheckRuns): excepted results are flagged (excepted: true) and dropped from the run'sfailedCount/status; the UI renders them as a muted "Exception" row instead of a red issue.Safety
IntegrationCheckResult.passedand the persisted run counts stay raw (audit intact); exceptions only affect derived status + display.integrationLastRunAt→ retry next tick), not a compliance failure.Verification
getTaskCheckRunsflags excepted + drops it from the failed count).Notes
@trycompai/uiBadge(didn't migrate the whole legacy file — out of scope).🤖 Generated with Claude Code
Summary by cubic
Fixes task checks to honor finding exceptions across manual runs, scheduled runs, and the UI. Excepted findings no longer fail tasks, and status/display are consistent while keeping real execution errors visible.
Bug Fixes
Refactors
ActiveExceptionSet/loadActiveExceptionSetas the single source of truth; Cloud Tests now use it too.countEffectiveFailuresanddecideTaskStatusused by both run paths.Written for commit bd1b774. Summary will update on new commits.