Repository navigation
Description
Problem
OpenapiAsyncapiOptionsConfigAdapter fully round-trips options.specs.asyncapi.<name>.security (a scheme-name → guard-name map, same shape as the openapi side) into AsyncapiSpecificationConfig.security. The schema (openapi.asyncapi.schema.patch.json) declares it as a legitimate operator-facing property.
However, nothing in binding-openapi-asyncapi ever reads it:
OpenapiAsyncapiCompositeGenerator.generate()now threadsasyncapiSpec.securityintoAsyncapiSchemaConfig(fixed alongside Follow-up: consolidate remaining options.* abstraction leaks in openapi/asyncapi #2113 as parity with the siblingsecurityplumbing), but that's as far as it goes.OpenapiAsyncapiProxyGenerator.resolveGuarded()— the only place that resolves a route's guard — only ever combinesoperation.security(the OpenAPI operation) withschema.security(the OpenAPI spec's scheme map). It never looks at the AsyncAPI/Kafka side'ssecurityorAsyncapiOperationView.securityat all.
So an operator can configure options.specs.asyncapi.<name>.security, see it validate against the schema, and it will silently do nothing — the same "declared but inert" pattern the #2113 cleanup targeted elsewhere.
Why this isn't a small wiring fix
Unlike the other #2113 findings, there's no direct place to "just wire it in": OpenapiGuardResolver.resolve() explicitly rejects combining more than one distinct guard on a single route —
"operation "%s" in spec "%s" requires multiple distinct guards (...) simultaneously, which is not supported because Zilla guards cannot be combined with AND semantics"
binding-openapi-asyncapi's http-kafka proxy route only has one guarded() attachment point (governing the inbound HTTP side). There's no internally-generated Kafka client/server binding in this proxy (unlike plain binding-asyncapi, which generates its own Kafka client and can attach Kafka-side security to it directly) — so there's no natural second attachment point for a Kafka-side guard either.
Options worth discussing:
- Treat the asyncapi-side
securityas a fallback/default only when the OpenAPI operation itself declares no security (mirroring how OpenAPI's own spec-levelsecurityis a fallback for operations that don't declare their own) — same guard, no AND-combination. - Deny the route at generation time if the openapi-resolved guard and the asyncapi-resolved guard disagree, surfacing a clear config error instead of silently ignoring one side.
- Remove
securitysupport for asyncapi specs from this binding's schema/adapter entirely, since there's currently no coherent semantics for it in a proxy binding with a single guard attachment point.
Scope note
Filed separately from #2113 / PR #2128 (which fixes the openapi-asyncapi overlay-bypass and the parity gap in AsyncapiSchemaConfig construction) since this needs a design decision, not a mechanical fix.
Activity
feat(binding-openapi-asyncapi): apply Overlay to both openapi and asy…
[-]binding-openapi-asyncapi: options.specs.asyncapi.<name>.security is accepted but never consumed[/-][+]binding-openapi-asyncapi: options.specs.asyncapi.<name>.security is accepted but never consumed[/+]fix(binding-asyncapi,binding-openapi,binding-openapi-asyncapi,binding…
jfallows commentedon Jul 13, 2026
Traced the code to ground the three options before picking one:
OpenapiAsyncapiProxyGenerator.resolveGuarded()(HttpKafkaBindingsHelper) only ever callsOpenapiGuardResolver.resolve(operation.id, schema.specLabel, operation.security, schema.security, ...)— openapi operation + openapi spec map. ThekafkaOp(AsyncapiOperationView, whose.securityis populated but never fed anywhere) is already in scope at theinjectHttpKafkaRoute()call site, so no new lookup/threading is needed to get at it — just two more parameters throughresolveGuarded/allowed.OpenapiOperationView's constructor (model.security != null ? ... : specification.security), not inOpenapiGuardResolver.OpenapiGuardResolveritself has no fallback logic — it just consumes whateveroperation.securityalready resolved to.binding-asyncapialready has a structurally identicalAsyncapiGuardResolver(same "multiple distinct guards ... AND semantics" denial, sameGuardedResolution/GuardedRefshape) with its own full unit test suite (AsyncapiGuardResolverTest). It's unused bybinding-openapi-asyncapitoday but is a ready-made tool for resolvingkafkaOp.securityagainstAsyncapiSchemaConfig.security.Given that, option 1 seems like the right call:
AsyncapiGuardResolver.resolve(kafkaOp.name, ..., kafkaOp.security, asyncapiSchema.security, ...)whenOpenapiGuardResolver.resolve(...)on the openapi side yields no guard, and use whichever result is non-empty. Both resolvers already share the samedenied/multiple distinct guardssemantics, so the combination logic doesn't need to invent anything new.If that direction sounds right, I can follow up with a test-first PR: extend
OpenapiAsyncapiProxyGeneratorTestwith an asyncapi-side-security case (today none of itsAsyncapiSpecificationConfig.builder()calls populate.security(...)), add a pairedconfig/proxy.guarded.asyncapi.yaml+streams/asyncapi/<scenario>/{client,server}.rptmirroring the existingproxy.guarded.yaml/shouldCreatePetWhenAuthorizedscaffolding, then wirekafkaOp/AsyncapiSchemaConfig.securityintoresolveGuarded()as the fallback. Let me know if you'd rather go a different direction first.Generated by Claude Code
fix(binding-openapi-asyncapi): remove asyncapi-side security instead …
fix(binding-openapi-asyncapi): remove inert asyncapi-side security in…