Skip to content

fix(cloud-security): allow empty filterPattern for PutMetricFilter validation#3052

Merged
tofikwest merged 1 commit into
mainfrom
tofik/metric-filter-empty-pattern
Jun 5, 2026
Merged

fix(cloud-security): allow empty filterPattern for PutMetricFilter validation#3052
tofikwest merged 1 commit into
mainfrom
tofik/metric-filter-empty-pattern

Conversation

@tofikwest
Copy link
Copy Markdown
Contributor

@tofikwest tofikwest commented Jun 5, 2026

Summary

Follow-up to a cubic review on #3050. #3050 added PutMetricFilterCommand to the executor's REQUIRED_PARAMS with filterPattern included — but that list rejects empty strings (via hasRequiredParamValue), while AWS allows an empty filterPattern (min length 0; an empty pattern matches all log events). The parameter must be present, but its value may be "".

Verification

AWS PutMetricFilter API docsfilterPattern minimum length is 0, so "" is valid; the field is required to be supplied.

Fix

  • Move filterPattern out of REQUIRED_PARAMS (which rejects "") into a new REQUIRED_PRESENT_PARAMS check that only rejects a missing/null value — so "" is accepted, while a truly-omitted pattern is still caught before execution.
  • logGroupName / filterName / metricTransformations stay non-empty-required.
  • Tests: empty filterPattern is accepted; a missing one is reported via the present-check.

Impact

Low practical impact — our CIS metric-filter remediations always emit a non-empty pattern (an empty "match-all" pattern would be wrong for a CIS alarm), so this never blocked a plan we generate. It aligns the validator with AWS semantics and clears the reviewer finding.

Executor spec green (43 tests); typecheck clean.

🤖 Generated with Claude Code


Summary by cubic

Allow empty filterPattern for CloudWatch Logs PutMetricFilterCommand validation to match AWS behavior and avoid false errors. Adds a presence-only check while keeping other params strict.

  • Bug Fixes
    • Introduced REQUIRED_PRESENT_PARAMS and moved filterPattern there for PutMetricFilterCommand; accepts "" but rejects missing/null.
    • Kept logGroupName, filterName, and metricTransformations as non-empty in REQUIRED_PARAMS.
    • Added tests to ensure empty filterPattern passes and a missing one fails.

Written for commit f8f2908. Summary will update on new commits.

Review in cubic

… validation

Cubic review on #3050: PutMetricFilterCommand had `filterPattern` in
REQUIRED_PARAMS, which (via hasRequiredParamValue) rejects an empty string —
but AWS allows an empty filterPattern (min length 0; an empty pattern matches
all log events). The parameter must be PRESENT, but its value may be "".

- Move `filterPattern` out of REQUIRED_PARAMS (which also rejects "") into a new
  REQUIRED_PRESENT_PARAMS check that only rejects a missing/null value, so ""
  is accepted while a truly-omitted pattern is still caught before execution.
- logGroupName / filterName / metricTransformations stay non-empty-required.
- Tests: empty filterPattern is accepted; a missing one is reported via the
  present-check.

Low practical impact (our CIS metric-filter remediations always emit a non-empty
pattern), but aligns the validator with AWS semantics. Executor spec green (43);
typecheck clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comp-framework-editor Ready Ready Preview, Comment Jun 5, 2026 10:20pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
app Skipped Skipped Jun 5, 2026 10:20pm
portal Skipped Skipped Jun 5, 2026 10:20pm

Request Review

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@tofikwest tofikwest merged commit e4ecefb into main Jun 5, 2026
11 checks passed
@tofikwest tofikwest deleted the tofik/metric-filter-empty-pattern branch June 5, 2026 22:23
@claudfuen
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.73.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants