@gadicc/loom 2.1.0 → 2.1.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"githubOidc.d.ts","sourceRoot":"","sources":["../../../source/src/release/githubOidc.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,WAAW,6BAA6B;IAC5C,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAClD,6EAA6E;IAC7E,oBAAoB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAuCD;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,6BAA6B,IAyGpC,MAAM,MAAM,GAAG,GAAG,EAClB,OAAM,WAAgB,KACrB,OAAO,CAAC,QAAQ,CAAC,CAqCrB"}
1
+ {"version":3,"file":"githubOidc.d.ts","sourceRoot":"","sources":["../../../source/src/release/githubOidc.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,WAAW,6BAA6B;IAC5C,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAClD,6EAA6E;IAC7E,oBAAoB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAuCD;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,6BAA6B,IAoHpC,MAAM,MAAM,GAAG,GAAG,EAClB,OAAM,WAAgB,KACrB,OAAO,CAAC,QAAQ,CAAC,CAqCrB"}
@@ -83,6 +83,7 @@ export function createGithubActionsOidcFetch(options) {
83
83
  let cached;
84
84
  let pending;
85
85
  async function acquire() {
86
+ let phase = "transport";
86
87
  try {
87
88
  const response = await fetchImpl(endpoint, {
88
89
  headers: {
@@ -93,16 +94,23 @@ export function createGithubActionsOidcFetch(options) {
93
94
  cache: "no-store",
94
95
  signal: AbortSignal.timeout(30_000),
95
96
  });
96
- if (!response.ok)
97
+ if (!response.ok) {
98
+ phase = `http-${response.status}`;
99
+ await response.body?.cancel();
97
100
  throw new Error("Identity request denied");
101
+ }
102
+ phase = "response";
98
103
  const token = object(await readJson(response)).value;
104
+ phase = "token";
99
105
  if (typeof token !== "string" ||
100
106
  !token ||
101
107
  token.length > 32_768 ||
102
108
  /[\r\n]/.test(token)) {
103
109
  throw new Error("Invalid identity token");
104
110
  }
111
+ phase = "masking";
105
112
  mask(token);
113
+ phase = "token";
106
114
  const segments = token.split(".");
107
115
  if (segments.length !== 3 ||
108
116
  segments.some((part) => !/^[A-Za-z0-9_-]+$/.test(part))) {
@@ -110,18 +118,22 @@ export function createGithubActionsOidcFetch(options) {
110
118
  }
111
119
  const claims = object(JSON.parse(atob(segments[1].replaceAll("-", "+").replaceAll("_", "/"))));
112
120
  // Cache hints and configuration sanity only; these are not signature verification.
113
- if (claims.iss !== issuer ||
114
- claims.aud !== audience ||
115
- typeof claims.exp !== "number" ||
121
+ phase = "issuer";
122
+ if (claims.iss !== issuer)
123
+ throw new Error("Invalid identity issuer");
124
+ phase = "audience";
125
+ if (claims.aud !== audience)
126
+ throw new Error("Invalid identity audience");
127
+ phase = "expiry";
128
+ if (typeof claims.exp !== "number" ||
116
129
  !Number.isSafeInteger(claims.exp) ||
117
- claims.exp * 1000 <= now() + 30_000) {
118
- throw new Error("Invalid identity claims");
119
- }
130
+ claims.exp * 1000 <= now() + 30_000)
131
+ throw new Error("Invalid identity expiry");
120
132
  return { token, expires: claims.exp * 1000 };
121
133
  }
122
134
  catch {
123
135
  // Transport exceptions can contain request headers. Never expose their cause.
124
- throw new Error("GitHub OIDC token acquisition failed");
136
+ throw new Error(`GitHub OIDC token acquisition failed (${phase})`);
125
137
  }
126
138
  }
127
139
  async function token() {
@@ -1 +1 @@
1
- {"version":3,"file":"githubOidc.js","sourceRoot":"","sources":["../../../source/src/release/githubOidc.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,GAAG,iCAAiC,CAAC;AACjD,MAAM,MAAM,GAAG,6CAA6C,CAAC;AAC7D,MAAM,OAAO,GAAG,MAAM,CAAC;AAEvB,KAAK,UAAU,QAAQ,CAAC,QAAkB;IACxC,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC;IAC1C,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACtD,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,CAAC;QACH,SAAS,CAAC;YACR,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAC5C,IAAI,IAAI;gBAAE,MAAM;YAChB,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC;YACrB,IAAI,IAAI,GAAG,OAAO;gBAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;YAC1D,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,MAAM,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IACD,MAAM,KAAK,GAAG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AC;gBACD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;YACpD,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CACb,oGAAoG,CACrG,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,EAAE,CAAC,CAAC;QACnC,IAAI,CAAC;YACH,OAAO,MAAM,SAAS,CAAC,WAAW,EAAE;gBAClC,GAAG,IAAI;gBACP,OAAO;gBACP,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK;gBAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,QAAQ;gBACnC,KAAK,EAAE,UAAU;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC;aACnD,CAAC,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gadicc/loom",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Shared helpers and verification tooling for Next.js applications.",
5
5
  "homepage": "https://github.com/gadicc/loom#readme",
6
6
  "repository": {
@@ -11,7 +11,7 @@
11
11
  "url": "https://github.com/gadicc/loom/issues"
12
12
  },
13
13
  "loom": {
14
- "gitCommit": "933e6a54831bf15b6d18539bfbb588551e2e9e58"
14
+ "gitCommit": "10f7ecc2516ddb9dad8b39f7cde410e2fdddec6c"
15
15
  },
16
16
  "type": "module",
17
17
  "main": "./esm/mod.js",
@@ -136,6 +136,11 @@ and approval. Finding a skill does not authorize installing or following it.
136
136
  - For a Loom DB release, read [release safety](references/release-safety.md)
137
137
  before deployment or credential commands. Preserve the recorded release mode;
138
138
  never print secrets or switch deployment paths after authentication failure.
139
+ - When `loom check` recommends OIDC for protected release HTTP checks, read
140
+ [Trusted Sources adoption](references/release-trusted-sources.md). Explain the
141
+ app-specific policy/workflow change before adoption. Checking does not change
142
+ provider settings or retire secrets; deployment/promotion still needs its
143
+ separate Vercel API credential.
139
144
 
140
145
  ## Re-establishing work context
141
146
 
@@ -109,14 +109,16 @@ required smoke check. Preserve the configured project-token or team-token mode.
109
109
  cannot mint tokens, create a bounded project token in Vercel and install it
110
110
  through GitHub's hidden environment-secret input rather than broadening its
111
111
  scope.
112
- - Smoke check the staged deployment URL after promotion with normal `curl`.
113
- Existing workflows may continue to create a short-lived Vercel Protection
114
- Bypass for Automation secret through the Vercel API, send it as the
115
- `x-vercel-protection-bypass` header, and revoke it in the same step. Apps may
116
- instead adopt the reviewed GitHub OIDC Trusted Sources flow with
117
- `loom db release trust-plan`, `trust-apply`, and `trust-check`; see
118
- [trusted-source setup](release-trusted-sources.md). Keep either change
119
- app-owned and deliberate. Avoid the beta `vercel curl` command in CI.
112
+ - Smoke check the immutable staged deployment before promotion and verify the
113
+ canonical alias after promotion. Prefer reviewed GitHub OIDC Trusted Sources
114
+ with `createGithubActionsOidcFetch` from `@gadicc/loom/release` for protected
115
+ HTTP checks; see [trusted-source setup](release-trusted-sources.md) for
116
+ `trust-plan`, `trust-apply`, `trust-check` and live acceptance. OIDC replaces
117
+ the HTTP protection bypass, not the deployment/promotion API credential or
118
+ application authentication. Existing bypass-secret workflows remain supported:
119
+ use normal `curl` with `x-vercel-protection-bypass` and revoke temporary secrets
120
+ after checks, including failure cleanup. Adoption remains app-owned and
121
+ deliberate. Avoid the beta `vercel curl` command in CI.
120
122
  - Production migrations must remain backward-compatible with the currently live
121
123
  app because old code continues serving traffic until the staged deployment is
122
124
  promoted. Use expand/contract migrations for destructive schema changes.
@@ -5,6 +5,30 @@ through Deployment Protection. This replaces the workflow's create/check/revoke
5
5
  HTTP bypass-secret sequence. The Vercel deployment API credential is separate:
6
6
  OIDC access to a deployed app does not grant permission to deploy or promote it.
7
7
 
8
+ ## Discover adoption opportunities
9
+
10
+ `loom check` reports optional adoption advisories for bypass-secret references
11
+ and app-owned OIDC HTTP acquisition in GitHub workflow steps. It also inspects
12
+ literal `.js`, `.mjs`, `.cjs`, `.ts`, `.mts`, `.cts` and `.sh` references under
13
+ `scripts/` or `.github/` in enabled `run` steps. It skips missing, unreadable,
14
+ oversized (over 256 KiB) and out-of-project script targets. It does not execute
15
+ scripts, follow imports, resolve task aliases, or prove workflow correctness;
16
+ dynamic commands and reusable workflows need manual inspection. Absence of an
17
+ advisory is not proof that a trust policy exists or that OIDC works.
18
+
19
+ These advisories stay warnings under `--production`; existing bypass workflows
20
+ remain supported. Neither `loom check` nor `loom check --network` applies a
21
+ trust policy, revokes credentials or runs live acceptance. Verify a reviewed
22
+ policy explicitly with `loom db release trust-check <plan>`.
23
+
24
+ Agents should read this guide when an advisory appears, explain the app-specific
25
+ changes and preserve its existing release mode until deliberate adoption. Keep
26
+ separate plans for custom beta/preview environments: the current planner targets
27
+ production only. Upgrade the app's published Loom dependency and managed skills
28
+ to receive these checks and guidance; publishing Loom alone does not update apps.
29
+
30
+ ## Review and configure the policy
31
+
8
32
  Use the consuming application's linked Vercel project, canonical GitHub
9
33
  repository, configured production branch and actual workflow path. For example:
10
34
 
@@ -76,7 +100,10 @@ The helper masks the request credential and JWT before use, coalesces concurrent
76
100
  identity requests and refreshes 30 seconds before expiry. It refuses other
77
101
  origins, redirects that would follow, caller-supplied OIDC/bypass headers and
78
102
  non-read-only requests. It returns manual redirect responses for app assertions,
79
- uses bounded timeouts and sanitizes transport errors. It has no bypass fallback.
103
+ uses bounded timeouts and sanitizes transport errors. Acquisition errors expose
104
+ only a fixed phase (`transport`, `http-<status>`, `response`, `token`, `masking`,
105
+ `issuer`, `audience` or `expiry`), without response bodies, URLs or causes.
106
+ It has no bypass fallback.
80
107
  JWT decoding only supplies cache/sanity hints; Vercel verifies signature and all
81
108
  configured identity claims.
82
109
 
@@ -10042,8 +10042,9 @@ async function checkDbProductionMigrationFlow(
10042
10042
  "DB production migration flow still uses beta `vercel curl` for smoke checks: " +
10043
10043
  [...new Set(vercelCurlWorkflowPaths)].join(", "),
10044
10044
  );
10045
+ suggestions.add(GITHUB_RELEASE_OIDC_ADOPTION);
10045
10046
  suggestions.add(
10046
- "Use the Vercel Protection Bypass for Automation API to create a short-lived bypass secret, smoke check the staged deployment URL with normal `curl` and the `x-vercel-protection-bypass` header, then revoke the bypass secret.",
10047
+ "Existing bypass-secret workflows remain supported: use normal `curl` with the `x-vercel-protection-bypass` header and revoke temporary bypass secrets after checks, including failure cleanup.",
10047
10048
  );
10048
10049
  }
10049
10050
 
@@ -10054,6 +10055,41 @@ async function checkDbProductionMigrationFlow(
10054
10055
  };
10055
10056
  }
10056
10057
 
10058
+ const GITHUB_RELEASE_OIDC_ADOPTION =
10059
+ "Consider reviewed GitHub OIDC Trusted Sources for protected HTTP checks: read the Loom skill's references/release-trusted-sources.md, run `loom db release trust-plan`, review and apply with `trust-apply`, verify with `trust-check`, then use `createGithubActionsOidcFetch` from `@gadicc/loom/release`. Keep VERCEL_TOKEN for deployment/promotion. Prove live allowed and denied access before removing the old bypass; `loom check` does not apply policies or revoke credentials.";
10060
+
10061
+ /**
10062
+ * Advisory inventory only: inspect enabled steps and their literal local script
10063
+ * references, never execute commands or traverse arbitrary imports/task graphs.
10064
+ */
10065
+ async function githubReleaseHttpAuthSources(cwd: string, workflow: string) {
10066
+ const steps = getGithubWorkflowStepBlocks(
10067
+ stripWorkflowComments(workflow),
10068
+ ).filter((block) => !workflowStepIsDisabled(block));
10069
+ const sources = new Map([["workflow", steps.join("\n")]]);
10070
+ const root = await realpath(cwd);
10071
+ const scriptPattern =
10072
+ /(?:^|[\s"'`])((?:\.\/)?(?:scripts|\.github)\/[A-Za-z0-9_./-]+\.(?:[cm]?[jt]s|sh))(?=$|[\s"'`])/gm;
10073
+ for (const step of steps) {
10074
+ if (!/^\s*(?:-\s*)?run:\s*/m.test(step)) continue;
10075
+ for (const match of step.matchAll(scriptPattern)) {
10076
+ const path = match[1].replace(/^\.\//, "");
10077
+ if (path.split("/").includes("..") || sources.has(path)) continue;
10078
+ try {
10079
+ const target = await realpath(join(root, path));
10080
+ if (!target.startsWith(root + sep)) continue;
10081
+ const info = await stat(target);
10082
+ if (!info.isFile() || info.size > 256 * 1024) continue;
10083
+ sources.set(path, await readFile(target, "utf8"));
10084
+ } catch {
10085
+ // Missing/unreadable scripts provide no adoption evidence. This is not
10086
+ // a workflow validator, and diagnostics must never echo script content.
10087
+ }
10088
+ }
10089
+ }
10090
+ return sources;
10091
+ }
10092
+
10057
10093
  async function checkGithubActionsWorkflows(cwd: string) {
10058
10094
  const warnings: string[] = [];
10059
10095
  const suggestions = new Set<string>();
@@ -10065,6 +10101,35 @@ async function checkGithubActionsWorkflows(cwd: string) {
10065
10101
  }
10066
10102
 
10067
10103
  const normalized = normalizeText(workflowText);
10104
+ const httpAuthSources = await githubReleaseHttpAuthSources(cwd, normalized);
10105
+ for (const [sourcePath, text] of httpAuthSources) {
10106
+ const source =
10107
+ sourcePath === "workflow"
10108
+ ? relativePath
10109
+ : `${relativePath} -> ${sourcePath}`;
10110
+ if (
10111
+ /\bx-vercel-protection-bypass\b|\bVERCEL_(?:AUTOMATION_BYPASS_SECRET|PROTECTION_BYPASS)\b/i.test(
10112
+ text,
10113
+ )
10114
+ ) {
10115
+ warnings.push(
10116
+ `GitHub Actions protected HTTP checks retain bypass-secret references (OIDC adoption is optional): ${source}`,
10117
+ );
10118
+ suggestions.add(GITHUB_RELEASE_OIDC_ADOPTION);
10119
+ }
10120
+ if (
10121
+ /\bx-vercel-trusted-oidc-idp-token\b/i.test(text) &&
10122
+ /\bACTIONS_ID_TOKEN_REQUEST_URL\b|\bgetIDToken\s*\(/.test(text)
10123
+ ) {
10124
+ warnings.push(
10125
+ `GitHub Actions protected HTTP checks implement OIDC token acquisition locally: ${source}`,
10126
+ );
10127
+ suggestions.add(
10128
+ "Consider Loom's `createGithubActionsOidcFetch` from `@gadicc/loom/release` for shared masking, token refresh and origin/redirect restrictions. Preserve the app's readiness/auth assertions and reviewed trust policy; see the Loom skill's references/release-trusted-sources.md.",
10129
+ );
10130
+ }
10131
+ }
10132
+
10068
10133
  const stepBlocks = getGithubWorkflowStepBlocks(normalized);
10069
10134
  if (!workflowInstallsNodeDependencies(stepBlocks)) {
10070
10135
  continue;
@@ -102,6 +102,7 @@ export function createGithubActionsOidcFetch(
102
102
  let cached: { token: string; expires: number } | undefined;
103
103
  let pending: Promise<{ token: string; expires: number }> | undefined;
104
104
  async function acquire() {
105
+ let phase = "transport";
105
106
  try {
106
107
  const response = await fetchImpl(endpoint, {
107
108
  headers: {
@@ -112,8 +113,14 @@ export function createGithubActionsOidcFetch(
112
113
  cache: "no-store",
113
114
  signal: AbortSignal.timeout(30_000),
114
115
  });
115
- if (!response.ok) throw new Error("Identity request denied");
116
+ if (!response.ok) {
117
+ phase = `http-${response.status}`;
118
+ await response.body?.cancel();
119
+ throw new Error("Identity request denied");
120
+ }
121
+ phase = "response";
116
122
  const token = object(await readJson(response)).value;
123
+ phase = "token";
117
124
  if (
118
125
  typeof token !== "string" ||
119
126
  !token ||
@@ -122,7 +129,9 @@ export function createGithubActionsOidcFetch(
122
129
  ) {
123
130
  throw new Error("Invalid identity token");
124
131
  }
132
+ phase = "masking";
125
133
  mask(token);
134
+ phase = "token";
126
135
  const segments = token.split(".");
127
136
  if (
128
137
  segments.length !== 3 ||
@@ -134,19 +143,21 @@ export function createGithubActionsOidcFetch(
134
143
  JSON.parse(atob(segments[1].replaceAll("-", "+").replaceAll("_", "/"))),
135
144
  );
136
145
  // Cache hints and configuration sanity only; these are not signature verification.
146
+ phase = "issuer";
147
+ if (claims.iss !== issuer) throw new Error("Invalid identity issuer");
148
+ phase = "audience";
149
+ if (claims.aud !== audience) throw new Error("Invalid identity audience");
150
+ phase = "expiry";
137
151
  if (
138
- claims.iss !== issuer ||
139
- claims.aud !== audience ||
140
152
  typeof claims.exp !== "number" ||
141
153
  !Number.isSafeInteger(claims.exp) ||
142
154
  claims.exp * 1000 <= now() + 30_000
143
- ) {
144
- throw new Error("Invalid identity claims");
145
- }
155
+ )
156
+ throw new Error("Invalid identity expiry");
146
157
  return { token, expires: claims.exp * 1000 };
147
158
  } catch {
148
159
  // Transport exceptions can contain request headers. Never expose their cause.
149
- throw new Error("GitHub OIDC token acquisition failed");
160
+ throw new Error(`GitHub OIDC token acquisition failed (${phase})`);
150
161
  }
151
162
  }
152
163
  async function token() {