Skip to content

Commit efb4e98

Browse files
kabirclaude
andauthored
fix!: enforce fail-closed default for task authorization (a2aproject#1095)
Move authorization from the CDI-only AuthorizationRequestHandlerDecorator directly into DefaultRequestHandler so it is enforced on both the CDI and builder paths. When no TaskAuthorizationProvider is configured, all task operations are now denied by default (fail-closed). Set a2a.authorization.required=false to restore the previous open behavior for single-user deployments or testing. BREAKING CHANGE: Applications without a TaskAuthorizationProvider will now reject all task operations. Either provide a provider or set a2a.authorization.required=false. Ref: GHSA-qw47-mcm5-934w Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8882710 commit efb4e98

40 files changed

Lines changed: 676 additions & 857 deletions

File tree

‎compat-0.3/reference/grpc/src/test/resources/application.properties‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ quarkus.arc.selected-alternatives=org.a2aproject.sdk.compat03.conversion.TestHtt
2525
quarkus.log.category."org.a2aproject.sdk.server.events".level=DEBUG
2626
quarkus.log.category."org.a2aproject.sdk.server.requesthandlers".level=DEBUG
2727
quarkus.log.category."org.a2aproject.sdk.server.tasks".level=DEBUG
28+
29+
# Authorization is not configured in test profiles
30+
a2a.authorization.required=false

‎compat-0.3/reference/jsonrpc/src/test/resources/application.properties‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ quarkus.log.category."org.a2aproject.sdk.server.tasks".level=DEBUG
1717
%test.quarkus.test-security.test-enabled=true
1818
%test.quarkus.test-security.user=testuser
1919
%test.quarkus.test-security.roles=user
20+
21+
# Authorization is not configured in test profiles
22+
a2a.authorization.required=false

‎compat-0.3/reference/rest/src/test/resources/application.properties‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ quarkus.log.category."org.a2aproject.sdk.server.tasks".level=DEBUG
2525
quarkus.test.security.auth.enabled=true
2626
quarkus.test.security.default-user=testuser
2727
quarkus.test.security.default-roles=user
28+
29+
# Authorization is not configured in test profiles
30+
a2a.authorization.required=false

‎compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/AbstractA2ARequestHandlerTest_v0_3.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ public void cancel(RequestContext context, AgentEmitter agentEmitter) throws A2A
147147
.mainEventBusProcessor(mainEventBusProcessor)
148148
.executor(internalExecutor)
149149
.eventConsumerExecutor(internalExecutor)
150+
.authorizationRequired(false)
150151
.build();
151152

152153
// Wrap in v0.3 conversion handler

‎compat-0.3/tck/src/main/resources/application.properties‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ quarkus.log.file.enable=true
1818
quarkus.log.file.path=target/tck-test.log
1919
quarkus.log.file.level=DEBUG
2020
quarkus.log.console.level=INFO
21+
22+
# Authorization is not configured in this application
23+
a2a.authorization.required=false

‎compat-0.3/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCHandler_v0_3_Test.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,7 @@ public void testOnGetPushNotificationNoPushNotifierConfig() {
865865
.mainEventBusProcessor(mainEventBusProcessor)
866866
.executor(internalExecutor)
867867
.eventConsumerExecutor(internalExecutor)
868+
.authorizationRequired(false)
868869
.build();
869870

870871
// Wrap in v0.3 conversion handler
@@ -897,6 +898,7 @@ public void testOnSetPushNotificationNoPushNotifierConfig() {
897898
.mainEventBusProcessor(mainEventBusProcessor)
898899
.executor(internalExecutor)
899900
.eventConsumerExecutor(internalExecutor)
901+
.authorizationRequired(false)
900902
.build();
901903

902904
// Wrap in v0.3 conversion handler
@@ -969,6 +971,7 @@ public void testDeletePushNotificationConfigNoPushConfigStore() {
969971
.mainEventBusProcessor(mainEventBusProcessor)
970972
.executor(internalExecutor)
971973
.eventConsumerExecutor(internalExecutor)
974+
.authorizationRequired(false)
972975
.build();
973976

974977
// Wrap in v0.3 conversion handler

‎docs/content/dev/authorization.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ layout: page
66

77
# Task Authorization
88

9-
> **Security note:** For multi-user deployments, a `TaskAuthorizationProvider` **must** be configured. Without one, all operations are permitted regardless of authentication — any authenticated user can read, modify, or cancel any task. Production deployments should use a fail-closed ownership policy (deny access when ownership is unknown).
9+
> **Security note:** By default, all task operations are **denied** when no `TaskAuthorizationProvider` is configured (fail-closed). This ensures multi-user deployments cannot accidentally expose tasks. For single-user deployments or testing where authorization is not needed, set `a2a.authorization.required=false` in your configuration, or call `.authorizationRequired(false)` on the builder. Production deployments should always configure a provider with a fail-closed ownership policy (deny access when ownership is unknown).
1010
1111
## Implementing TaskAuthorizationProvider
1212

@@ -45,9 +45,7 @@ public class MyTaskAuthorizationProvider implements TaskAuthorizationProvider {
4545
}
4646
```
4747

48-
The SDK discovers the bean via CDI automatically — no additional wiring needed.
49-
50-
> **Note:** When task authorization is required, always obtain `RequestHandler` through CDI injection. Manual instantiation via `DefaultRequestHandler.create()` bypasses the `AuthorizationRequestHandlerDecorator` and all authorization checks.
48+
The SDK discovers the bean via CDI automatically — no additional wiring needed. Authorization is also enforced when using `DefaultRequestHandler.builder()` directly — pass the provider via `.authorizationProvider(provider)`.
5149

5250
## User Identity in ServerCallContext
5351

‎docs/content/dev/configuration.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ a2a.request-context.populate-referred-tasks=true
6565

6666
When enabled, task IDs referenced in incoming messages are looked up in the `TaskStore` and made available to the `AgentExecutor` via `RequestContext.getRelatedTasks()`. This is useful for multi-task conversations where the agent needs access to state from related tasks. Enabled by default; set to `false` to avoid extra `TaskStore` lookups when not needed.
6767

68+
### Authorization
69+
70+
```properties
71+
# Require a TaskAuthorizationProvider to be configured (default: true)
72+
# When true, all task operations are denied if no provider is present (fail-closed).
73+
# Set to false for single-user deployments or testing where authorization is not needed.
74+
a2a.authorization.required=true
75+
```
76+
77+
See [Task Authorization](authorization.md) for details on implementing a `TaskAuthorizationProvider`.
78+
6879
### Push Notification Config Store
6980

7081
```properties

‎examples/cloud-deployment/server/src/main/resources/application.properties‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,6 @@ quarkus.log.console.format=%d{HH:mm:ss} %-5p [%c{2.}] (%t) %s%e%n
4848

4949
# Health checks
5050
quarkus.smallrye-health.root-path=/health
51+
52+
# Authorization is not configured in this application
53+
a2a.authorization.required=false

‎examples/helloworld/server/src/main/resources/application.properties‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ quarkus.observability.lgtm.grafana-port=3001
99
quarkus.observability.lgtm.otel-grpc-port=5317
1010
quarkus.observability.lgtm.otel-http-port=5318
1111
#quarkus.otel.exporter.otlp.endpoint=http://localhost:4317
12-
#quarkus.log.console.format=%d{HH:mm:ss} %-5p traceId=%X{traceId}, parentId=%X{parentId}, spanId=%X{spanId}, sampled=%X{sampled} [%c{2.}] (%t) %s%e%n
12+
#quarkus.log.console.format=%d{HH:mm:ss} %-5p traceId=%X{traceId}, parentId=%X{parentId}, spanId=%X{spanId}, sampled=%X{sampled} [%c{2.}] (%t) %s%e%n
13+
# Authorization is not configured in this application
14+
a2a.authorization.required=false

0 commit comments

Comments
 (0)