Skip to content

Commit e162c0c

Browse files
mikeas1holtskinner
andauthored
feat!: Add mTLS to SecuritySchemes, add oauth2 metadata url field, allow Skills to specify Security (#901)
# Description This PR makes changes to our security representations in AgentCards: 1. Adds a new MutualTLSSecurityScheme type for indicating mTLS connection requirements. This matches the same field in the OpenAPI specification v3.1. This type is pretty lacking: there is no way to indicate any requirements on the certificate that is presented by the client. I expect we'll want to extend this in the future (for example, we may want to allow an agent to indicate that a SPIFFE certificate must be presented). For now, users are advised to put requirements in the description field. 2. Adds a field for specifying a URL for OAuth2 provider metadata. This is planned for OpenAPI Specification v3.2, which has not yet been released. This allows clients to fetch additional information about the OAuth provider, such as to discover if they support Dynamic Client Registration. 3. Allows AgentSkills to specify a `security` field. This allows agents to indicate security requirements for leveraging a particular skill. I also clarified the usage and expectations for the `security` field in the base AgentCard. This change is marked backwards incompatible due to the addition of the MutualTLSSecurityScheme, which adds a new type to an exhaustive enum (the security scheme `anyOf`). Release-As: 0.3.0 --------- Co-authored-by: Holt Skinner <[email protected]> Co-authored-by: Holt Skinner <[email protected]>
1 parent 6fb2b77 commit e162c0c

File tree

4 files changed

+120
-2
lines changed

4 files changed

+120
-2
lines changed

.github/actions/spelling/allow.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ notif
214214
npush
215215
objc
216216
octicons
217+
oidc
217218
ollama
218219
oneof
219220
oreilly

specification/grpc/a2a.proto

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,18 @@ message AgentCard {
372372
map<string, SecurityScheme> security_schemes = 8;
373373
// protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
374374
// Security requirements for contacting the agent.
375+
// This list can be seen as an OR of ANDs. Each object in the list describes
376+
// one possible set of security requirements that must be present on a
377+
// request. This allows specifying, for example, "callers must either use
378+
// OAuth OR an API Key AND mTLS."
379+
// Example:
380+
// security {
381+
// schemes { key: "oauth" value { list: ["read"] } }
382+
// }
383+
// security {
384+
// schemes { key: "api-key" }
385+
// schemes { key: "mtls" }
386+
// }
375387
repeated Security security = 9;
376388
// protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
377389
// The set of interaction modes that the agent supports across all skills.
@@ -451,6 +463,12 @@ message AgentSkill {
451463
repeated string input_modes = 6;
452464
// Possible output modalities produced
453465
repeated string output_modes = 7;
466+
// protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
467+
// Security schemes necessary for the agent to leverage this skill.
468+
// As in the overall AgentCard.security, this list represents a logical OR of
469+
// security requirement objects. Each object is a set of security schemes
470+
// that must be used together (a logical AND).
471+
repeated Security security = 8;
454472
}
455473

456474
// AgentCardSignature represents a JWS signature of an AgentCard.
@@ -487,6 +505,7 @@ message SecurityScheme {
487505
HTTPAuthSecurityScheme http_auth_security_scheme = 2;
488506
OAuth2SecurityScheme oauth2_security_scheme = 3;
489507
OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4;
508+
MutualTlsSecurityScheme mtls_security_scheme = 5;
490509
}
491510
}
492511

@@ -518,6 +537,9 @@ message OAuth2SecurityScheme {
518537
string description = 1;
519538
// An object containing configuration information for the flow types supported
520539
OAuthFlows flows = 2;
540+
// URL to the oauth2 authorization server metadata
541+
// [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
542+
string oauth2_metadata_url = 3;
521543
}
522544

523545
message OpenIdConnectSecurityScheme {
@@ -528,6 +550,11 @@ message OpenIdConnectSecurityScheme {
528550
string open_id_connect_url = 2;
529551
}
530552

553+
message MutualTlsSecurityScheme {
554+
// Description of this security scheme.
555+
string description = 1;
556+
}
557+
531558
message OAuthFlows {
532559
oneof flow {
533560
AuthorizationCodeOAuthFlow authorization_code = 1;

specification/json/a2a.json

Lines changed: 61 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

types/src/types.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ export type SecurityScheme =
6666
| APIKeySecurityScheme
6767
| HTTPAuthSecurityScheme
6868
| OAuth2SecurityScheme
69-
| OpenIdConnectSecurityScheme;
69+
| OpenIdConnectSecurityScheme
70+
| MutualTLSSecurityScheme;
7071
// --8<-- [end:SecurityScheme]
7172

7273
// --8<-- [start:SecuritySchemeBase]
@@ -114,6 +115,16 @@ export interface HTTPAuthSecurityScheme extends SecuritySchemeBase {
114115
}
115116
// --8<-- [end:HTTPAuthSecurityScheme]
116117

118+
// --8<-- [start:MutualTLSSecurityScheme]
119+
/**
120+
* Defines a security scheme using mTLS authentication.
121+
*/
122+
export interface MutualTLSSecurityScheme extends SecuritySchemeBase {
123+
/** The type of the security scheme. Must be 'mutualTLS'. */
124+
readonly type: "mutualTLS";
125+
}
126+
// --8<-- [end:MutualTLSSecurityScheme]
127+
117128
// --8<-- [start:OAuth2SecurityScheme]
118129
/**
119130
* Defines a security scheme using OAuth 2.0.
@@ -123,6 +134,11 @@ export interface OAuth2SecurityScheme extends SecuritySchemeBase {
123134
readonly type: "oauth2";
124135
/** An object containing configuration information for the supported OAuth 2.0 flows. */
125136
flows: OAuthFlows;
137+
/**
138+
* URL to the oauth2 authorization server metadata
139+
* [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
140+
*/
141+
oauth2MetadataUrl?: string;
126142
}
127143
// --8<-- [end:OAuth2SecurityScheme]
128144

@@ -283,6 +299,15 @@ export interface AgentSkill {
283299
* The set of supported output MIME types for this skill, overriding the agent's defaults.
284300
*/
285301
outputModes?: string[];
302+
/**
303+
* Security schemes necessary for the agent to leverage this skill.
304+
* As in the overall AgentCard.security, this list represents a logical OR of security
305+
* requirement objects. Each object is a set of security schemes that must be used together
306+
* (a logical AND).
307+
*
308+
* @TJS-examples [[{"google": ["oidc"]}]]
309+
*/
310+
security?: { [scheme: string]: string[] }[];
286311
}
287312
// --8<-- [end:AgentSkill]
288313

@@ -415,6 +440,11 @@ export interface AgentCard {
415440
/**
416441
* A list of security requirement objects that apply to all agent interactions. Each object
417442
* lists security schemes that can be used. Follows the OpenAPI 3.0 Security Requirement Object.
443+
* This list can be seen as an OR of ANDs. Each object in the list describes one possible
444+
* set of security requirements that must be present on a request. This allows specifying,
445+
* for example, "callers must either use OAuth OR an API Key AND mTLS."
446+
*
447+
* @TJS-examples [[{"oauth": ["read"]}, {"api-key": [], "mtls": []}]]
418448
*/
419449
security?: { [scheme: string]: string[] }[];
420450
/**

0 commit comments

Comments
 (0)