@ponharu/pkgflare 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/worker.js +7 -3
- package/dist/worker.js.map +1 -1
- package/docs/architecture.md +1 -1
- package/docs/operations.md +10 -6
- package/docs/specification.md +1 -1
- package/package.json +1 -1
package/docs/architecture.md
CHANGED
|
@@ -34,7 +34,7 @@ Secrets provide a small deployment-owned token set with registry-wide read or pu
|
|
|
34
34
|
|
|
35
35
|
pkgflare uses the GitHub JWT directly as the npm Bearer token. A token exchange would shorten or reshape the credential but would also require a pkgflare signing key, a new session endpoint, and another token lifecycle. Direct verification keeps standard npm/Bun requests, retains GitHub's short expiry, and makes GitHub's fixed issuer/JWKS the only signing trust root. JWKS fetches are bounded, cached, and fail closed.
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
Rules with and without `jobWorkflowRef` are separate trust cases. Omitting it requires the JWT claim to be absent; setting it requires the configured workflow identity and ref rule to match. GitHub-issued tokens can include `job_workflow_ref` for a job defined directly in a workflow, where it normally identifies the same workflow as `workflow_ref`. For a reusable job, `workflow_ref` identifies the caller and `job_workflow_ref` identifies the called workflow. The called workflow can use `@*` to accept any valid Git ref or full commit SHA without wildcarding its owner, repository, or path; an exact SHA remains available as an additional registry-side revision constraint. Pull-request contexts are not accepted. Immutable numeric repository and owner IDs are authoritative; workflow path claims add execution constraints rather than replacing identity.
|
|
38
38
|
|
|
39
39
|
Unexpected diagnostics identify the request and operation without recording credentials or package payloads. Normal authenticated metadata responses do contain package manifests; the privacy restriction applies to diagnostics and error responses.
|
|
40
40
|
|
package/docs/operations.md
CHANGED
|
@@ -103,31 +103,35 @@ githubOidc: {
|
|
|
103
103
|
repositoryOwnerId: "987654321",
|
|
104
104
|
ref: "refs/tags/v*",
|
|
105
105
|
workflowRef: "acme/example/.github/workflows/publish.yml@refs/tags/v*",
|
|
106
|
+
jobWorkflowRef: "acme/example/.github/workflows/publish.yml@*",
|
|
106
107
|
permissions: ["publish"],
|
|
107
108
|
packages: ["@acme/example"],
|
|
108
109
|
}],
|
|
109
110
|
}
|
|
110
111
|
```
|
|
111
112
|
|
|
112
|
-
Repository and owner IDs are decimal GitHub IDs and remain the primary repository identity checks across renames. `ref` and `workflowRef` accept branch or tag refs; they are exact matches unless they end in `*`, in which case only that final prefix wildcard is supported. `jobWorkflowRef` accepts the same refs
|
|
113
|
+
Repository and owner IDs are decimal GitHub IDs and remain the primary repository identity checks across renames. `ref` and `workflowRef` accept branch or tag refs; they are exact matches unless they end in `*`, in which case only that final prefix wildcard is supported. `jobWorkflowRef` accepts the same refs, an exact 40-character lowercase hexadecimal commit SHA, or `@*` after an exact owner/repository/workflow path. Package grants are exact scoped package names or a complete scope wildcard such as `@acme/*`; they must belong to a configured registry scope.
|
|
113
114
|
|
|
114
115
|
The complete normalized registry configuration must fit Cloudflare's 5 KiB per-variable limit. pkgflare checks this before deployment; prefer a scope wildcard or another registry when a very large subject/package matrix would exceed it.
|
|
115
116
|
|
|
116
|
-
|
|
117
|
+
`jobWorkflowRef` is optional in the configuration, but omission is an explicit requirement that the token does not contain `job_workflow_ref`; it is not a wildcard. GitHub-issued tokens can include `job_workflow_ref` for jobs defined directly in a workflow. In that case, set `jobWorkflowRef` to that workflow's ref, which normally matches `workflowRef` as shown above. Omit it only for an execution environment whose tokens do not contain the claim.
|
|
118
|
+
|
|
119
|
+
For a reusable workflow, set the caller and called workflow refs independently:
|
|
117
120
|
|
|
118
121
|
- `repositoryId`, `repositoryOwnerId`, `ref`, and `workflowRef` identify and constrain the caller.
|
|
119
122
|
- `jobWorkflowRef` identifies the called reusable workflow and its trusted ref.
|
|
120
123
|
|
|
121
|
-
|
|
124
|
+
To allow routine commit-SHA updates for one reusable workflow without changing the registry policy, fix its complete identity and wildcard only the ref:
|
|
122
125
|
|
|
123
126
|
```ts
|
|
124
127
|
{
|
|
125
|
-
jobWorkflowRef:
|
|
126
|
-
"acme/workflows/.github/workflows/npm-publish.yml@0123456789abcdef0123456789abcdef01234567",
|
|
128
|
+
jobWorkflowRef: "acme/automation/.github/workflows/publish.yml@*",
|
|
127
129
|
}
|
|
128
130
|
```
|
|
129
131
|
|
|
130
|
-
|
|
132
|
+
This wildcard cannot replace any part of the owner, repository, or workflow path. A matching JWT must still contain a valid full commit SHA, branch ref, or tag ref, and every repository ID, owner ID, caller ref/workflow, permission, and package grant in the subject must also match. Continue pinning the reusable workflow's `uses` entry to a full commit SHA; `@*` only avoids duplicating that changing revision in the registry policy.
|
|
133
|
+
|
|
134
|
+
Set `jobWorkflowRef` to a full commit SHA instead when the registry policy must independently require that one revision. That stricter option requires a policy deployment whenever the reusable workflow SHA changes. GitHub keeps the caller information in the standard claims and puts the called workflow reference in `job_workflow_ref`; its trust examples also support filtering a fixed reusable workflow repository with a wildcard ref. See GitHub's documentation for [OIDC with reusable workflows](https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-with-reusable-workflows) and [calling reusable workflows](https://docs.github.com/en/actions/how-tos/reuse-automations/reuse-workflows#calling-a-reusable-workflow).
|
|
131
135
|
|
|
132
136
|
OIDC requests from `pull_request`, `pull_request_target`, related pull-request events, and merge queues are rejected even if another claim pattern would match. Use a trusted branch, tag, or manually dispatched workflow. A `publish` grant includes reads and dist-tag changes only for its allowed packages; a `read` grant cannot publish or change tags. Metadata and tarball reads apply the same package grant.
|
|
133
137
|
|
package/docs/specification.md
CHANGED
|
@@ -89,7 +89,7 @@ Every Registry operation requires a Bearer token. Static tokens are compared aga
|
|
|
89
89
|
|
|
90
90
|
When GitHub OIDC is configured, a non-Secret Bearer token may be a GitHub JWT. The Worker accepts only RS256 with JWT type, the fixed `https://token.actions.githubusercontent.com` issuer and fixed GitHub JWKS URL, the configured audience, required timing and identity claims, and a maximum issued age of ten minutes. It matches numeric repository and owner IDs, branch/tag ref, caller workflow, optional reusable workflow, permission, and package. Pull-request-related and merge-group events are rejected.
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
Rules that omit `jobWorkflowRef` require `job_workflow_ref` to be absent from the token; omission does not disable matching for that claim. Rules that set it require a match in addition to `workflow_ref`. GitHub-issued tokens may include `job_workflow_ref` for jobs defined directly in a workflow, in which case the configured value normally matches that workflow's `workflow_ref`. For reusable jobs, `workflow_ref` identifies the caller and `job_workflow_ref` identifies the called workflow. Caller workflow refs accept exact or terminal-wildcard branch/tag refs. A job workflow ref additionally accepts an exact full 40-character lowercase hexadecimal commit SHA or a complete-ref wildcard written as `owner/repository/.github/workflows/file.yml@*`. The wildcard does not apply to the workflow identity, and the JWT claim must still end in a valid full SHA, branch ref, or tag ref. Shortened or malformed SHAs and wildcarded owners, repositories, or paths are rejected. OIDC package grants are enforced before metadata, tarball, publish, and dist-tag handlers.
|
|
93
93
|
|
|
94
94
|
GitHub keys are fetched under timeout and response-size/key-count limits, cached per isolate, and refreshed after a cooldown when an unknown key is encountered. Invalid signatures/claims fail with 403. JWKS retrieval and validation failures fail closed with 503. Tokens and claims are not included in diagnostics.
|
|
95
95
|
|