@kirkelliott/zap 0.1.9 → 0.1.11

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/dist/cli.js CHANGED
@@ -219,7 +219,14 @@ program
219
219
  await lambda.send(new client_lambda_1.RemovePermissionCommand({ FunctionName: fn, StatementId: 'public-access' }));
220
220
  }
221
221
  catch { }
222
+ for (const sid of ['public-access', 'public-invoke', 'FunctionURLAllowPublicAccess']) {
223
+ try {
224
+ await lambda.send(new client_lambda_1.RemovePermissionCommand({ FunctionName: fn, StatementId: sid }));
225
+ }
226
+ catch { }
227
+ }
222
228
  await lambda.send(new client_lambda_1.AddPermissionCommand({ FunctionName: fn, StatementId: 'public-access', Action: 'lambda:InvokeFunctionUrl', Principal: '*', FunctionUrlAuthType: 'NONE' }));
229
+ await lambda.send(new client_lambda_1.AddPermissionCommand({ FunctionName: fn, StatementId: 'public-invoke', Action: 'lambda:InvokeFunction', Principal: '*' }));
223
230
  console.log('✓ permissions repaired');
224
231
  if (cfg.url)
225
232
  console.log(`\n → ${cfg.url.trim()}\n`);
package/dist/init.js CHANGED
@@ -25,10 +25,12 @@ const policy = (bucket) => JSON.stringify({
25
25
  ],
26
26
  });
27
27
  async function allowPublicUrl(lambda, functionArn) {
28
- try {
29
- await lambda.send(new client_lambda_1.RemovePermissionCommand({ FunctionName: functionArn, StatementId: 'public-access' }));
28
+ for (const sid of ['public-access', 'public-invoke', 'FunctionURLAllowPublicAccess']) {
29
+ try {
30
+ await lambda.send(new client_lambda_1.RemovePermissionCommand({ FunctionName: functionArn, StatementId: sid }));
31
+ }
32
+ catch { }
30
33
  }
31
- catch { }
32
34
  await lambda.send(new client_lambda_1.AddPermissionCommand({
33
35
  FunctionName: functionArn,
34
36
  StatementId: 'public-access',
@@ -36,6 +38,12 @@ async function allowPublicUrl(lambda, functionArn) {
36
38
  Principal: '*',
37
39
  FunctionUrlAuthType: 'NONE',
38
40
  }));
41
+ await lambda.send(new client_lambda_1.AddPermissionCommand({
42
+ FunctionName: functionArn,
43
+ StatementId: 'public-invoke',
44
+ Action: 'lambda:InvokeFunction',
45
+ Principal: '*',
46
+ }));
39
47
  }
40
48
  function step(label) {
41
49
  process.stdout.write(` ${label.padEnd(24)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kirkelliott/zap",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Drop a .zap file in S3. It becomes an API endpoint.",
5
5
  "main": "dist/handler.js",
6
6
  "bin": {