Skip to content

Support Workers identity bindings and caller runtime types - #465

Draft
irvinebroque wants to merge 41 commits into
mainfrom
codex/workers-oidc-local-dev
Draft

irvinebroque wants to merge 41 commits into
mainfrom
codex/workers-oidc-local-dev

Conversation

@irvinebroque

@irvinebroque irvinebroque commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Support identity configuration, deployment/version upload, type generation, connectors and local development through existing CLI workflows. Keep protocol mechanics in shared SDK utilities.

Customers configure flat callerIdentity: { profile, accountTokens: { issuer, audience } }, run cf dev, then call ctx.identity.caller() and apply application access rules. Optional camelCase overrides and signed-out-only companyId remain supported; matching-tooling requirements sit in the prototype notice.

Head 9e28cd110bfbae95bb3310c2c1d51343489167d8 adds stored-secret identity configuration/type and mocked prebuilt-deployment qualification plus matching local setup guidance. Customers keep the existing identity binding and runtime API; secret values and managed tokens remain private.

Local pnpm check passed all seven root tasks. The focused types/deploy suites passed 58 tests using an explicit matching-source SDK overlay. A fresh-state actual CLI run provisioned a local synthetic secret, started cf dev, discovered a local provider and returned stored-secret-local-ok from the protected API. The overlay/loader are qualification adapters for unpublished source, not released installation instructions.

All ten published SDK dependency pins and the lockfile still reference the earlier 0434f088c03f1388239e642eedc10923713284f7 cohort. The new source cohort is SDK 4eb4a757483c645139315aa0e93d154b68df26df and service 301b86de4c475518f7506c8288209b1869fd1907. Publish matching artifacts before changing versions and lockfile integrity; the installed published graph does not yet include this extension. Existing dependency policies, patches and the independent Forge pin remain intact.

Customer contract · Stored-secret plan · Matched source manifest · Local validation and limits

Companions: runtime #8121, SDK #16455, cf #465.

Experimental draft. Local testing is the acceptance basis; production/hosted provenance, interoperability/security, cross-colo replay, capacity and rollout qualification remain separate. Production enablement remains off.

Pin the SDK packages to 40ff3ab so configuration, development
sessions, and deployment share the reviewed audience validation.
Keep the dependency integrity lock and supply-chain policy enabled.
Pin the reviewed Workers SDK prerelease for fixed audiences, fresh grants and signed fetch. Preserve development auth-profile forwarding and update config tests and release notes.
@pkg-pr-new

pkg-pr-new Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
npm i https://pkg.pr.new/cf@465

commit: 40a77e6

@ask-bonk

ask-bonk Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

cf --help startup

mean stddev min max
PR 279.7 ms 4.0 ms 272.8 ms 288.0 ms
base 278.3 ms 4.2 ms 271.8 ms 286.7 ms

Δ (PR vs base): ↑ +1.5 ms (+0.5%)

Measured with hyperfine on ubuntu-latest (3 warmup runs, 20 timed runs). CI numbers carry ±a few ms of runner jitter; treat small deltas as noise.

@ask-bonk

ask-bonk Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

Remove identity-specific local auth profile forwarding. Consume matching
SDK packages with explicit unsupported local methods and deployed Preview
support. Preserve identity configuration and upload validation.
@irvinebroque irvinebroque changed the title Support fresh Workers identity operations in cf dev Support deployed Workers identity bindings in cf Oct 31, 2026
@ask-bonk

ask-bonk Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@ask-bonk

ask-bonk Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

🤖 I've done a thorough review of your PR.

Pins the Workers SDK previews and adds identity binding configuration/type tests.

  1. Warning: deploy/index.test.ts:94 lacks signing-only identity upload coverage; an upload serialization regression would pass. Suggested inline.

github run

@ask-bonk

ask-bonk Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

No new concerns since the last review

github run

@ask-bonk

ask-bonk Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

No new concerns since the last review

github run

@ask-bonk

ask-bonk Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

No new concerns since the last review

github run

@irvinebroque irvinebroque changed the title Support deployed Workers identity bindings in cf Support Workers identity bindings and caller runtime types Oct 31, 2026
@ask-bonk

ask-bonk Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

No new concerns since the last review

github run

@ask-bonk ask-bonk Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The preview pins add identity bindings and runtime caller type coverage.

@ask-bonk

ask-bonk Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Review: 1 findings.

🤖 I've done a thorough review of your PR.

Pins Workers SDK previews and adds identity binding/type coverage.

  • Posted 1 inline warning suggestion.

github run

Keep the actual runtime type generator and upload metadata coverage.
Generic type-generation tests already cover the removed mocked and
import-only cases. Direct signer bindings need no workers_oidc flag.
Comment thread packages/cli/package.json Resolved
@ask-bonk

ask-bonk Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

Comment on lines +149 to +154
expect(
requests.some(
(r) =>
r.includes("auth.example.com") || r.includes("api.example.com")
)
).toBe(false);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This assertion only excludes the configured authorization/resource hosts. Identity provisioning calls use the Cloudflare API host, so a regression that provisions identities despite --no-provision would still pass. Include the known OIDC provisioning paths in the recorded-request check.

Suggested change
expect(
requests.some(
(r) =>
r.includes("auth.example.com") || r.includes("api.example.com")
)
).toBe(false);
expect(
requests.some(
(r) =>
r.includes("auth.example.com") ||
r.includes("api.example.com") ||
/\/oidc\/(identities|assignments|development_sessions)/.test(r)
)
).toBe(false);

@ask-bonk

ask-bonk Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Review: 1 findings.

🤖 I've done a thorough review of your PR.

Pins matching Workers SDK previews and adds managed OAuth Web Bot Auth coverage.

  • Posted 1 inline warning suggestion.

github run

it.each([false, true])(
"uploads identity binding metadata (signing only: %s)",
async (signingOnly) => {
const upload = mockWorkerUpload();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The parameterized test no longer records requests, so both identity variants can make /oidc/identities, /oidc/assignments, or /oidc/development_sessions calls despite --no-provision and still pass. Restore that assertion here, rather than relying on the separate managed-OAuth case.

Suggested change
const upload = mockWorkerUpload();
const requests = recordRequests();
const upload = mockWorkerUpload();
await seed({
".cloudflare/output/v0/config.json": buildOutputRootConfig(),
".cloudflare/output/v0/workers/default/worker.config.json":
workerConfig({
env: {
ORDERS: {
type: "identity",
...(signingOnly
? {
request_signing: {
allowed_origins: ["https://api.example.com"],
allowed_methods: ["GET"],
},
}
: { audience: "urn:orders" }),
},
REPORTS: {
type: "identity",
audience: "recipient",
},
},
}),
".cloudflare/output/v0/workers/default/bundle/index.js":
"export default {fetch() {return new Response('ok')}}",
});
const { exitCode } = await runCf([
"deploy",
"--prebuilt",
"--no-provision",
]);
expect(exitCode).toBe(0);
expect(upload.metadata?.bindings).toEqual(
expect.arrayContaining([
{
name: "ORDERS",
type: "identity",
...(signingOnly
? {
request_signing: {
allowed_origins: ["https://api.example.com"],
allowed_methods: ["GET"],
},
}
: { audience: "urn:orders" }),
},
{
name: "REPORTS",
type: "identity",
audience: "recipient",
},
])
);
expect(
requests.some((request) =>
/\/oidc\/(identities|assignments|development_sessions)/.test(request)
)
).toBe(false);

@ask-bonk

ask-bonk Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Review: 1 findings.

🤖 I've done a thorough review of your PR.

Pins matching Workers SDK previews and adds identity binding and managed OAuth coverage.

  1. Warning: deploy/index.test.ts:50 no longer verifies --no-provision avoids identity provisioning for either identity variant. Posted an inline suggestion.

github run

@ask-bonk

ask-bonk Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

No new concerns since the last review

github run

@ask-bonk

ask-bonk Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

No new concerns since the last review

github run


Support experimental Worker identity bindings

Consume SDK support for fixed token audiences, independent grant/signing limits, and direct JSRPC `getIdentity(label?)` handles with asynchronous metadata and normal forwarding/disposal. Select a handle before fetching; normalize URL, FormData, and URLSearchParams inputs with `new Request(...)`. Local issuance remains unsupported, so use mocks or deployed Previews. AbortSignal transport and cross-RPC cancellation are outside the contract.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This release note still tells users that local issuance is unsupported, but the new local-identity-development changeset and README both advertise the matching SDK's fully local issuance flow. That leaves the same release with contradictory guidance and directs users away from a supported workflow.

Suggested change
Consume SDK support for fixed token audiences, independent grant/signing limits, and direct JSRPC `getIdentity(label?)` handles with asynchronous metadata and normal forwarding/disposal. Select a handle before fetching; normalize URL, FormData, and URLSearchParams inputs with `new Request(...)`. Local issuance remains unsupported, so use mocks or deployed Previews. AbortSignal transport and cross-RPC cancellation are outside the contract.
Consume SDK support for fixed token audiences, independent grant/signing limits, and direct JSRPC `getIdentity(label?)` handles with asynchronous metadata and normal forwarding/disposal. Select a handle before fetching; normalize URL, FormData, and URLSearchParams inputs with `new Request(...)`. Local issuance requires the matching project-installed development server; it uses a `.test` issuer without Cloudflare credentials or network issuance. AbortSignal transport and cross-RPC cancellation are outside the contract.


Use automatic DPoP for managed identity OAuth

Consume the matching SDK schema without public DPoP policy settings. Preserve policy-free OAuth configuration through type generation and deployment, and keep local issuance unsupported.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This second release note says local issuance remains unsupported even though this PR's local-identity changeset and README state that configured OAuth participates in fully local issuance. Keep the release notes consistent about the required matching project SDK.

Suggested change
Consume the matching SDK schema without public DPoP policy settings. Preserve policy-free OAuth configuration through type generation and deployment, and keep local issuance unsupported.
Consume the matching SDK schema without public DPoP policy settings. Preserve policy-free OAuth configuration through type generation and deployment, and support local issuance through a matching project-installed development server.

Comment thread docs/workers-oidc.md Outdated

Publish a matching workerd and SDK/runtime-types release containing workerd
PR #8121 before advertising local receiver support. Source declarations alone
do not supply runtime behavior. Local sender issuance remains unsupported.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The local-sender statement contradicts the new local-identity changeset and README, which document fully local issuance when cf dev delegates to a project installation using the matching SDK prototype. It should describe that prerequisite rather than mark the flow unsupported.

Suggested change
do not supply runtime behavior. Local sender issuance remains unsupported.
do not supply runtime behavior. Local sender issuance requires a matching project-installed development server.

@ask-bonk

ask-bonk Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Review: 1 findings.

🤖 I've done a thorough review of your PR.

Pins matching Workers SDK previews and adds identity binding coverage.

  1. Warning: Posted 3 inline suggestions to align conflicting local-issuance release guidance.

github run

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant