Skip to content

fix: inherit root-level OpenAPI security requirements - #1157

Merged
mrin9 merged 1 commit into
rapi-doc:masterfrom
falemagn:fix/security-inheritance
Oct 14, 2026
Merged

mrin9 merged 1 commit into
rapi-doc:masterfrom
falemagn:fix/security-inheritance

Conversation

@falemagn

@falemagn falemagn commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Problem

Operations that inherit root-level OpenAPI security are shown as not requiring
authentication. Their Try requests omit the configured credentials because
groupByTags() copies only the operation-level declaration.

Observed with npm rapidoc@10.1.0 and confirmed in current master.

Fix

Use pathOrHookObj.security ?? openApiSpec.security when grouping operations.
Explicit operation overrides remain unchanged, including security: [] for
public operations and an empty object permitting optional authentication.
If neither level declares security, the existing behavior is preserved.

This follows the OpenAPI Operation Object security contract.

Tests

Five parser regression cases cover inherited requirements, public operations,
overrides, optional authentication and absent requirements. The inheritance case
fails on unpatched master and passes with the fix.

All 129 unit tests pass:

node --test --test-isolation=none tests/unit/*.test.js

The isolation flag is used for the local sandbox; tests use the existing Node
test framework and are included by the standard test:unit glob. Dependencies
were reused from an existing installation. A full production build was not run.

Use root-level security when an operation has no declaration, so the request console sends configured credentials for inherited requirements. Preserve explicit overrides, public operations and optional authentication.

Add parser regression tests for inheritance, overrides and absent requirements.
@mrin9
mrin9 merged commit 0bde1f3 into rapi-doc:master Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants