Skip to content

fix(cmd): reject malformed subscribe filters#3942

Closed
Elvand-Lie wants to merge 1 commit into
knative:mainfrom
Elvand-Lie:fix-subscribe-filter-validation
Closed

fix(cmd): reject malformed subscribe filters#3942
Elvand-Lie wants to merge 1 commit into
knative:mainfrom
Elvand-Lie:fix-subscribe-filter-validation

Conversation

@Elvand-Lie

Copy link
Copy Markdown
Contributor

Fixes #3941

Why

func subscribe --filter currently prints malformed filter values and continues, which can write a subscription without the intended filter.

What changed

  • return an error for malformed --filter values
  • preserve valid filter values containing =
  • add regression tests for both paths

Testing

  • gofmt -w cmd/subscribe.go cmd/subscribe_test.go
  • git diff --check
  • Added regression tests in cmd/subscribe_test.go

Note: focused go test ./cmd -run 'TestSubscribe(RejectsMalformedFilter|AllowsFilterValuesContainingEquals)' -count=1 -v was attempted locally on Windows but timed out before package output. CI should run the tests normally.

@knative-prow knative-prow Bot requested review from dsimansk and jrangelramos July 5, 2026 12:09
@knative-prow

knative-prow Bot commented Jul 5, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Elvand-Lie
Once this PR has been reviewed and has the lgtm label, please assign lkingland for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow Bot added the size/M 🤖 PR changes 30-99 lines, ignoring generated files. label Jul 5, 2026
@knative-prow

knative-prow Bot commented Jul 5, 2026

Copy link
Copy Markdown

Hi @Elvand-Lie. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@knative-prow knative-prow Bot added the needs-ok-to-test 🤖 Needs an org member to approve testing label Jul 5, 2026
@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.92%. Comparing base (89a927f) to head (6c466fd).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3942      +/-   ##
==========================================
+ Coverage   51.97%   53.92%   +1.95%     
==========================================
  Files         203      203              
  Lines       23807    23806       -1     
==========================================
+ Hits        12374    12838     +464     
+ Misses      10281     9739     -542     
- Partials     1152     1229      +77     
Flag Coverage Δ
e2e 34.14% <42.85%> (-0.02%) ⬇️
e2e go ?
e2e node ?
e2e python ?
e2e quarkus ?
e2e rust ?
e2e springboot ?
e2e typescript ?
e2e-config-ci ?
integration 15.65% <0.00%> (?)
unit macos-14 43.34% <100.00%> (+0.01%) ⬆️
unit macos-latest 43.34% <100.00%> (+0.01%) ⬆️
unit ubuntu-24.04-arm 43.63% <100.00%> (+0.01%) ⬆️
unit ubuntu-latest 44.19% <100.00%> (+0.01%) ⬆️
unit windows-latest 43.38% <100.00%> (+0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

@Elvand-Lie Elvand-Lie closed this Jul 5, 2026
@Elvand-Lie Elvand-Lie deleted the fix-subscribe-filter-validation branch July 5, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test 🤖 Needs an org member to approve testing size/M 🤖 PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cmd: subscribe silently ignores malformed --filter values

1 participant