Skip volatile config items when timestamp parsing fails - #3486
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughVolatile criteria and matchers now accept RFC3339 and date-only timestamps. Missing bounds use the effective time. Invalid supplied timestamps skip criteria or deactivate matchers. ChangesVolatile time validation
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
🤖 Finished Review · ✅ Success · Started 12:52 PM UTC · Completed 1:06 PM UTC Commit: |
PR Summary by QodoFail-close volatile timestamp parsing for volatile criteria/matchers
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/evaluator/criteria.go`:
- Around line 199-201: Update computeIncludeExclude to track when a volatile
include criterion is invalid in the error branches around the existing “skipping
volatile criteria” warnings, and suppress the later "*" fallback when no valid
include remains but an invalid volatile include was encountered. Preserve
wildcard fallback for other empty-include cases, and add an integration test
exercising computeIncludeExclude with only an invalid volatile include
criterion.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: 43a053b7-9696-4518-92f8-1186242e55e6
📒 Files selected for processing (4)
internal/evaluator/criteria.gointernal/evaluator/criteria_test.gointernal/policy/equivalence/equivalence.gointernal/policy/equivalence/equivalence_test.go
Code Review by Qodo
1.
|
ReviewFindingsMedium
Low
Previous runReviewFindingsLow
Previous run (2)ReviewFindingsMedium
Low
Labels: PR fixes a fail-open bypass where garbage timestamps in volatile criteria permanently suppressed policy rules Previous run (3)ReviewFindingsMedium
Labels: PR fixes a fail-open security bug in volatile config timestamp parsing |
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
collectVolatileConfigItems and isVolatileMatcherActive both defaulted
to the effective time on parse failure. The resulting time window check
always passed, so any volatile exclude with garbage timestamps
permanently suppressed its targeted rule. Since --strict only checks
failures and excludes suppress failures from the report, this was a
full bypass.
Add parseVolatileTime: tries RFC3339, then date-only ("2006-01-02"),
then rejects. On failure, log a warning and skip the item in
collectVolatileConfigItems (continue) or treat it as inactive in
isVolatileMatcherActive (return false). Follows the existing fallback
pattern in policy.ParseEffectiveTime.
Update the existing "invalid time formats" test to assert fail-closed
behavior. Add test cases for garbage timestamps, date-only fallback,
and mixed valid/invalid fields in both packages.
Ref: https://issues.redhat.com/browse/EC-1911
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🤖 Finished Review · ✅ Success · Started 2:22 PM UTC · Completed 2:36 PM UTC Commit: |
|
🤖 Review · Commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/evaluator/criteria_test.go`:
- Line 1147: Run the repository’s configured Go formatter on criteria_test.go
and retain its output, including the formatting correction reported near line
1147, so the file passes static analysis.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: c65c8490-69c6-4b6a-9c06-ae980ac8ede5
📒 Files selected for processing (6)
internal/evaluator/criteria.gointernal/evaluator/criteria_test.gointernal/policy/equivalence/equivalence.gointernal/policy/equivalence/equivalence_test.gointernal/timeutil/timeutil.gointernal/timeutil/timeutil_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
- internal/policy/equivalence/equivalence_test.go
- internal/policy/equivalence/equivalence.go
- internal/evaluator/criteria.go
|
🤖 Finished Review · ✅ Success · Started 3:04 PM UTC · Completed 3:16 PM UTC Commit: |
|
🤖 Review · Commit: |
Consolidates the duplicated helper into a single exported ParseVolatileTime in internal/timeutil, stdlib-only. Drops the internal/policy import from equivalence.go (was pulling in cosign/k8s/yaml transitively just for a date format constant). Adds //go:build unit tag to equivalence_test.go. Ref: https://issues.redhat.com/browse/EC-1911 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🤖 Finished Review · ✅ Success · Started 3:29 PM UTC · Completed 3:47 PM UTC Commit: |
collectVolatileConfigItems and isVolatileMatcherActive both defaulted
to the effective time on parse failure. The resulting time window check
always passed, so any volatile exclude with garbage timestamps
permanently suppressed its targeted rule. Since
--strictonly checksfailures and excludes suppress failures from the report, this was a
full bypass.
Add
parseVolatileTime: tries RFC3339, then date-only ("2006-01-02"),then rejects. On failure, log a warning and skip the item in
collectVolatileConfigItems(continue) or treat it as inactive inisVolatileMatcherActive(return false). Follows the existingfallback pattern in
policy.ParseEffectiveTime.Update the existing "invalid time formats" test to assert fail-closed
behavior. Add test cases for garbage timestamps, date-only fallback,
and mixed valid/invalid fields in both packages.
Ref: https://issues.redhat.com/browse/EC-1911
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com