Skip to content

Commit

Permalink
fix: bypassSignatureVerification
Browse files Browse the repository at this point in the history
  • Loading branch information
whilefoo committed Nov 21, 2024
1 parent 96517a9 commit 96449e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ interface Options {
envSchema?: TAnySchema;
commandSchema?: TAnySchema;
kernelPublicKey?: string;
disableSignatureVerification?: boolean; // only use for local development
/**
* @deprecated This disables signature verification - only for local development
*/
bypassSignatureVerification?: boolean;
}

const inputSchema = T.Object({
Expand All @@ -48,7 +51,7 @@ export async function createActionsPlugin<TConfig = unknown, TEnv = unknown, TCo
envSchema: options?.envSchema,
commandSchema: options?.commandSchema,
kernelPublicKey: options?.kernelPublicKey ?? KERNEL_PUBLIC_KEY,
disableSignatureVerification: options?.disableSignatureVerification || false,
bypassSignatureVerification: options?.bypassSignatureVerification || false,
};

const pluginGithubToken = process.env.PLUGIN_GITHUB_TOKEN;
Expand All @@ -59,7 +62,7 @@ export async function createActionsPlugin<TConfig = unknown, TEnv = unknown, TCo

const body = github.context.payload.inputs;
const signature = body.signature;
if (!pluginOptions.disableSignatureVerification && !(await verifySignature(pluginOptions.kernelPublicKey, body, signature))) {
if (!pluginOptions.bypassSignatureVerification && !(await verifySignature(pluginOptions.kernelPublicKey, body, signature))) {
core.setFailed(`Error: Invalid signature`);
return;
}
Expand Down
3 changes: 3 additions & 0 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ interface Options {
settingsSchema?: TAnySchema;
envSchema?: TAnySchema;
commandSchema?: TAnySchema;
/**
* @deprecated This disables signature verification - only for local development
*/
bypassSignatureVerification?: boolean;
}

Expand Down

0 comments on commit 96449e0

Please sign in to comment.