Skip to content

api: add the Gateway API and manifest validation - #567

Merged
yongruilin merged 2 commits into
google:mainfrom
yongruilin:gateway-api
Nov 11, 2026
Merged

yongruilin merged 2 commits into
google:mainfrom
yongruilin:gateway-api

Conversation

@yongruilin

@yongruilin yongruilin commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

API for the Gateway resource (part of #549). Nothing is served yet: ax apply does not accept kind: Gateway, and ax-server rejects a task that sets spec.gateway.

  • gateway.proto, the Gateway RPCs, and TaskSpec.gateway. spec.egress is Agent Substrate's EgressRule, so make generate links the Substrate module for buf.
  • ValidateGateway requires one kind per rule and rejects *, localhost, IP addresses, credentials outside exact https hosts, and passthrough rules without ports. Substrate validates the rest.
  • Hostnames inside the cluster are allowed, as in Substrate. A name check cannot tell where a name resolves, so protecting AX's own services is left to a NetworkPolicy and Security: ax-server control plane has no authentication or authorization (cross-tenant read, task hijack, forced teardown) #376.
  • Gateway section in docs/manifests.md.

Follow-ups: (1) store, server, and CLI; (2) enforcement through the actor's Substrate EgressPolicy, with E2E.

@yongruilin
yongruilin requested a review from rakyll November 10, 2026 23:47
@yongruilin

yongruilin commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator Author

hold for #566

@yongruilin

Copy link
Copy Markdown
Collaborator Author

hold for #566

Rebased on #566 . Ready for review.

spec.egress is Agent Substrate's EgressRule, so make generate links
the Substrate protos from the Go module cache for buf.

Part of google#549.
Comment thread internal/apivalidation/gateway.go Outdated
)

// ValidateGateway reports the first problem with a gateway that would make it
// unusable. Agent Substrate checks the rest of each egress rule.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: When does the substrate check the egress? During actor creation? If yes, can we make it clear here about the lifecycle because the our validation blocks the bad input before real actor creation while the substrate not?

@yongruilin yongruilin Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Substrate checks when the rules are written to the Task actor's EgressPolicy, at Task creation; the ValidateGateway runs earlier, when the Gateway is applied (wired in the follow-up PR).
I actually thought of validating everything Substrate validates but found it too heavy, I would prefer we can have a way to directly utilize Substrate's validators if possible. I updated the comments and left a TODO.

@YoyinZyc

Copy link
Copy Markdown
Collaborator

Lgtm overall with the small nit above

@mayawang mayawang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, really nice that it reuses Substrate's EgressRule directly. One doc nit: credential injection 403s unless the task's atespace is granted the secret's namespace in Substrate's credential-provider namespace policy (default deny). Worth a line in the "Injecting credentials" section so first-timers don't hit a mystery 403.

Add the Gateway YAML mapping, docs, and admission checks for egress
rules. ax-server rejects spec.gateway until Gateways are served.

Part of google#549.
@yongruilin

Copy link
Copy Markdown
Collaborator Author

LGTM, really nice that it reuses Substrate's EgressRule directly. One doc nit: credential injection 403s unless the task's atespace is granted the secret's namespace in Substrate's credential-provider namespace policy (default deny). Worth a line in the "Injecting credentials" section so first-timers don't hit a mystery 403.

Thanks! Good catch, I've added a line to "Injecting credentials".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants