Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,11 @@ Same-org installation-wide tokens and unrestricted `repos` lists are no longer t
`repos` authorization is decided in
[ADR 0077](0077-mint-repos-scope-hardening.md). FOREIGN allowlists and `target_org`
from this ADR are unchanged.

## Later note (repo-level foreign grants)

[ADR 0083](0083-repo-level-foreign-allow-list.md) extends the FOREIGN
mechanism with repo-level `FULLSEND_FOREIGN_<ROLE>_REPOS` variables.
Repo-level grants additionally require `actions_variables: read` on the
target repos (in addition to the `organization_actions_variables: read`
needed for org-level grants from this ADR).
5 changes: 5 additions & 0 deletions docs/ADRs/0077-mint-repos-scope-hardening.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,8 @@ This revises the installation-wide and unrestricted same-org `repos` consequence
- Foreign mints cannot carry a non-empty `repos` list; installation-wide foreign tokens remain possible only with empty `repos` plus FOREIGN authorization.
- Hosted and standalone mints must set `PER_ORG_FOREIGN_COMPAT` explicitly where org-mode dispatch is required; the default is off.
- ADR 0060's earlier allowance of same-org installation-wide tokens is superseded for `repos` policy by this decision (FOREIGN mechanism unchanged).

> **Later note:** [ADR 0083](0083-repo-level-foreign-allow-list.md) relaxes
> the foreign empty-repos constraint. Cross-org requests with non-empty
> `repos` are now permitted when each target repo has a repo-level
> `FULLSEND_FOREIGN_<ROLE>_REPOS` variable authorizing the caller.
150 changes: 150 additions & 0 deletions docs/ADRs/0083-repo-level-foreign-allow-list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
---
title: "83. Repo-level foreign allow-list"
status: Accepted
relates_to:
- agent-infrastructure
- security-threat-model
topics:
- mint
- identity
- oidc
- least-privilege
- cross-org
---

# 83. Repo-level foreign allow-list

Date: 2026-08-05

## Status

Accepted

Builds on [ADR 0060](0060-cross-org-mint-authorization-via-org-variables.md)
and [ADR 0078](0078-simplified-mint-authorization-policy.md).

## Context

[ADR 0060](0060-cross-org-mint-authorization-via-org-variables.md) introduced
cross-org mint authorization via org-level `FULLSEND_FOREIGN_<ROLE>_REPOS`
variables. This works well for broad org-wide grants but has two gaps:

1. **No repo-level granularity.** Operators cannot authorize a specific caller
to mint tokens for *one* repository without authorizing them for the entire
target org. Org-level FOREIGN grants produce installation-wide tokens,
violating least privilege when only a single repo is needed.

2. **No intra-org cross-repo grants.** A per-repo caller
(`PER_REPO_WIF_REPOS`) can only mint tokens scoped to its own repository.
There is no mechanism for a per-repo caller to access another repository
in the *same* org without adding the caller's org to `ALLOWED_ORGS` (which
broadens access to all org-mode shapes) or setting up a cross-org flow
with `target_org`.

Both gaps push operators toward overly broad grants.
[ADR 0078](0078-simplified-mint-authorization-policy.md) simplified the
authorization model by removing `PER_ORG_FOREIGN_COMPAT`, making this a
clean extension point.

## Decision

### Repo-level FOREIGN variable

The same `FULLSEND_FOREIGN_<ROLE>_REPOS` variable name used at the org level
can now be set as a **repo-level** GitHub Actions variable on any target
repository. The variable format is unchanged: comma-separated list of
`org/repo` (exact `repository` match) and/or bare `org`
(`repository_owner` match).

### Cross-org with specific repos

When a cross-org request specifies non-empty `repos` (e.g.,
`repos: ["target-repo"]`), the handler authorizes **exclusively** via
per-repo FOREIGN grants — the org-level variable is not consulted:

1. Check the **repo-level** `FULLSEND_FOREIGN_<ROLE>_REPOS` on each
requested repository.
2. If **all** requested repos individually authorize the caller via their
repo-level variables, mint proceeds scoped to those repos only.
3. If any requested repo does not authorize the caller, the request is denied.

Cross-org requests with `repos: ["*"]` (installation-wide) continue to use
only the org-level variable, unchanged from ADR 0060.

### Authorization boundary

Org-level and repo-level FOREIGN grants serve distinct scopes:

- **Org-level grant** → authorizes only installation-wide tokens
(`repos: ["*"]`). Not consulted for repo-scoped requests.
- **Repo-level grant** → authorizes only the specific repos that set the
variable. Not consulted for installation-wide requests.

### Intra-org cross-repo grants

Per-repo callers (`PER_REPO_WIF_REPOS`) requesting repos other than their
own within the same org are normally denied by `validateReposScope`. With
repo-level FOREIGN variables, the handler falls back to checking repo-level
grants when the scope check fails:

1. `validateReposScope` denies the per-repo caller for requesting non-self
repos.
2. The handler checks repo-level `FULLSEND_FOREIGN_<ROLE>_REPOS` on each
requested repo.
3. If all repos authorize the caller, the scope denial is overridden and
the token is minted scoped to those repos.

This enables controlled intra-org cross-repo access without requiring the
caller's org to be in `ALLOWED_ORGS` and without changing the per-repo
caller's enrollment mode.

### Scope restriction

Repo-level grants restrict the minted token to the specific repos that set
the variable. A repo-level grant on `target-repo` does **not** authorize
access to other repos in the same org. This is the key difference from
org-level grants, which cover the entire org.

### Caching

Repo-level FOREIGN lookups use the same in-memory cache and inflight dedup
as org-level lookups, with a distinct cache key format:
`targetOrg/targetRepo/role` (vs `targetOrg/role` for org-level). Same TTL
(60 seconds), same negative caching.

### API permissions

Reading repo-level Actions variables requires `actions_variables: read`
(repo-level permission), distinct from the `organization_actions_variables:
read` used for org-level variables. The policy token for repo-level lookups
is scoped to the specific target repo.

## Consequences

- Operators can grant controlled cross-repo access at repo granularity
without installation-wide tokens.
- Repo-level FOREIGN lookups add GitHub API calls (repo installation lookup,
policy token creation, variable read) per target repo per uncached request.
Cached lookups are free.
- Roles used with repo-level FOREIGN grants need `actions_variables: read`
on their App permissions for the target repos.
- The `validateReposScope` constraint "foreign mint requires empty repos" is
relaxed: cross-org requests may now specify non-empty repos when repo-level
FOREIGN variables are set. Requests with `repos: ["*"]` continue to require
org-level authorization.
- Per-repo callers gain a new authorization path for intra-org cross-repo
access, gated by repo-level FOREIGN variables. This does not change the
default behavior (without FOREIGN variables, per-repo callers are still
restricted to their own repo).
- CLI management of FOREIGN variables (`fullsend admin foreign`) will need
updates for repo-level support (tracked separately in
[#2229](https://github.com/fullsend-ai/fullsend/issues/2229)).

### Related ADRs

| Topic | ADR |
|-------|-----|
| Cross-org mint authorization (org-level) | [0060](0060-cross-org-mint-authorization-via-org-variables.md) |
| Simplified mint authorization policy | [0078](0078-simplified-mint-authorization-policy.md) |
| Separate workflow-host allow-list | [0082](0082-workflow-host-allow-list.md) |
| Repos scope hardening | [0077](0077-mint-repos-scope-hardening.md) |
4 changes: 2 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ Identity is not the same as trust. An agent's identity lets it authenticate to e
- Credential delivery model: four tiers — (1) prefetch + post-process for agents with enumerable inputs (zero credential access), (2) OpenShell providers + L7 egress policies for static token auth (credentials never enter sandbox), (3) host-side REST server for operations providers cannot handle — long-running operations, sandbox capability gaps, credentials in request bodies, response transformation, and multi-step atomic operations (see [ADR 0046](ADRs/0046-host-side-api-server-design.md)), (4) host files + L7 policies for complex auth requiring in-sandbox credential files. L7 policies enforce both method + path and binary-level restrictions. Providers are preferred over REST servers when viable ([ADR 0017](ADRs/0017-credential-isolation-for-sandboxed-agents.md), extended by [ADR 0025](ADRs/0025-provider-credential-delivery-for-sandboxed-agents.md)).
- Host-side API server design: Credential delivery tier 3 servers follow a uniform process contract (`--port`, `--token`, `--bind-address`, `/healthz`, `/tools.json`, `SIGTERM`). Network access is controlled via composable provider profiles — atomic capability profiles composed per-harness. Per-run UUID bearer tokens are delivered through OpenShell provider placeholders. File transfer uses `openshell sandbox upload/download` ([ADR 0046](ADRs/0046-host-side-api-server-design.md)).
Comment thread
ifireball marked this conversation as resolved.
Resolved
- Per-role GitHub Apps with manifest-based creation. Each agent role gets its own app with scoped permissions. PEMs stored in Secret Manager as `fullsend-{role}-app-pem` — one secret per role, shared across orgs on a mint. `ROLE_APP_IDS` uses the same shared-per-role model (`coder` → app ID). Org isolation is enforced via `ALLOWED_ORGS`, WIF conditions, and installation verification ([ADR 0007](ADRs/0007-per-role-github-apps.md), [ADR 0033](ADRs/0033-per-repo-installation-mode.md)). Public multi-tenant mint (`ALLOWED_ORGS=*`) with upstream-only workflow provenance is defined in [ADR 0059](ADRs/0059-public-mint-mode-with-wildcard-allowlists.md); upstream-only provenance limits which workflows can call the mint, complementing [ADR 0029](ADRs/0029-central-token-mint-secretless-fullsend.md) multi-tenant blast-radius concerns.
- Cross-org mint authorization: workflows may request tokens for a different org via optional `target_org` when the target org installs the role App and sets `FULLSEND_FOREIGN_<role>_REPOS` ([ADR 0060](ADRs/0060-cross-org-mint-authorization-via-org-variables.md)).
- Mint `repos` scope: foreign mints require empty `repos` (or `["*"]` as an empty alias). Per-repo callers (repo in `PER_REPO_WIF_REPOS`) must list exactly the requesting repository. Per-org callers (org in `ALLOWED_ORGS`, repo not in `PER_REPO_WIF_REPOS`) get org-mode shapes: `.fullsend` callers may use any non-empty validated list; other callers may use `[.fullsend]` or `{self,.fullsend}`. Same-org installation-wide tokens are denied ([ADR 0077](ADRs/0077-mint-repos-scope-hardening.md), simplified in [ADR 0078](ADRs/0078-simplified-mint-authorization-policy.md)).
- Cross-org mint authorization: workflows may request tokens for a different org via optional `target_org` when the target org installs the role App and sets `FULLSEND_FOREIGN_<role>_REPOS` ([ADR 0060](ADRs/0060-cross-org-mint-authorization-via-org-variables.md)). Repo-level `FULLSEND_FOREIGN_<role>_REPOS` variables enable per-repo foreign grants (scoped to the specific target repo) and intra-org cross-repo access for per-repo callers, with disjoint authorization boundaries from org-level grants — repo-level for repo-scoped requests, org-level for installation-wide requests ([ADR 0083](ADRs/0083-repo-level-foreign-allow-list.md)).
- Mint `repos` scope: foreign mints with `repos: ["*"]` require an org-level FOREIGN grant; foreign mints with specific repos require per-repo FOREIGN grants on each requested repo (org-level grants are not consulted for repo-scoped requests). Per-repo callers (repo in `PER_REPO_WIF_REPOS`) must list exactly the requesting repository unless authorized by repo-level FOREIGN grants for other repos. Per-org callers (org in `ALLOWED_ORGS`, repo not in `PER_REPO_WIF_REPOS`) get org-mode shapes: `.fullsend` callers may use any non-empty validated list; other callers may use `[.fullsend]` or `{self,.fullsend}`. Same-org installation-wide tokens are denied ([ADR 0077](ADRs/0077-mint-repos-scope-hardening.md), simplified in [ADR 0078](ADRs/0078-simplified-mint-authorization-policy.md)).
- Workflow-host allow-list: `WORKFLOW_HOST_REPOS` controls which repos may host workflows calling the mint for per-repo and public-mode callers (default: `fullsend-ai/fullsend`). Per-org callers hard-wire to `{org}/.fullsend` and upstream. Public mode is not special-cased — it uses the same per-repo validation path with `WORKFLOW_HOST_REPOS` and the basename allowlist. This separates caller enrollment from workflow-host trust ([ADR 0082](ADRs/0082-workflow-host-allow-list.md)).
- Standalone mint deployment: `cmd/mint/` provides a self-contained HTTP server that uses direct JWKS verification and filesystem PEM storage instead of GCP infrastructure. It shares the `internal/mintcore/` library with the GCF mint and adds support for custom role permissions and a fallback proxy to an upstream mint. Custom role permissions live in mintcore (not `cmd/mint/`) so that `RolePermissionsFor`, `HasRole`, and `CreateInstallationToken` return a unified view without callers needing to distinguish built-in from custom roles. The GCF mint never calls `RegisterCustomRolePermissions`, so the code is inert there. See the [standalone mint guide](guides/infrastructure/standalone-mint.md).
- Hosted public community mint: steady-state deployment on Cloudflare Workers (JWKS + WAF + single ops console), with interim GCP Cloud Function acceptable until the Worker port is production-ready. Trust policy (`ALLOWED_ORGS=*`, upstream-only workflow provenance) is in [ADR 0059](ADRs/0059-public-mint-mode-with-wildcard-allowlists.md); deployment, edge security, monitoring, and phasing are in [ADR 0068](ADRs/0068-public-community-mint-architecture.md). Enrollment is installing the shared Apps—no per-org mint env registration ([#1145](https://github.com/fullsend-ai/fullsend/issues/1145)).
Expand Down
11 changes: 11 additions & 0 deletions docs/guides/dev/e2e-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,17 @@ Existing pool orgs (`halfsend-01` … `halfsend-12`) need a one-time operator pa
go run ./cmd/fullsend admin foreign allow --org halfsend-NN --role e2e --caller fullsend-ai/fullsend
```

For repo-level grants (scoped to a specific target repo rather than the
entire org), add `--repo`:

```bash
go run ./cmd/fullsend admin foreign allow --org halfsend-NN --role e2e --caller fullsend-ai/fullsend --repo target-repo
go run ./cmd/fullsend admin foreign list --org halfsend-NN --repo target-repo
```

See [ADR 0083](../../ADRs/0083-repo-level-foreign-allow-list.md) for details
on repo-level foreign grants.

## CI authorization

Pull requests trigger e2e via `pull_request_target` in
Expand Down
2 changes: 2 additions & 0 deletions docs/guides/infrastructure/mint-administration.md
Original file line number Diff line number Diff line change
Expand Up @@ -627,3 +627,5 @@ gcloud functions logs read fullsend-mint \
- [Standalone Mint](standalone-mint.md) — Running the mint without GCP, with custom agent roles
- [Infrastructure Reference](infrastructure-reference.md) — Token mint, WIF, and secrets deployment details
- [CLI Internals](../dev/cli-internals.md) — Command structure and implementation details
- [Cross-org authorization (ADR 0060)](../../ADRs/0060-cross-org-mint-authorization-via-org-variables.md) — Org-level FOREIGN authorization via `FULLSEND_FOREIGN_<role>_REPOS` org variables
- [Repo-level foreign grants (ADR 0083)](../../ADRs/0083-repo-level-foreign-allow-list.md) — Per-repo FOREIGN authorization grants; manage with `fullsend admin foreign` commands
Loading
Loading