Skip to content

fix(binding-openapi-asyncapi): remove inert asyncapi-side security instead of falling back to it - #2148

Merged
jfallows merged 2 commits into
developfrom
claude/github-issue-2133-w1io1w
Jul 13, 2026
Merged

jfallows merged 2 commits into
developfrom
claude/github-issue-2133-w1io1w

Conversation

@jfallows

@jfallows jfallows commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Description

options.specs.asyncapi[].security (a scheme-name -> guard-name map) was fully parsed by OpenapiAsyncapiOptionsConfigAdapter and threaded into AsyncapiSchemaConfig, but OpenapiAsyncapiProxyGenerator.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 security support 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 exit points to. Asyncapi-side security described 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 / OpenapiAsyncapiOptionsConfigAdapter no longer resolve or parse asyncapi-side security.
  • Removed security from the asyncapi side of the JSON schema patch, so configuring it now produces a clear validation error instead of silently doing nothing.
  • Added a regression test proving asyncapi-side security has 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 in OpenapiAsyncapiProxyGeneratorTest
  • ./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 regressions
  • Confirmed the updated JSON schema patch is well-formed and additionalProperties: false still governs the asyncapi per-spec object after removing security

…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
@jfallows jfallows changed the title fix(binding-openapi-asyncapi): fall back to asyncapi-side security when openapi operation declares none fix(binding-openapi-asyncapi): remove inert asyncapi-side security instead of falling back to it Jul 13, 2026
@jfallows
jfallows merged commit 82e8775 into develop Jul 13, 2026
42 checks passed
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.

binding-openapi-asyncapi: options.specs.asyncapi.<name>.security is accepted but never consumed

2 participants