fix(engine): allow excluding OpenAPI queries by their override (version-specific) IDs#7977
Open
cx-ori-bendet wants to merge 1 commit intomasterfrom
Open
fix(engine): allow excluding OpenAPI queries by their override (version-specific) IDs#7977cx-ori-bendet wants to merge 1 commit intomasterfrom
cx-ori-bendet wants to merge 1 commit intomasterfrom
Conversation
…on-specific) IDs OpenAPI queries define version-specific variants via an "override" field in metadata.json (e.g. a Swagger 2.0 variant of an OpenAPI 3.0 query). These variants have their own IDs which are reported in scan results, but checkQueryExclude only checked the primary metadata "id", so passing an override ID to --exclude-queries had no effect. Extend checkQueryExclude to also iterate the "override" map and check each variant's "id" against the ByIDs exclusion list. Fixes #7574 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
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.








Summary
"override"field inmetadata.json(e.g. a Swagger 2.0 variant with a different ID than the OpenAPI 3.0 primary query)checkQueryExcludeonly compared against the top-levelmetadata["id"]--exclude-querieshad no effect, making it impossible to suppress findings for those queriescheckQueryExcludeto also iterate throughmetadata["override"]and check each version variant's"id"against theByIDsexclusion listExample — for a query with this metadata:
{ "id": "e3f026e8-fdb4-4d5a-bcfd-bd94452073fe", "override": { "2.0": { "id": "6e96ed39-bf45-4089-99ba-f1fe7cf6966f" } } }Both
e3f026e8-...and6e96ed39-...can now be used with--exclude-queries.Fixes #7574
Test plan
swagger.jsonfile that triggers one of the affected queries (e.g.6e96ed39-bf45-4089-99ba-f1fe7cf6966f)--exclude-queries 6e96ed39-bf45-4089-99ba-f1fe7cf6966fand verify the query is excluded from resultse3f026e8-fdb4-4d5a-bcfd-bd94452073fe— should still be excluded (existing behaviour preserved)go test ./pkg/engine/source/...to verify existing tests passI submit this contribution under the Apache-2.0 license.
🤖 Generated with Claude Code