Repository navigation
fix(binding-openapi-asyncapi): remove inert asyncapi-side security instead of falling back to it - #2148
Merged
Conversation
…en openapi operation declares none Wires options.specs.asyncapi[].security into route guard resolution. Previously it round-tripped through the config adapter and AsyncapiSchemaConfig but resolveGuarded() never consumed it, so it validated against the schema but silently did nothing (#2133). Per the design discussion on the issue, asyncapi-side security is now used only as a fallback when the openapi operation declares no security of its own (operation.security == null) -- mirroring how openapi's own spec-level security already falls back for operations that don't declare their own. No AND-combination is introduced; the existing "multiple distinct guards" denial semantics apply on the asyncapi side via the already-existing AsyncapiGuardResolver.
…of falling back to it Supersedes the previous commit's fallback approach. Design discussion on #2133 concluded a fallback (asyncapi security applies only when the openapi operation declares none) is a poor fit for a security control: which guard actually protects a route would depend on unrelated state in a different spec document, invisible to a reviewer of either file alone. The openapi side already provides complete, working, tested inbound authorization for this proxy's single ingress point (unrelated to the Kafka client's own connection credentials, which are configured separately on the exit binding). Asyncapi-side security described the same access-control decision from a second source, so removing it loses no real capability while eliminating the redundancy. - Revert OpenapiAsyncapiProxyGenerator/OpenapiAsyncapiOptionsConfigAdapter to no longer resolve or parse asyncapi-side security. - Remove `security` from the asyncapi side of the schema patch, so configuring it now produces a clear validation error instead of silently doing nothing. - Replace the fallback-specific unit tests with a regression test proving asyncapi-side security has no effect even when set directly on the config object. Fixes #2133
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.
Description
options.specs.asyncapi[].security(a scheme-name -> guard-name map) was fully parsed byOpenapiAsyncapiOptionsConfigAdapterand threaded intoAsyncapiSchemaConfig, butOpenapiAsyncapiProxyGenerator.resolveGuarded()never consumed it — an operator could configure it, see it validate against the schema, and it would silently do nothing.Revision note: this PR originally implemented a fallback (asyncapi-side security applied only when the openapi operation declared none). Further design discussion concluded that shape is a poor fit for a security control — which guard actually protects a route would depend on unrelated state in a different spec document (an unrelated edit to the openapi file could silently change what protects a Kafka operation, invisible to a reviewer of either file alone). The current commit instead removes asyncapi-side
securitysupport entirely.The openapi side already provides complete, working, tested inbound authorization for this proxy's single HTTP ingress point — this is unrelated to the Kafka client's own connection credentials, which are configured separately (vault/SASL) on whatever binding the generated route's
exitpoints to. Asyncapi-sidesecuritydescribed the exact same access-control decision from a second source, so removing it loses no real capability while eliminating the redundancy and the "silently does nothing" trap that motivated #2133 in the first place.OpenapiAsyncapiProxyGenerator/OpenapiAsyncapiOptionsConfigAdapterno longer resolve or parse asyncapi-sidesecurity.securityfrom the asyncapi side of the JSON schema patch, so configuring it now produces a clear validation error instead of silently doing nothing.securityhas no effect on route guard resolution, even when set directly on the config object (bypassing the schema).True simultaneous enforcement of both an openapi-side and an asyncapi-side guard on one route was also considered and rejected for this PR's scope — it turns out to be blocked by a deeper limitation in how stream authorization works today (a stream carries exactly one guard-scoped session id, minted once by a single guard). That's now tracked separately in #2149 as its own cross-cutting engine design question.
Fixes #2133
Test plan
./mvnw -pl runtime/binding-openapi-asyncapi test— all unit tests pass, including the new regression test inOpenapiAsyncapiProxyGeneratorTest./mvnw -pl runtime/binding-openapi-asyncapi checkstyle:check— clean./mvnw -pl runtime/binding-openapi-asyncapi clean verify -Dit.test=OpenapiAsyncapiIT— existing integration tests pass with no regressionsadditionalProperties: falsestill governs the asyncapi per-spec object after removingsecurity