@anthusai/papyrus 1.0.0-next.42 → 1.0.0-next.43
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.
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IAM statement for the content-actions Lambda's read of the revalidate secret.
|
|
3
|
+
* Pure (no CDK imports) so the policy can be tested without synthesizing.
|
|
4
|
+
* The Lambda reads the parameter through boto3 get_parameters (plural), so the
|
|
5
|
+
* plural action must be granted alongside the singular one.
|
|
6
|
+
*/
|
|
7
|
+
export const REVALIDATE_SECRET_READ_ACTIONS = ["ssm:GetParameter", "ssm:GetParameters"];
|
|
8
|
+
export function revalidateSecretReadStatement(input) {
|
|
9
|
+
return {
|
|
10
|
+
actions: REVALIDATE_SECRET_READ_ACTIONS,
|
|
11
|
+
resources: [`arn:${input.partition}:ssm:${input.region}:${input.account}:parameter${input.parameterName}`],
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IAM statement for the content-actions Lambda's read of the revalidate secret.
|
|
3
|
+
* Pure (no CDK imports) so the policy can be tested without synthesizing.
|
|
4
|
+
* The Lambda reads the parameter through boto3 get_parameters (plural), so the
|
|
5
|
+
* plural action must be granted alongside the singular one.
|
|
6
|
+
*/
|
|
7
|
+
export const REVALIDATE_SECRET_READ_ACTIONS = ["ssm:GetParameter", "ssm:GetParameters"];
|
|
8
|
+
|
|
9
|
+
export function revalidateSecretReadStatement(input: {
|
|
10
|
+
partition: string;
|
|
11
|
+
region: string;
|
|
12
|
+
account: string;
|
|
13
|
+
parameterName: string;
|
|
14
|
+
}): { actions: string[]; resources: string[] } {
|
|
15
|
+
return {
|
|
16
|
+
actions: REVALIDATE_SECRET_READ_ACTIONS,
|
|
17
|
+
resources: [`arn:${input.partition}:ssm:${input.region}:${input.account}:parameter${input.parameterName}`],
|
|
18
|
+
};
|
|
19
|
+
}
|
package/amplify/site-backend.js
CHANGED
|
@@ -8,6 +8,7 @@ import { dirname, resolve } from "node:path";
|
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
9
|
import { DEFAULT_RESOLVER_WAVE_SIZE, orderModelStacksInWaves } from "./resolver-waves.js";
|
|
10
10
|
import { rebuildTriggerSettings } from "./rebuild-trigger-settings.js";
|
|
11
|
+
import { revalidateSecretReadStatement } from "./revalidate-secret-policy.js";
|
|
11
12
|
import { applyCognitoDomainPrefix, authConfigFromEnv, defineSiteAuth } from "./auth/resource.js";
|
|
12
13
|
import { data } from "./data/resource.js";
|
|
13
14
|
import { assignmentAction } from "./functions/assignment-action/resource.js";
|
|
@@ -309,10 +310,12 @@ export function defineSiteBackend(papyrusSite) {
|
|
|
309
310
|
}
|
|
310
311
|
backend.contentActions.addEnvironment("PAPYRUS_REVALIDATE_SECRET_PARAMETER", revalidateSecretParameter);
|
|
311
312
|
const revalidateStack = Stack.of(contentActionsLambda);
|
|
312
|
-
contentActionsLambda.addToRolePolicy(new PolicyStatement({
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
313
|
+
contentActionsLambda.addToRolePolicy(new PolicyStatement(revalidateSecretReadStatement({
|
|
314
|
+
partition: revalidateStack.partition,
|
|
315
|
+
region: revalidateStack.region,
|
|
316
|
+
account: revalidateStack.account,
|
|
317
|
+
parameterName: revalidateSecretParameter,
|
|
318
|
+
})));
|
|
316
319
|
}
|
|
317
320
|
grantNewsroomReadWriteDelete(backend.modelAttachmentUpload.resources.lambda);
|
|
318
321
|
grantMediaReadWriteDelete(backend.modelAttachmentUpload.resources.lambda);
|
package/amplify/site-backend.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { dirname, resolve } from "node:path";
|
|
|
11
11
|
import { fileURLToPath } from "node:url";
|
|
12
12
|
import { DEFAULT_RESOLVER_WAVE_SIZE, orderModelStacksInWaves } from "./resolver-waves";
|
|
13
13
|
import { rebuildTriggerSettings } from "./rebuild-trigger-settings";
|
|
14
|
+
import { revalidateSecretReadStatement } from "./revalidate-secret-policy";
|
|
14
15
|
import { applyCognitoDomainPrefix, authConfigFromEnv, defineSiteAuth } from "./auth/resource";
|
|
15
16
|
import { data } from "./data/resource";
|
|
16
17
|
import { assignmentAction } from "./functions/assignment-action/resource";
|
|
@@ -398,10 +399,14 @@ export function defineSiteBackend(papyrusSite: PapyrusSite) {
|
|
|
398
399
|
backend.contentActions.addEnvironment("PAPYRUS_REVALIDATE_SECRET_PARAMETER", revalidateSecretParameter);
|
|
399
400
|
const revalidateStack = Stack.of(contentActionsLambda);
|
|
400
401
|
contentActionsLambda.addToRolePolicy(
|
|
401
|
-
new PolicyStatement(
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
402
|
+
new PolicyStatement(
|
|
403
|
+
revalidateSecretReadStatement({
|
|
404
|
+
partition: revalidateStack.partition,
|
|
405
|
+
region: revalidateStack.region,
|
|
406
|
+
account: revalidateStack.account,
|
|
407
|
+
parameterName: revalidateSecretParameter,
|
|
408
|
+
}),
|
|
409
|
+
),
|
|
405
410
|
);
|
|
406
411
|
}
|
|
407
412
|
grantNewsroomReadWriteDelete(backend.modelAttachmentUpload.resources.lambda as LambdaFunction);
|
package/package.json
CHANGED
package/routes.manifest.json
CHANGED