Skip to content

Commit 32da42f

Browse files
carderneTrigger.dev RepoOps
authored andcommitted
fix(webapp): start runs with proxy-only variables
Mono-RevId: f59684725d790957488b9d85e702fd67caa26ca7
1 parent b09836c commit 32da42f

3 files changed

Lines changed: 22 additions & 18 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: fix
4+
---
5+
6+
Runs with proxy-only variables can start even when the resolver's caller authentication is not configured on the service that starts attempts.

‎apps/webapp/app/services/secretProxy/service.server.ts‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,16 @@ export class SecretProxyService {
119119
}
120120

121121
#assertConfigured() {
122-
if (
123-
!this.options.enabled ||
124-
!this.options.keyring ||
125-
!this.options.issuer ||
126-
!this.options.caller
127-
) {
122+
if (!this.options.enabled || !this.options.keyring || !this.options.issuer) {
128123
throw new SecretProxyDeniedError("Secret proxy is disabled", "disabled");
129124
}
130125
}
131126

132127
async #claims(token: string): Promise<RunTokenClaims & { exp: number }> {
133128
this.#assertConfigured();
129+
if (!this.options.caller) {
130+
throw new SecretProxyDeniedError("Secret proxy is disabled", "disabled");
131+
}
134132
const claims = await verifyRunTokenWithExpiry({
135133
token,
136134
jwks: await this.options.publicJwks(),

‎apps/webapp/test/secretProxy.test.ts‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,28 +1199,28 @@ describe("secret proxy integration", () => {
11991199
const metadata = await effectiveEnvironmentVariables(prisma, f.project.id, f.environment.id);
12001200
const token = await f.sign();
12011201
const proxyValues = metadata.filter((value) => value.isProxyOnly);
1202-
const hosts = await f.service.preflightRuntime(
1202+
const runtime = new SecretProxyService({ ...f.options, enabled: true, caller: undefined });
1203+
const hosts = await runtime.preflightRuntime(
12031204
f.project.id,
12041205
f.environment.id,
12051206
proxyValues,
12061207
true,
12071208
true
12081209
);
1209-
const delivery = f.service.finalizeRuntime(proxyValues, hosts, {
1210+
const delivery = runtime.finalizeRuntime(proxyValues, hosts, {
12101211
runId: f.run.friendlyId,
12111212
attempt: 1,
12121213
expiresAtMs: decodeJwt(token).exp! * 1000,
12131214
});
1214-
expect(delivery.placeholders).toEqual([
1215-
{
1216-
key: "API_TOKEN",
1217-
value: placeholderForVariable(
1218-
placeholderKeys,
1219-
{ runId: f.run.friendlyId, attempt: 1 },
1220-
protectedValue.variable.id
1221-
),
1222-
},
1223-
]);
1215+
const handle = placeholderForVariable(
1216+
placeholderKeys,
1217+
{ runId: f.run.friendlyId, attempt: 1 },
1218+
protectedValue.variable.id
1219+
);
1220+
expect(delivery.placeholders).toEqual([{ key: "API_TOKEN", value: handle }]);
1221+
await expect(runtime.resolve(token, requestFor(handle))).rejects.toMatchObject({
1222+
reason: "disabled",
1223+
});
12241224
expect(delivery.secretProxy).toMatchObject({
12251225
runId: f.run.friendlyId,
12261226
attempt: 1,

0 commit comments

Comments
 (0)