fix(core): validate/remove unused securitySchemes and securityDefinitions correctly#2830
fix(core): validate/remove unused securitySchemes and securityDefinitions correctly#2830tatomyr wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 10890ac The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
f9e0615 to
91e2f41
Compare
|
@cursor review |
|
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1779373140 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1779373140
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1779373140
# or
npm install @redocly/respect-core@0.0.0-snapshot.1779373140 |
91e2f41 to
25d2099
Compare
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1779448714 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1779448714
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1779448714
# or
npm install @redocly/respect-core@0.0.0-snapshot.1779448714 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 25d2099. Configure here.
| reference: 'https://redocly.com/docs/cli/rules/oas/no-unused-components', | ||
| }); | ||
| } | ||
| }, |
There was a problem hiding this comment.
Early unused scheme reporting
Medium Severity
The no-unused-components rule reports security schemes as unused too early. It flags them when visiting NamedSecuritySchemes, before all security blocks (like those in x-webhooks or components.pathItems) are processed, leading to false positives.
Reviewed by Cursor Bugbot for commit 25d2099. Configure here.
25d2099 to
10890ac
Compare


What/Why/How?
no-unused-componentsrule to validate unused security schemesremove-unused-componentsdecorator to remove unused security schemes (fixed in Swagger 2.0; added in OAS 3.x)Reference
Resolves #944
Testing
Internal tests passed: https://github.com/Redocly/redocly/pull/23392
Screenshots (optional)
Check yourself
Security
Note
Medium Risk
Changes
remove-unused-componentsbundling behavior andno-unused-componentslint output for security schemes, which may remove additional components and introduce new warnings in existing specs.Overview
Extends unused-component handling to security schemes:
remove-unused-componentsnow treatssecurityrequirements as usage and will remove truly unusedsecuritySchemes(OAS3) andsecurityDefinitions(OAS2), including transitive/derived schemes.Updates the
no-unused-componentsrule to also warn on unusedcomponents.securitySchemes, and refreshes docs/changesets and e2e snapshots to reflect the new warnings and potentially more aggressive pruning.Reviewed by Cursor Bugbot for commit 10890ac. Bugbot is set up for automated code reviews on this repo. Configure here.