@pattform/api-kit 2.6.4 → 2.6.6
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/FormComponent.js +34 -13
- package/package.json +1 -1
package/dist/FormComponent.js
CHANGED
|
@@ -112,8 +112,40 @@ class FormComponent extends pulumi.ComponentResource {
|
|
|
112
112
|
provider: awsProvider,
|
|
113
113
|
parent: this,
|
|
114
114
|
});
|
|
115
|
+
// A Function URL with AuthType NONE is still private until a
|
|
116
|
+
// resource-based policy grants public invoke. The AWS Console adds this
|
|
117
|
+
// automatically; created via IaC it must be declared explicitly, or
|
|
118
|
+
// every browser POST is rejected with 403 Forbidden. Create it before
|
|
119
|
+
// the URL so the URL binds against an already-public function.
|
|
120
|
+
const urlPermission = new aws.lambda.Permission(`${baseName}-url-public-${env}`, {
|
|
121
|
+
action: "lambda:InvokeFunctionUrl",
|
|
122
|
+
function: this.lambda.name,
|
|
123
|
+
principal: "*",
|
|
124
|
+
functionUrlAuthType: "NONE",
|
|
125
|
+
}, {
|
|
126
|
+
provider: awsProvider,
|
|
127
|
+
parent: this,
|
|
128
|
+
});
|
|
129
|
+
// Since October 2025, public NONE function URLs require BOTH
|
|
130
|
+
// lambda:InvokeFunctionUrl and lambda:InvokeFunction in the resource
|
|
131
|
+
// policy — with only the former, every invoke returns 403 Forbidden
|
|
132
|
+
// (AccessDeniedException) despite AuthType NONE. AWS's default policy
|
|
133
|
+
// scopes this with a lambda:InvokedViaFunctionUrl=true condition, which
|
|
134
|
+
// aws.lambda.Permission can't express; omitting it is safe here because
|
|
135
|
+
// anonymous callers can't reach the Invoke API and the handler validates
|
|
136
|
+
// every request (Turnstile + schema) regardless of invocation path.
|
|
137
|
+
const invokePermission = new aws.lambda.Permission(`${baseName}-invoke-public-${env}`, {
|
|
138
|
+
action: "lambda:InvokeFunction",
|
|
139
|
+
function: this.lambda.name,
|
|
140
|
+
principal: "*",
|
|
141
|
+
}, {
|
|
142
|
+
provider: awsProvider,
|
|
143
|
+
parent: this,
|
|
144
|
+
});
|
|
115
145
|
// Preflight OPTIONS requests are answered by the Function URL itself;
|
|
116
146
|
// only same-configured origins can read responses from the browser.
|
|
147
|
+
// deleteBeforeReplace: a function may have only one URL config, so a
|
|
148
|
+
// replacement must delete the old one first (create-before-delete 409s).
|
|
117
149
|
this.functionUrl = new aws.lambda.FunctionUrl(`${baseName}-url-${env}`, {
|
|
118
150
|
functionName: this.lambda.name,
|
|
119
151
|
authorizationType: "NONE",
|
|
@@ -126,19 +158,8 @@ class FormComponent extends pulumi.ComponentResource {
|
|
|
126
158
|
}, {
|
|
127
159
|
provider: awsProvider,
|
|
128
160
|
parent: this,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
// resource-based policy grants public invoke. The AWS Console adds this
|
|
132
|
-
// automatically; created via IaC it must be declared explicitly, or
|
|
133
|
-
// every browser POST is rejected with 403 Forbidden.
|
|
134
|
-
new aws.lambda.Permission(`${baseName}-url-public-${env}`, {
|
|
135
|
-
action: "lambda:InvokeFunctionUrl",
|
|
136
|
-
function: this.lambda.name,
|
|
137
|
-
principal: "*",
|
|
138
|
-
functionUrlAuthType: "NONE",
|
|
139
|
-
}, {
|
|
140
|
-
provider: awsProvider,
|
|
141
|
-
parent: this,
|
|
161
|
+
dependsOn: [urlPermission, invokePermission],
|
|
162
|
+
deleteBeforeReplace: true,
|
|
142
163
|
});
|
|
143
164
|
this.endpoint = this.functionUrl.functionUrl;
|
|
144
165
|
this.turnstileSiteKey = pulumi.output(turnstileSiteKey);
|