@effected/github-actions 0.24.0 → 0.26.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/ActionEnvironment.js +6 -8
- package/ActionInput.js +14 -17
- package/ActionLogger.js +30 -2
- package/ActionsIdentityToken.js +5 -5
- package/ActionsProvenance.js +17 -15
- package/ActionsRegistryCredential.js +81 -0
- package/Artifact.js +3 -2
- package/BlobStore.js +59 -29
- package/OidcTokenIssuer.js +68 -52
- package/PackageManagerInstaller.js +19 -22
- package/README.md +6 -5
- package/Secret.js +10 -6
- package/ToolInstaller.js +3 -2
- package/index.d.ts +200 -75
- package/index.js +4 -3
- package/internal/actionsResults.js +5 -4
- package/internal/json.js +11 -0
- package/internal/runner.js +21 -1
- package/internal/unstubbed.js +1 -3
- package/package.json +11 -8
- package/internal/jwt.js +0 -41
- package/internal/sigv4.js +0 -114
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActionEnvironment } from "./ActionEnvironment.js";
|
|
2
2
|
import { unstubbed } from "./internal/unstubbed.js";
|
|
3
3
|
import { digestFileHex } from "./internal/digest.js";
|
|
4
|
-
import { isWindowsRunner } from "./internal/runner.js";
|
|
4
|
+
import { isWindowsRunner, runnerArch } from "./internal/runner.js";
|
|
5
5
|
import { typeAt } from "./internal/fsProbe.js";
|
|
6
6
|
import { PNPM_EXE_PREFIX, detectMusl, isNodeScript, pnpmExeTarget, strongestSri } from "./internal/pnpmExe.js";
|
|
7
7
|
import { cmdShim, gitBashShim, posixShim } from "./internal/shim.js";
|
|
@@ -12,6 +12,17 @@ import { CorepackIntegrityHash, DEFAULT_REGISTRY, PackageManagerPin, PackageMana
|
|
|
12
12
|
|
|
13
13
|
// src/PackageManagerInstaller.ts
|
|
14
14
|
/**
|
|
15
|
+
* The two `package.json` members the installer reads, as JSON text decoded to
|
|
16
|
+
* an object. Both stay `unknown`: they are attacker-supplied, and their own
|
|
17
|
+
* normalizers decide what survives.
|
|
18
|
+
*/
|
|
19
|
+
const decodeManifest = Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Struct({
|
|
20
|
+
bin: Schema.optionalKey(Schema.Unknown),
|
|
21
|
+
optionalDependencies: Schema.optionalKey(Schema.Unknown)
|
|
22
|
+
})));
|
|
23
|
+
/** A packument's `dist.integrity`, left `unknown` for `expectedFromSri` to judge. */
|
|
24
|
+
const decodePackument = Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Struct({ dist: Schema.optionalKey(Schema.Struct({ integrity: Schema.optionalKey(Schema.Unknown) })) })));
|
|
25
|
+
/**
|
|
15
26
|
* Raised when a package manager cannot be provisioned on the runner.
|
|
16
27
|
*
|
|
17
28
|
* @public
|
|
@@ -202,11 +213,6 @@ const normalizeBins = (bin, fallbackName) => {
|
|
|
202
213
|
}
|
|
203
214
|
return Object.keys(entries).length === 0 ? Option.none() : Option.some(entries);
|
|
204
215
|
};
|
|
205
|
-
/** Map a `RUNNER_ARCH` value (`X64`, `ARM64`) onto the Node arch spelling. */
|
|
206
|
-
const archFromRunner = (runnerArch) => {
|
|
207
|
-
const lowered = runnerArch.toLowerCase();
|
|
208
|
-
return lowered === "x64" || lowered === "arm64" ? lowered : runnerArch;
|
|
209
|
-
};
|
|
210
216
|
const make = Effect.gen(function* () {
|
|
211
217
|
const env = yield* ActionEnvironment;
|
|
212
218
|
const fs = yield* FileSystem.FileSystem;
|
|
@@ -214,10 +220,7 @@ const make = Effect.gen(function* () {
|
|
|
214
220
|
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
215
221
|
const installer = yield* ToolInstaller;
|
|
216
222
|
const runnerOs = yield* Effect.map(env.getOptional("RUNNER_OS"), (found) => Option.getOrElse(found, () => ""));
|
|
217
|
-
const arch = yield*
|
|
218
|
-
onNone: () => process.arch,
|
|
219
|
-
onSome: archFromRunner
|
|
220
|
-
}));
|
|
223
|
+
const arch = yield* runnerArch(env);
|
|
221
224
|
const windows = yield* isWindowsRunner(env);
|
|
222
225
|
const musl = detectMusl();
|
|
223
226
|
const bunBinaryName = windows ? "bun.exe" : "bun";
|
|
@@ -305,14 +308,11 @@ const make = Effect.gen(function* () {
|
|
|
305
308
|
subject: "no package.json",
|
|
306
309
|
cause
|
|
307
310
|
})));
|
|
308
|
-
const manifest = yield* Effect.
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
cause
|
|
314
|
-
})
|
|
315
|
-
});
|
|
311
|
+
const manifest = yield* decodeManifest(raw).pipe(Effect.mapError((cause) => errorFor(pin)({
|
|
312
|
+
reason: "layoutUnexpected",
|
|
313
|
+
subject: "unparseable package.json",
|
|
314
|
+
cause
|
|
315
|
+
})));
|
|
316
316
|
const bins = Option.getOrUndefined(normalizeBins(manifest.bin, pin.name));
|
|
317
317
|
if (bins === void 0) return yield* Effect.fail(errorFor(pin)({
|
|
318
318
|
reason: "layoutUnexpected",
|
|
@@ -458,10 +458,7 @@ const make = Effect.gen(function* () {
|
|
|
458
458
|
subject: packumentUrl,
|
|
459
459
|
cause
|
|
460
460
|
});
|
|
461
|
-
const packument = yield* fs.readFileString(packumentFile).pipe(Effect.mapError(unverifiable), Effect.flatMap((raw) => Effect.
|
|
462
|
-
try: () => JSON.parse(raw),
|
|
463
|
-
catch: unverifiable
|
|
464
|
-
})));
|
|
461
|
+
const packument = yield* fs.readFileString(packumentFile).pipe(Effect.mapError(unverifiable), Effect.flatMap((raw) => decodePackument(raw).pipe(Effect.mapError(unverifiable))));
|
|
465
462
|
return yield* expectedFromSri(pin, packument.dist?.integrity, packumentUrl);
|
|
466
463
|
});
|
|
467
464
|
/**
|
package/README.md
CHANGED
|
@@ -155,7 +155,7 @@ Two decisions make that safe for any segment value, with no prefix reasoning at
|
|
|
155
155
|
|
|
156
156
|
`CacheKey.hashFiles` is byte-compatible with `@actions/glob`'s `hashFiles`, and `OidcTokenIssuer.claims` decodes the runner's OIDC token for a SLSA provenance predicate without verifying its signature — the token arrived over TLS from the runner's own token service, so the transport is the trust boundary and nothing here branches on the claims for authorization.
|
|
157
157
|
|
|
158
|
-
`ActionsProvenance.capture` turns those claims into an `@effected/sbom` `SlsaProvenance` predicate, and `ActionsIdentityToken.layer` serves
|
|
158
|
+
`ActionsProvenance.capture` turns those claims into an `@effected/sbom` `SlsaProvenance` predicate, and `ActionsIdentityToken.layer` serves `@effected/oidc`'s narrow `IdentityToken` contract, which that package's signer consumes, from the same issuer — the inversion that keeps the Actions runtime out of every consumer that only wants to emit an SBOM:
|
|
159
159
|
|
|
160
160
|
```ts
|
|
161
161
|
import { ActionsIdentityToken, ActionsProvenance, OidcTokenIssuer } from "@effected/github-actions";
|
|
@@ -296,20 +296,21 @@ const TestOutputs = ActionOutputs.layerTest({
|
|
|
296
296
|
- `ActionInput` — typed input accessors (`string`, `boolean`, `integer`, `redacted`, `lines`, `list`, `pairs`, `schema`) sharing one absence rule, plus the `INPUT_`-aware `ConfigProvider` `Action.run` installs by default. `pairs` always rejects an empty key (`=value`, whose damage lands far from the typo) and takes `requireValue` to reject an empty value too.
|
|
297
297
|
- `ActionOutputs` — step outputs, JSON outputs, the job summary, exported variables, `PATH` additions, failure annotations and log masking.
|
|
298
298
|
- `ActionState` / `ActionEnvironment` — persisted `pre`/`main`/`post` state, and the fiber-local `GITHUB_*`/`RUNNER_*` context read once from `process.env`.
|
|
299
|
-
- `ActionLogger` — collapsible groups, buffered step transcripts (`withBuffer({ onSuccess: "discard" })` drops a green step's transcript entirely, while a failure, defect or interruption still flushes it), `withStep(name, effect, options?)` for the same buffering plus one summary line on success and a `❌ <name>` header above the transcript on failure, `::notice::` annotations, and the `Logger` that renders every `Effect.log*` as a workflow command.
|
|
299
|
+
- `ActionLogger` — collapsible groups (nesting-aware: the runner cannot nest groups, so a group opened inside another writes a `▸ <name>` header line instead of a second group command), buffered step transcripts (`withBuffer({ onSuccess: "discard" })` drops a green step's transcript entirely, while a failure, defect or interruption still flushes it), `withStep(name, effect, options?)` for the same buffering plus one summary line on success and a `❌ <name>` header above the transcript on failure, `::notice::` annotations, and the `Logger` that renders every `Effect.log*` as a workflow command.
|
|
300
300
|
- `DryRun` — the rehearsal guard every mutation goes through, driven by the `dry-run` input by default.
|
|
301
301
|
- `Secret` — the one declassification seam between a `Redacted` value and a plain string, masking before it returns plaintext.
|
|
302
302
|
- `GitHubToken` — the App-token lifecycle shaped like the `pre`/`main`/`post` workflow: mint, verify scopes, persist, read, revoke.
|
|
303
303
|
- `ActionCache` / `Artifact` — the runner's cache and artifact protocols over Twirp v2, excluded from the default runtime so a consumer that skips them never links Azure.
|
|
304
304
|
- `CacheKey` — cache keys and their restore-key ladder, `withNamespace(segment)` for a bust token or a shared-runner prefix, plus `hashFiles`/`matchingFiles`/`hashMatching` byte-compatible with `@actions/glob`.
|
|
305
|
-
- `OidcTokenIssuer` — the runner's OIDC token service, with unverified claim decoding for provenance predicates.
|
|
306
|
-
- `
|
|
305
|
+
- `OidcTokenIssuer` — the runner's OIDC token service, with unverified claim decoding for provenance predicates, and a `recording(claims)` double that journals the audiences asked for.
|
|
306
|
+
- `ActionsRegistryCredential` — `workload({ audience, prefix })` mints an identity token for a registry, masks the bare and the prefixed value, and returns `@effected/npm`'s publish-only `WorkloadCredential` for `PackagePublish.setupAuth`.
|
|
307
|
+
- `ActionsIdentityToken` / `ActionsProvenance` — the `@effected/sbom` seam: `layer` serves `@effected/oidc`'s `IdentityToken` contract from the runner's issuer, and `capture` builds a `SlsaProvenance` predicate out of the runner's OIDC claims.
|
|
307
308
|
- `GitHubMarkdown` — the escaping-safe writer for GitHub surfaces: `table`, `tableFor(schema)`, `heading`, `link`, `code`, `codeBlock`, `list`, `details` and `raw`, and the package's only importer of `@effected/markdown`.
|
|
308
309
|
- `ManagedDocument` — marker-delimited named regions in text a human also edits, for a sticky comment or a managed pull request description; content outside the regions survives byte-for-byte, and each region can carry marker metadata that round-trips through `entry(key)` without ever addressing the region.
|
|
309
310
|
- `CheckState` / `projectCheckState` — the kit's check vocabulary, wider than GitHub's conclusions, and its projection onto the check-run wire form.
|
|
310
311
|
- `CheckDocument` — the debounced check-to-document reconciler: report states as they change, and one write lands carrying the final one. `stamp` plus a readable sink lets two runs share one document, dropping a strictly older run's pass instead of clobbering the newer one; `flush` reports `written`, `unchanged` or `stale`.
|
|
311
312
|
- `ToolInstaller` — download, extract and cache a toolchain in the runner's tool cache, with no `@actions/tool-cache` dependency; `ToolInstallerError` always names its `subject`.
|
|
312
|
-
- `BlobStore` — durable `get`/`put`/`has` over `StoredBlob<A>` values (bytes plus caller-schema metadata; the type was named `Blob<A>` before, which collided with the global), backed by `layerS3` (SigV4-signed
|
|
313
|
+
- `BlobStore` — durable `get`/`put`/`has` over `StoredBlob<A>` values (bytes plus caller-schema metadata; the type was named `Blob<A>` before, which collided with the global), backed by `layerS3` (SigV4-signed through `@effected/crypto`, so it needs core `Crypto` in `R`; no `@aws-sdk/*` dependency) or `GitHubCacheBlobStore.layer` (the runner's own cache); `layerMemory` runs the real envelope framing for tests.
|
|
313
314
|
|
|
314
315
|
## License
|
|
315
316
|
|
package/Secret.js
CHANGED
|
@@ -94,9 +94,13 @@ var Secret = class Secret {
|
|
|
94
94
|
* Declassify one secret for an in-process use that needs the raw bytes.
|
|
95
95
|
*
|
|
96
96
|
* @remarks
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
97
|
+
* For a consumer that must hand the raw key to code taking a plain string,
|
|
98
|
+
* such as a third-party signing library. A signer that takes a `Redacted`
|
|
99
|
+
* needs no declassification at all: `@effected/crypto`'s `SigV4` and `Hmac`
|
|
100
|
+
* unwrap the key only where they compute, so a caller of those (this
|
|
101
|
+
* package's own S3 `BlobStore` is one) registers the value with
|
|
102
|
+
* {@link Secret.mask} and passes the `Redacted` on. No module in this
|
|
103
|
+
* package calls this member any more.
|
|
100
104
|
*
|
|
101
105
|
* Signing named the member; it does not gate it. **Any in-process use that
|
|
102
106
|
* needs the raw value without writing it to a runner file is this
|
|
@@ -121,9 +125,9 @@ var Secret = class Secret {
|
|
|
121
125
|
* `::add-mask::` command only masks when the runner parses this process's
|
|
122
126
|
* stdout; a detached worker's stdout is a log file no runner parses, so
|
|
123
127
|
* there the command masks nothing *and* spells the plaintext into the log.
|
|
124
|
-
* A worker that signs
|
|
125
|
-
*
|
|
126
|
-
*
|
|
128
|
+
* A worker that signs must compose `ActionOutputs.layerDetached`, under
|
|
129
|
+
* which this member still returns the raw key but the mask is a
|
|
130
|
+
* documented no-op; the masking
|
|
127
131
|
* itself is the **parent's** job, done before the spawn via
|
|
128
132
|
* {@link Secret.forChildEnv} under the real layer.
|
|
129
133
|
*/
|
package/ToolInstaller.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActionEnvironment } from "./ActionEnvironment.js";
|
|
2
2
|
import { unstubbed } from "./internal/unstubbed.js";
|
|
3
|
-
import { isWindowsRunner, toolCacheRoot } from "./internal/runner.js";
|
|
3
|
+
import { isWindowsRunner, runnerArch, toolCacheRoot } from "./internal/runner.js";
|
|
4
4
|
import { spawnOnce } from "./internal/spawn.js";
|
|
5
5
|
import { tarExtractCommand, unzipCommand } from "./internal/archiveCommands.js";
|
|
6
6
|
import { isErrno, typeAt } from "./internal/fsProbe.js";
|
|
@@ -68,11 +68,12 @@ const make = Effect.gen(function* () {
|
|
|
68
68
|
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
69
69
|
const root = yield* toolCacheRoot(env, path);
|
|
70
70
|
const windows = yield* isWindowsRunner(env);
|
|
71
|
+
const arch = yield* runnerArch(env);
|
|
71
72
|
const cachePath = (tool, version) => ToolInstaller.cachePath({
|
|
72
73
|
root,
|
|
73
74
|
tool,
|
|
74
75
|
version,
|
|
75
|
-
arch
|
|
76
|
+
arch
|
|
76
77
|
});
|
|
77
78
|
const destinationFor = (options) => {
|
|
78
79
|
const requested = options?.destination;
|
package/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { AnnotationProperties, AnnotationProperties as AnnotationProperties$1, WorkflowCommand } from "@effected/github-commands";
|
|
2
2
|
import { NodeServices } from "@effect/platform-node";
|
|
3
|
-
import { Cause, Config, ConfigProvider, Context, Duration, Effect, FileSystem, Layer, Logger, Option, Path, Redacted, Result, Schema } from "effect";
|
|
3
|
+
import { Cause, Config, ConfigProvider, Context, Crypto, Duration, Effect, FileSystem, Layer, Logger, Option, Path, Redacted, Result, Schema } from "effect";
|
|
4
4
|
import { HttpClient } from "effect/http";
|
|
5
5
|
import { ChildProcessSpawner } from "effect/process";
|
|
6
|
-
import { IdentityToken
|
|
7
|
-
import { BotIdentity, GitHubApp, GitHubClient, InstallationToken, PermissionLevel, RetryPolicy } from "@effected/github";
|
|
8
|
-
import {
|
|
6
|
+
import { IdentityToken } from "@effected/oidc";
|
|
7
|
+
import { ActionsOidcClaims, BotIdentity, GitHubApp, GitHubClient, InstallationToken, PermissionLevel, RetryPolicy } from "@effected/github";
|
|
8
|
+
import { SlsaProvenance } from "@effected/sbom";
|
|
9
|
+
import { IntegrityHashBrand, PackageManagerPin, WorkloadCredential } from "@effected/npm";
|
|
9
10
|
declare const ActionEnvironmentError_base: Schema.Class<ActionEnvironmentError, Schema.TaggedStruct<"ActionEnvironmentError", {
|
|
10
11
|
/** `missing` — absent or empty; `malformed` — present but unusable. */
|
|
11
12
|
readonly reason: Schema.Literals<readonly ["missing", "malformed"]>;
|
|
@@ -298,7 +299,38 @@ interface WithStepOptions {
|
|
|
298
299
|
* @public
|
|
299
300
|
*/
|
|
300
301
|
interface ActionLoggerShape {
|
|
301
|
-
/**
|
|
302
|
+
/**
|
|
303
|
+
* Run an effect inside a collapsible log group.
|
|
304
|
+
*
|
|
305
|
+
* @remarks
|
|
306
|
+
* The runner cannot nest groups — a second `::group::` implicitly closes the
|
|
307
|
+
* first — so this is nesting-aware: the outermost call writes the
|
|
308
|
+
* `::group::` / `::endgroup::` pair, and a call made inside it writes one
|
|
309
|
+
* `▸ <name>` header line inside the open group instead (line breaks
|
|
310
|
+
* collapsed to spaces, the text neutralized so it cannot be a command). The
|
|
311
|
+
* header goes out through `Console` like the group command it replaces, so
|
|
312
|
+
* it is never captured into, or discarded with, an enclosing `withBuffer`
|
|
313
|
+
* or `withStep` transcript. A failure at any depth flushes the active
|
|
314
|
+
* buffer before the group closes. That ordering is visible in a failed
|
|
315
|
+
* run's log: the replayed transcript lands BELOW every nested header that
|
|
316
|
+
* was written live, including lines that were logged before the header.
|
|
317
|
+
*
|
|
318
|
+
* The depth is fiber-scoped, which leaves four edges:
|
|
319
|
+
*
|
|
320
|
+
* 1. **Concurrent sibling groups interleave.** Two top-level groups on
|
|
321
|
+
* separate fibers each write a `::group::`, and their output shares one
|
|
322
|
+
* log stream; that is the runner's limitation, not one a depth can fix.
|
|
323
|
+
* 2. **A fiber forked inside a group keeps the depth it was forked at.** A
|
|
324
|
+
* `forkChild` joined inside the group nests correctly; a detached fiber
|
|
325
|
+
* that outlives the group still writes headers rather than a group.
|
|
326
|
+
* 3. **Only groups opened here are counted.** A raw
|
|
327
|
+
* `WorkflowCommand.group(...)`, a document rendered by `@effected/cli`'s
|
|
328
|
+
* `Render.githubLog` with a top-level collapsible, or a consumer's own
|
|
329
|
+
* wrapper opens a group this member cannot see, and a group opened
|
|
330
|
+
* inside one still nests at the runner.
|
|
331
|
+
* 4. **The test doubles do not model nesting.** `makeTest`, `layerTest` and
|
|
332
|
+
* `layerSilent` pass the effect through unchanged.
|
|
333
|
+
*/
|
|
302
334
|
readonly group: <A, E, R>(name: string, effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
303
335
|
/**
|
|
304
336
|
* Run an effect with its verbose output captured and replayed on exit.
|
|
@@ -435,7 +467,8 @@ export declare class ActionLogger extends ActionLogger_base {
|
|
|
435
467
|
* {@link ActionEnvironment.makeTest}. A logger that dies when a suite logs
|
|
436
468
|
* would make every double unusable, and silence is the honest default for a
|
|
437
469
|
* service whose whole job is output. Group and buffer wrappers pass their
|
|
438
|
-
* effect through unchanged
|
|
470
|
+
* effect through unchanged, so the double does not model group nesting:
|
|
471
|
+
* a test of nested-group output needs the live {@link ActionLogger.layer}.
|
|
439
472
|
*/
|
|
440
473
|
static readonly makeTest: (overrides?: Partial<ActionLoggerShape>) => ActionLoggerShape;
|
|
441
474
|
/** {@link ActionLogger.makeTest} behind `Layer.succeed`. */
|
|
@@ -1953,45 +1986,6 @@ declare const OidcTokenError_base: Schema.Class<OidcTokenError, Schema.TaggedStr
|
|
|
1953
1986
|
export declare class OidcTokenError extends OidcTokenError_base {
|
|
1954
1987
|
get message(): string;
|
|
1955
1988
|
}
|
|
1956
|
-
declare const OidcClaims_base: Schema.Class<OidcClaims, Schema.Struct<{
|
|
1957
|
-
/** The issuer, e.g. `https://token.actions.githubusercontent.com`. */
|
|
1958
|
-
readonly iss: Schema.String;
|
|
1959
|
-
/** The full ref the workflow ran on. */
|
|
1960
|
-
readonly ref: Schema.String;
|
|
1961
|
-
/** The commit. */
|
|
1962
|
-
readonly sha: Schema.String;
|
|
1963
|
-
/** `owner/repo`. */
|
|
1964
|
-
readonly repository: Schema.String;
|
|
1965
|
-
/** The event that triggered the run. */
|
|
1966
|
-
readonly event_name: Schema.String;
|
|
1967
|
-
/** The reusable-workflow ref, which is what a verifier pins against. */
|
|
1968
|
-
readonly job_workflow_ref: Schema.String;
|
|
1969
|
-
/** The calling workflow's ref. */
|
|
1970
|
-
readonly workflow_ref: Schema.String;
|
|
1971
|
-
/** The numeric repository id, as a string. */
|
|
1972
|
-
readonly repository_id: Schema.String;
|
|
1973
|
-
/** The numeric owner id, as a string. */
|
|
1974
|
-
readonly repository_owner_id: Schema.String;
|
|
1975
|
-
/** `github-hosted` or `self-hosted`. */
|
|
1976
|
-
readonly runner_environment: Schema.String;
|
|
1977
|
-
/** The run id, as a string. */
|
|
1978
|
-
readonly run_id: Schema.String;
|
|
1979
|
-
/** The run attempt, as a string. */
|
|
1980
|
-
readonly run_attempt: Schema.String;
|
|
1981
|
-
}>, {}>;
|
|
1982
|
-
/**
|
|
1983
|
-
* The claims a GitHub Actions OIDC token carries about the workflow that ran.
|
|
1984
|
-
*
|
|
1985
|
-
* @remarks
|
|
1986
|
-
* The field names are GitHub's own JWT claim names, kept verbatim rather than
|
|
1987
|
-
* translated to the kit's casing. They are an **external vocabulary** — the
|
|
1988
|
-
* same strings that appear in a SLSA provenance predicate and in every
|
|
1989
|
-
* published example of an Actions OIDC policy — and renaming them would put a
|
|
1990
|
-
* translation layer between a consumer and the specification they are reading.
|
|
1991
|
-
*
|
|
1992
|
-
* @public
|
|
1993
|
-
*/
|
|
1994
|
-
export declare class OidcClaims extends OidcClaims_base {}
|
|
1995
1989
|
/**
|
|
1996
1990
|
* The members of the {@link OidcTokenIssuer} service: request an ID `token`
|
|
1997
1991
|
* and read its decoded `claims`, both failing with {@link OidcTokenError}.
|
|
@@ -2009,7 +2003,8 @@ interface OidcTokenIssuerShape {
|
|
|
2009
2003
|
*/
|
|
2010
2004
|
readonly token: (audience?: string) => Effect.Effect<Redacted.Redacted<string>, OidcTokenError>;
|
|
2011
2005
|
/**
|
|
2012
|
-
* The token's claims, decoded
|
|
2006
|
+
* The token's claims, decoded into `@effected/github`'s `ActionsOidcClaims`,
|
|
2007
|
+
* the same class `ActionsOidc.verify` returns.
|
|
2013
2008
|
*
|
|
2014
2009
|
* @remarks
|
|
2015
2010
|
* **The signature is deliberately not verified**, for three reasons that are
|
|
@@ -2034,7 +2029,22 @@ interface OidcTokenIssuerShape {
|
|
|
2034
2029
|
* a test cannot silently skip the path under test because the double
|
|
2035
2030
|
* returned a token that is not a JWT.
|
|
2036
2031
|
*/
|
|
2037
|
-
readonly claims: (audience?: string) => Effect.Effect<
|
|
2032
|
+
readonly claims: (audience?: string) => Effect.Effect<ActionsOidcClaims, OidcTokenError>;
|
|
2033
|
+
}
|
|
2034
|
+
/**
|
|
2035
|
+
* What {@link OidcTokenIssuer.recording} returns: the layer to provide and the
|
|
2036
|
+
* audiences it was asked for.
|
|
2037
|
+
*
|
|
2038
|
+
* @public
|
|
2039
|
+
*/
|
|
2040
|
+
interface RecordingOidcTokenIssuer {
|
|
2041
|
+
/** The double. */
|
|
2042
|
+
readonly layer: Layer.Layer<OidcTokenIssuer>;
|
|
2043
|
+
/**
|
|
2044
|
+
* A snapshot of the audience each `token` or `claims` call asked for, in
|
|
2045
|
+
* order; `undefined` for a call that named none.
|
|
2046
|
+
*/
|
|
2047
|
+
readonly audiences: () => ReadonlyArray<string | undefined>;
|
|
2038
2048
|
}
|
|
2039
2049
|
declare const OidcTokenIssuer_base: Context.ServiceClass<OidcTokenIssuer, "@effected/github-actions/OidcTokenIssuer", OidcTokenIssuerShape>;
|
|
2040
2050
|
/**
|
|
@@ -2054,7 +2064,7 @@ declare const OidcTokenIssuer_base: Context.ServiceClass<OidcTokenIssuer, "@effe
|
|
|
2054
2064
|
* const program = Effect.gen(function* () {
|
|
2055
2065
|
* const issuer = yield* OidcTokenIssuer;
|
|
2056
2066
|
* const claims = yield* issuer.claims("sigstore");
|
|
2057
|
-
* return claims.
|
|
2067
|
+
* return claims.jobWorkflowRef;
|
|
2058
2068
|
* });
|
|
2059
2069
|
* ```
|
|
2060
2070
|
*
|
|
@@ -2078,7 +2088,7 @@ export declare class OidcTokenIssuer extends OidcTokenIssuer_base {
|
|
|
2078
2088
|
* double returning a synthetic non-JWT would make the provenance path
|
|
2079
2089
|
* structurally unreachable in a test.
|
|
2080
2090
|
*/
|
|
2081
|
-
static readonly unsignedTokenFor: (claims:
|
|
2091
|
+
static readonly unsignedTokenFor: (claims: ActionsOidcClaims) => Redacted.Redacted<string>;
|
|
2082
2092
|
/** A test double. Unstubbed members die rather than answering with a non-token. */
|
|
2083
2093
|
static readonly makeTest: (overrides?: Partial<OidcTokenIssuerShape>) => OidcTokenIssuerShape;
|
|
2084
2094
|
/** {@link OidcTokenIssuer.makeTest} behind `Layer.succeed`. */
|
|
@@ -2093,16 +2103,49 @@ export declare class OidcTokenIssuer extends OidcTokenIssuer_base {
|
|
|
2093
2103
|
* members can disagree is how a test proves a path works while production
|
|
2094
2104
|
* takes the other one.
|
|
2095
2105
|
*/
|
|
2096
|
-
static readonly layerFor: (claims:
|
|
2106
|
+
static readonly layerFor: (claims: ActionsOidcClaims) => Layer.Layer<OidcTokenIssuer>;
|
|
2107
|
+
/**
|
|
2108
|
+
* A {@link OidcTokenIssuer.layerFor} double that also records the audience
|
|
2109
|
+
* every call asked for.
|
|
2110
|
+
*
|
|
2111
|
+
* @remarks
|
|
2112
|
+
* A sibling of `layerTest` rather than a recording `layerTest`, following
|
|
2113
|
+
* `ActionOutputs.recording`: the doubles here are override-and-die, and a
|
|
2114
|
+
* recorder is a different contract. The audience is the one input a token
|
|
2115
|
+
* request carries, and a token minted for the wrong audience is refused by
|
|
2116
|
+
* the party it was meant for — so "which audience did this ask for" is
|
|
2117
|
+
* worth an assertion rather than an assumption.
|
|
2118
|
+
*
|
|
2119
|
+
* Each call returns a fresh journal and a fresh layer: bind the result to a
|
|
2120
|
+
* `const` and provide its `layer` once.
|
|
2121
|
+
*
|
|
2122
|
+
* @example
|
|
2123
|
+
* ```ts
|
|
2124
|
+
* import type { ActionsOidcClaims } from "@effected/github";
|
|
2125
|
+
* import { OidcTokenIssuer } from "@effected/github-actions";
|
|
2126
|
+
* import { Effect } from "effect";
|
|
2127
|
+
*
|
|
2128
|
+
* declare const claims: ActionsOidcClaims;
|
|
2129
|
+
* const recorder = OidcTokenIssuer.recording(claims);
|
|
2130
|
+
* const program = Effect.gen(function* () {
|
|
2131
|
+
* const issuer = yield* OidcTokenIssuer;
|
|
2132
|
+
* yield* issuer.token("https://registry.example");
|
|
2133
|
+
* return recorder.audiences();
|
|
2134
|
+
* });
|
|
2135
|
+
* Effect.runPromise(Effect.provide(program, recorder.layer)).then(console.log);
|
|
2136
|
+
* // => ["https://registry.example"]
|
|
2137
|
+
* ```
|
|
2138
|
+
*/
|
|
2139
|
+
static readonly recording: (claims: ActionsOidcClaims) => RecordingOidcTokenIssuer;
|
|
2097
2140
|
}
|
|
2098
2141
|
/**
|
|
2099
|
-
* Serves `@effected/
|
|
2142
|
+
* Serves `@effected/oidc`'s `IdentityToken` contract from the runner's own OIDC
|
|
2100
2143
|
* token service, so signing an SBOM inside a workflow needs no further wiring.
|
|
2101
2144
|
*
|
|
2102
2145
|
* @remarks
|
|
2103
|
-
* `@effected/
|
|
2104
|
-
* one redacted token — precisely so that
|
|
2105
|
-
*
|
|
2146
|
+
* `@effected/oidc` declares `IdentityToken` — one method, one audience,
|
|
2147
|
+
* one redacted token — precisely so that a consumer of a token, such as
|
|
2148
|
+
* `@effected/sbom`'s signer, does not drag the Actions runtime in. This is the
|
|
2106
2149
|
* layer that closes the inversion from the other side: it serves that contract
|
|
2107
2150
|
* from the runner's own OIDC token service ({@link OidcTokenIssuer}), the same
|
|
2108
2151
|
* arrangement as `@effected/workspaces` implementing `@effected/commands`'
|
|
@@ -2152,12 +2195,14 @@ export declare class ActionsIdentityToken {
|
|
|
2152
2195
|
*
|
|
2153
2196
|
* @remarks
|
|
2154
2197
|
* `SlsaProvenance.forGitHubWorkflow` is total and does the real work, but it
|
|
2155
|
-
* takes
|
|
2156
|
-
* actually holds is the runner's own OIDC claims,
|
|
2157
|
-
*
|
|
2158
|
-
* fields, so transposing `
|
|
2159
|
-
* passes every type check, and produces a
|
|
2160
|
-
* the **wrong** provenance. This module
|
|
2198
|
+
* takes an all-string input record — and the only input anyone inside a
|
|
2199
|
+
* workflow actually holds is the runner's own OIDC claims, decoded as
|
|
2200
|
+
* `@effected/github`'s `ActionsOidcClaims` with integer ids. The projection
|
|
2201
|
+
* between the two is eleven close-cousin fields, so transposing `repositoryId`
|
|
2202
|
+
* and `repositoryOwnerId` compiles, passes every type check, and produces a
|
|
2203
|
+
* validly signed attestation asserting the **wrong** provenance. This module
|
|
2204
|
+
* owns that projection once, rendering the ids back to the decimal strings the
|
|
2205
|
+
* token carried, on the same
|
|
2161
2206
|
* `github-actions` ↔ `sbom` seam as {@link ActionsIdentityToken}: `sbom` must
|
|
2162
2207
|
* not depend on the Actions runtime, so the adapter lives here, beside the
|
|
2163
2208
|
* services it reads.
|
|
@@ -2187,7 +2232,7 @@ export declare class ActionsProvenance {
|
|
|
2187
2232
|
*
|
|
2188
2233
|
* @remarks
|
|
2189
2234
|
* Every field `GitHubWorkflowProvenance` declares is populated from
|
|
2190
|
-
*
|
|
2235
|
+
* the runner's `ActionsOidcClaims`, except `serverUrl`, which is read from
|
|
2191
2236
|
* `GITHUB_SERVER_URL` through {@link ActionEnvironment}'s `getOptional`
|
|
2192
2237
|
* with `https://github.com` as the default — **not** through the
|
|
2193
2238
|
* `GitHubContext` projection. The projection fails typed when a `GITHUB_*`
|
|
@@ -2212,6 +2257,71 @@ export declare class ActionsProvenance {
|
|
|
2212
2257
|
*/
|
|
2213
2258
|
static readonly capture: (audience?: string) => Effect.Effect<SlsaProvenance, OidcTokenError, OidcTokenIssuer | ActionEnvironment>;
|
|
2214
2259
|
}
|
|
2260
|
+
/**
|
|
2261
|
+
* Registry credentials minted from the runner's own workload identity.
|
|
2262
|
+
*
|
|
2263
|
+
* @remarks
|
|
2264
|
+
* The GitHub Actions half of `@effected/npm`'s workload credential. npm owns
|
|
2265
|
+
* the credential's shape and the npmrc write and takes no Actions edge, so it
|
|
2266
|
+
* cannot mint or mask; this class does both, so a consumer never holds the
|
|
2267
|
+
* identity token or the prefixed value as plaintext and never reaches for
|
|
2268
|
+
* `Secret.forSigning` to build one.
|
|
2269
|
+
*
|
|
2270
|
+
* @example
|
|
2271
|
+
* ```ts
|
|
2272
|
+
* import { ActionsRegistryCredential } from "@effected/github-actions";
|
|
2273
|
+
* import { PackagePublish } from "@effected/npm";
|
|
2274
|
+
* import { Effect } from "effect";
|
|
2275
|
+
*
|
|
2276
|
+
* const program = Effect.gen(function* () {
|
|
2277
|
+
* const credential = yield* ActionsRegistryCredential.workload({
|
|
2278
|
+
* audience: "https://registry.example",
|
|
2279
|
+
* prefix: "example_workload_",
|
|
2280
|
+
* });
|
|
2281
|
+
* const publish = yield* PackagePublish;
|
|
2282
|
+
* yield* publish.setupAuth({
|
|
2283
|
+
* registry: "https://registry.example/npm",
|
|
2284
|
+
* credential,
|
|
2285
|
+
* npmrcPath: "/home/runner/.npmrc",
|
|
2286
|
+
* });
|
|
2287
|
+
* });
|
|
2288
|
+
* ```
|
|
2289
|
+
*
|
|
2290
|
+
* @public
|
|
2291
|
+
*/
|
|
2292
|
+
export declare class ActionsRegistryCredential {
|
|
2293
|
+
private constructor();
|
|
2294
|
+
/**
|
|
2295
|
+
* Mint a workload identity token for `audience`, mask it and its prefixed
|
|
2296
|
+
* form, and return `@effected/npm`'s `WorkloadCredential`.
|
|
2297
|
+
*
|
|
2298
|
+
* @remarks
|
|
2299
|
+
* In order: the runner's {@link OidcTokenIssuer} mints a token for
|
|
2300
|
+
* `audience` (verbatim — it is the registry's own audience, and a token
|
|
2301
|
+
* minted for another is refused); the bare token is masked; npm's
|
|
2302
|
+
* `workloadCredential` prefixes it; the prefixed value is masked too,
|
|
2303
|
+
* because the runner's log filter matches whole registered values and the
|
|
2304
|
+
* prefixed form is a new one. Both masks are emitted before the credential
|
|
2305
|
+
* is returned, so no later step — the npm subprocess included — can print
|
|
2306
|
+
* either value in clear.
|
|
2307
|
+
*
|
|
2308
|
+
* A mint failure stays an {@link OidcTokenError}, distinct from a later
|
|
2309
|
+
* `PublishError` of kind `"auth"` from `setupAuth`, so a caller can tell
|
|
2310
|
+
* "the runner refused an identity token" from "the npmrc could not be
|
|
2311
|
+
* written". On an issuer failure nothing is masked and nothing is built.
|
|
2312
|
+
*
|
|
2313
|
+
* **In a detached worker the masks are a leak**, exactly as for
|
|
2314
|
+
* {@link Secret.mask}: mint in the parent, where the runner parses stdout.
|
|
2315
|
+
*
|
|
2316
|
+
* @param options - `audience` for the identity token; `prefix` is the
|
|
2317
|
+
* registry's token prefix, an open string because the vocabulary belongs
|
|
2318
|
+
* to the registry, not to this kit.
|
|
2319
|
+
*/
|
|
2320
|
+
static readonly workload: (options: {
|
|
2321
|
+
readonly audience: string;
|
|
2322
|
+
readonly prefix: string;
|
|
2323
|
+
}) => Effect.Effect<WorkloadCredential, OidcTokenError, OidcTokenIssuer | ActionOutputs>;
|
|
2324
|
+
}
|
|
2215
2325
|
declare const ArtifactError_base: Schema.Class<ArtifactError, Schema.TaggedStruct<"ArtifactError", {
|
|
2216
2326
|
/**
|
|
2217
2327
|
* `misconfigured` — the results backend is not reachable from here (see
|
|
@@ -2548,9 +2658,13 @@ declare const BlobStoreError_base: Schema.Class<BlobStoreError, Schema.TaggedStr
|
|
|
2548
2658
|
/**
|
|
2549
2659
|
* `unreachable` — the store could not be contacted. `refused` — it answered,
|
|
2550
2660
|
* unhappily; `status` says how. `misconfigured` — the layer was built with
|
|
2551
|
-
* settings the store cannot use
|
|
2661
|
+
* settings the store cannot use, or a request could not be signed with them
|
|
2662
|
+
* (no WebCrypto in the runtime, or key material it refuses). `invalidKey` —
|
|
2663
|
+
* the caller's key cannot be stored at all, whatever the settings: on S3, a
|
|
2664
|
+
* key with a `.` or `..` path segment, which no URL carries as signed.
|
|
2665
|
+
* Nothing is sent.
|
|
2552
2666
|
*/
|
|
2553
|
-
readonly reason: Schema.Literals<readonly ["unreachable", "refused", "misconfigured"]>;
|
|
2667
|
+
readonly reason: Schema.Literals<readonly ["unreachable", "refused", "misconfigured", "invalidKey"]>;
|
|
2554
2668
|
/** The key involved. A stable identifier, never a value. */
|
|
2555
2669
|
readonly key: Schema.optionalKey<Schema.String>;
|
|
2556
2670
|
/** The HTTP status, when the store answered. */
|
|
@@ -2665,16 +2779,23 @@ export declare class BlobStore extends BlobStore_base {
|
|
|
2665
2779
|
* An S3-compatible backend, signed with SigV4.
|
|
2666
2780
|
*
|
|
2667
2781
|
* @remarks
|
|
2668
|
-
* No `@aws-sdk/*` dependency: signing is
|
|
2669
|
-
*
|
|
2670
|
-
*
|
|
2671
|
-
*
|
|
2782
|
+
* No `@aws-sdk/*` dependency: signing is `@effected/crypto`'s `SigV4`, a
|
|
2783
|
+
* specified algorithm over strings and HMACs. The SDK's weight is in
|
|
2784
|
+
* credential management, retries and a service catalogue none of which this
|
|
2785
|
+
* needs.
|
|
2786
|
+
*
|
|
2787
|
+
* Requires core `Crypto` for the SHA-256 digests signing takes, resolved
|
|
2788
|
+
* once when the layer is built; `NodeServices.layer` supplies it. A request
|
|
2789
|
+
* that cannot be signed fails as {@link BlobStoreError} `misconfigured`. A
|
|
2790
|
+
* key with a `.` or `..` path segment fails as `invalidKey` before anything
|
|
2791
|
+
* is signed or sent: every URL parser collapses such a segment, so the store
|
|
2792
|
+
* would receive another path than the one signed.
|
|
2672
2793
|
*
|
|
2673
2794
|
* A parameterized layer factory mints a fresh layer per call and layers
|
|
2674
2795
|
* memoize by reference — bind it to a `const` rather than calling it at each
|
|
2675
2796
|
* composition site.
|
|
2676
2797
|
*/
|
|
2677
|
-
static readonly layerS3: (config: S3Config) => Layer.Layer<BlobStore, never, HttpClient.HttpClient | ActionOutputs>;
|
|
2798
|
+
static readonly layerS3: (config: S3Config) => Layer.Layer<BlobStore, never, HttpClient.HttpClient | ActionOutputs | Crypto.Crypto>;
|
|
2678
2799
|
/** A test double. Unstubbed members die rather than reporting a miss. */
|
|
2679
2800
|
static readonly makeTest: (overrides?: Partial<BlobStoreShape>) => BlobStoreShape;
|
|
2680
2801
|
/** {@link BlobStore.makeTest} behind `Layer.succeed`. */
|
|
@@ -4988,9 +5109,13 @@ export declare class Secret {
|
|
|
4988
5109
|
* Declassify one secret for an in-process use that needs the raw bytes.
|
|
4989
5110
|
*
|
|
4990
5111
|
* @remarks
|
|
4991
|
-
*
|
|
4992
|
-
*
|
|
4993
|
-
*
|
|
5112
|
+
* For a consumer that must hand the raw key to code taking a plain string,
|
|
5113
|
+
* such as a third-party signing library. A signer that takes a `Redacted`
|
|
5114
|
+
* needs no declassification at all: `@effected/crypto`'s `SigV4` and `Hmac`
|
|
5115
|
+
* unwrap the key only where they compute, so a caller of those (this
|
|
5116
|
+
* package's own S3 `BlobStore` is one) registers the value with
|
|
5117
|
+
* {@link Secret.mask} and passes the `Redacted` on. No module in this
|
|
5118
|
+
* package calls this member any more.
|
|
4994
5119
|
*
|
|
4995
5120
|
* Signing named the member; it does not gate it. **Any in-process use that
|
|
4996
5121
|
* needs the raw value without writing it to a runner file is this
|
|
@@ -5015,9 +5140,9 @@ export declare class Secret {
|
|
|
5015
5140
|
* `::add-mask::` command only masks when the runner parses this process's
|
|
5016
5141
|
* stdout; a detached worker's stdout is a log file no runner parses, so
|
|
5017
5142
|
* there the command masks nothing *and* spells the plaintext into the log.
|
|
5018
|
-
* A worker that signs
|
|
5019
|
-
*
|
|
5020
|
-
*
|
|
5143
|
+
* A worker that signs must compose `ActionOutputs.layerDetached`, under
|
|
5144
|
+
* which this member still returns the raw key but the mask is a
|
|
5145
|
+
* documented no-op; the masking
|
|
5021
5146
|
* itself is the **parent's** job, done before the spawn via
|
|
5022
5147
|
* {@link Secret.forChildEnv} under the real layer.
|
|
5023
5148
|
*/
|
|
@@ -5091,5 +5216,5 @@ export declare class Secret {
|
|
|
5091
5216
|
*/
|
|
5092
5217
|
static readonly adopt: (name: string) => Config.Config<Redacted.Redacted<string>>;
|
|
5093
5218
|
}
|
|
5094
|
-
export { type ActionCacheShape, type ActionEnvironmentShape, type ActionLoggerShape, type ActionOutputError, type ActionOutputsShape, type ActionRunOptions, type ActionServices, type ActionStateShape, type AnnotationProperties, type ArtifactItem, type ArtifactRef, type ArtifactShape, type BlobEnvelopeError, type BlobStoreShape, type CacheKeyError, type CheckDocumentOptions, type CheckDocumentShape, type CheckDocumentSink, type CheckFlushOutcome, type CheckRunConclusion, type CheckRunProjection, type ClientLayerOptions, type DataBlobTransfer, type DetachedProcessError, type DetachedProcessOps, type DetachedSpawnOptions, type DownloadOptions, type DownloadResult, type DryRunShape, type ExtractOptions, type FileBlobTransfer, type GitHubHeadingDepth, type GitHubListOptions, type GitHubRowSchema, type GitHubSchemaTable, type GitHubSchemaTableColumn, type GitHubSchemaTableColumns, type GitHubSchemaTableFormatRequiredKeys, type GitHubSchemaTableFormattedColumn, type GitHubSchemaTableOptions, type ManagedDocumentSource, type OidcTokenIssuerShape, type PackageManagerInstallOptions, type PackageManagerInstallerShape, type PairsOptions, type PathPrependEnv, type PathPrependOptions, type ProvisionFileOptions, type ProvisionOptions, type ProvisionedFile, type ReadOptions, type ReadinessOptions, type RecordedOutputMember, type RecordingOutputs, type S3Config, type StoredBlob, type ToolDownloadOptions, type ToolInstallerShape, type UploadOptions, type UploadResult, type WithBufferOptions, type WithStepOptions, WorkflowCommand };
|
|
5219
|
+
export { type ActionCacheShape, type ActionEnvironmentShape, type ActionLoggerShape, type ActionOutputError, type ActionOutputsShape, type ActionRunOptions, type ActionServices, type ActionStateShape, type AnnotationProperties, type ArtifactItem, type ArtifactRef, type ArtifactShape, type BlobEnvelopeError, type BlobStoreShape, type CacheKeyError, type CheckDocumentOptions, type CheckDocumentShape, type CheckDocumentSink, type CheckFlushOutcome, type CheckRunConclusion, type CheckRunProjection, type ClientLayerOptions, type DataBlobTransfer, type DetachedProcessError, type DetachedProcessOps, type DetachedSpawnOptions, type DownloadOptions, type DownloadResult, type DryRunShape, type ExtractOptions, type FileBlobTransfer, type GitHubHeadingDepth, type GitHubListOptions, type GitHubRowSchema, type GitHubSchemaTable, type GitHubSchemaTableColumn, type GitHubSchemaTableColumns, type GitHubSchemaTableFormatRequiredKeys, type GitHubSchemaTableFormattedColumn, type GitHubSchemaTableOptions, type ManagedDocumentSource, type OidcTokenIssuerShape, type PackageManagerInstallOptions, type PackageManagerInstallerShape, type PairsOptions, type PathPrependEnv, type PathPrependOptions, type ProvisionFileOptions, type ProvisionOptions, type ProvisionedFile, type ReadOptions, type ReadinessOptions, type RecordedOutputMember, type RecordingOidcTokenIssuer, type RecordingOutputs, type S3Config, type StoredBlob, type ToolDownloadOptions, type ToolInstallerShape, type UploadOptions, type UploadResult, type WithBufferOptions, type WithStepOptions, WorkflowCommand };
|
|
5095
5220
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -6,12 +6,13 @@ import { ActionState, ActionStateError } from "./ActionState.js";
|
|
|
6
6
|
import { Action, ActionRuntime, describeCause } from "./Action.js";
|
|
7
7
|
import { BlobTransferError } from "./BlobTransfer.js";
|
|
8
8
|
import { ActionCache, ActionCacheError } from "./ActionCache.js";
|
|
9
|
-
import {
|
|
9
|
+
import { OidcTokenError, OidcTokenIssuer } from "./OidcTokenIssuer.js";
|
|
10
10
|
import { ActionsIdentityToken } from "./ActionsIdentityToken.js";
|
|
11
11
|
import { ActionsProvenance } from "./ActionsProvenance.js";
|
|
12
|
+
import { Secret } from "./Secret.js";
|
|
13
|
+
import { ActionsRegistryCredential } from "./ActionsRegistryCredential.js";
|
|
12
14
|
import { Artifact, ArtifactError } from "./Artifact.js";
|
|
13
15
|
import { BlobEnvelope, BlobMetadataDecodeError, BlobMetadataEncodeError, NotABlobEnvelopeError, TruncatedBlobEnvelopeError, UnsupportedBlobEnvelopeVersionError } from "./BlobEnvelope.js";
|
|
14
|
-
import { Secret } from "./Secret.js";
|
|
15
16
|
import { BlobStore, BlobStoreError } from "./BlobStore.js";
|
|
16
17
|
import { GitHubCacheBlobStore } from "./BlobStore.githubCache.js";
|
|
17
18
|
import { CacheKey, CacheKeyBadPatternError, CacheKeyReadError } from "./CacheKey.js";
|
|
@@ -27,4 +28,4 @@ import { ToolInstaller, ToolInstallerError } from "./ToolInstaller.js";
|
|
|
27
28
|
import { AmbientPackageManager, CachedPackageManager, InstalledPackageManager, PackageManagerInstaller, PackageManagerInstallerError } from "./PackageManagerInstaller.js";
|
|
28
29
|
import { WorkflowCommand } from "@effected/github-commands";
|
|
29
30
|
|
|
30
|
-
export { Action, ActionCache, ActionCacheError, ActionEnvironment, ActionEnvironmentError, ActionInput, ActionLogger, ActionOutputs, ActionRuntime, ActionState, ActionStateError, ActionsIdentityToken, ActionsProvenance, AmbientPackageManager, Artifact, ArtifactError, BlobEnvelope, BlobMetadataDecodeError, BlobMetadataEncodeError, BlobStore, BlobStoreError, BlobTransferError, CacheKey, CacheKeyBadPatternError, CacheKeyReadError, CachedPackageManager, CheckDocument, CheckDocumentError, CheckDocumentStamp, CheckReport, CheckState, ChildEnv, DetachedLogUnavailableError, DetachedNotReadyError, DetachedOutputError, DetachedProcess, DetachedSignalFailedError, DetachedSpawnFailedError, DryRun, GitHubCacheBlobStore, GitHubContext, GitHubMarkdown, GitHubToken, GitHubTokenError, InstalledPackageManager, InvalidOutputNameError, InvalidPidError, ManagedDocument, ManagedDocumentError, NotABlobEnvelopeError,
|
|
31
|
+
export { Action, ActionCache, ActionCacheError, ActionEnvironment, ActionEnvironmentError, ActionInput, ActionLogger, ActionOutputs, ActionRuntime, ActionState, ActionStateError, ActionsIdentityToken, ActionsProvenance, ActionsRegistryCredential, AmbientPackageManager, Artifact, ArtifactError, BlobEnvelope, BlobMetadataDecodeError, BlobMetadataEncodeError, BlobStore, BlobStoreError, BlobTransferError, CacheKey, CacheKeyBadPatternError, CacheKeyReadError, CachedPackageManager, CheckDocument, CheckDocumentError, CheckDocumentStamp, CheckReport, CheckState, ChildEnv, DetachedLogUnavailableError, DetachedNotReadyError, DetachedOutputError, DetachedProcess, DetachedSignalFailedError, DetachedSpawnFailedError, DryRun, GitHubCacheBlobStore, GitHubContext, GitHubMarkdown, GitHubToken, GitHubTokenError, InstalledPackageManager, InvalidOutputNameError, InvalidPidError, ManagedDocument, ManagedDocumentError, NotABlobEnvelopeError, OidcTokenError, OidcTokenIssuer, OutputEncodeError, PackageManagerInstaller, PackageManagerInstallerError, ProcessId, RecordedOutput, RunnerContext, RunnerFileUnavailableError, RunnerFileWriteError, Secret, ToolInstaller, ToolInstallerError, TruncatedBlobEnvelopeError, UnsupportedBlobEnvelopeVersionError, WorkflowCommand, describeCause, projectCheckState };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { payloadOf } from "./jwt.js";
|
|
2
1
|
import { Effect, Option, Redacted, Result } from "effect";
|
|
2
|
+
import { Jws } from "@effected/jwt";
|
|
3
3
|
|
|
4
4
|
// src/internal/actionsResults.ts
|
|
5
5
|
/** The variable naming the backend. Absent outside a `uses:` step. */
|
|
@@ -26,9 +26,10 @@ const misconfiguredDetail = (variable, service) => `${variable} is not set — t
|
|
|
26
26
|
* @internal
|
|
27
27
|
*/
|
|
28
28
|
const backendIdsFrom = (token) => {
|
|
29
|
-
const
|
|
30
|
-
if (Result.isFailure(
|
|
31
|
-
const
|
|
29
|
+
const decoded = Jws.decodeUnverified(token);
|
|
30
|
+
if (Result.isFailure(decoded)) return Result.fail(`the runtime token is not a readable JWT: ${decoded.failure.detail}`);
|
|
31
|
+
const payload = decoded.success.payload;
|
|
32
|
+
const scope = typeof payload === "object" && payload !== null ? payload.scp : void 0;
|
|
32
33
|
if (typeof scope !== "string") return Result.fail("the runtime token carries no `scp` claim");
|
|
33
34
|
for (const entry of scope.split(" ")) {
|
|
34
35
|
const parts = entry.split(":");
|