@ampless/backend 1.0.0-alpha.55 → 1.0.0-alpha.57
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.
|
@@ -73,6 +73,9 @@ function safeParse(s) {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
function createProcessorTrustedHandler(opts) {
|
|
76
|
+
const privilegedHookedPlugins = (opts.plugins ?? []).filter(
|
|
77
|
+
(p) => typeof p === "object" && p.trust_level === "privileged" && !!p.hooks && Object.keys(p.hooks).length > 0
|
|
78
|
+
);
|
|
76
79
|
const trustedPlugins = (opts.plugins ?? []).filter(
|
|
77
80
|
(p) => typeof p === "object" && p.trust_level === "trusted"
|
|
78
81
|
).filter((p) => {
|
|
@@ -323,6 +326,13 @@ function createProcessorTrustedHandler(opts) {
|
|
|
323
326
|
throw err;
|
|
324
327
|
}
|
|
325
328
|
}
|
|
329
|
+
for (const plugin of privilegedHookedPlugins) {
|
|
330
|
+
if (plugin.hooks?.[parsed.type]) {
|
|
331
|
+
console.warn(
|
|
332
|
+
`[trusted-processor] privileged plugin "${plugin.name}" declares ${parsed.type} hook but no privileged Lambda is provisioned yet \u2014 hook will not execute. See docs/architecture/08-plugin-architecture.md.`
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
326
336
|
for (const plugin of trustedPlugins) {
|
|
327
337
|
const hook = plugin.hooks?.[parsed.type];
|
|
328
338
|
if (!hook) continue;
|
|
@@ -3,6 +3,9 @@ function createProcessorUntrustedHandler(opts) {
|
|
|
3
3
|
const untrustedPlugins = (opts.plugins ?? []).filter(
|
|
4
4
|
(p) => typeof p === "object" && p.trust_level === "untrusted"
|
|
5
5
|
);
|
|
6
|
+
const privilegedHookedPlugins = (opts.plugins ?? []).filter(
|
|
7
|
+
(p) => typeof p === "object" && p.trust_level === "privileged" && !!p.hooks && Object.keys(p.hooks).length > 0
|
|
8
|
+
);
|
|
6
9
|
function makeContext() {
|
|
7
10
|
return {
|
|
8
11
|
site: opts.site,
|
|
@@ -15,7 +18,7 @@ function createProcessorUntrustedHandler(opts) {
|
|
|
15
18
|
};
|
|
16
19
|
}
|
|
17
20
|
return async (event) => {
|
|
18
|
-
if (untrustedPlugins.length === 0) return;
|
|
21
|
+
if (untrustedPlugins.length === 0 && privilegedHookedPlugins.length === 0) return;
|
|
19
22
|
for (const record of event.Records) {
|
|
20
23
|
let parsed;
|
|
21
24
|
try {
|
|
@@ -24,6 +27,13 @@ function createProcessorUntrustedHandler(opts) {
|
|
|
24
27
|
console.error("[untrusted-processor] bad message", record.body, err);
|
|
25
28
|
continue;
|
|
26
29
|
}
|
|
30
|
+
for (const plugin of privilegedHookedPlugins) {
|
|
31
|
+
if (plugin.hooks?.[parsed.type]) {
|
|
32
|
+
console.warn(
|
|
33
|
+
`[untrusted-processor] privileged plugin "${plugin.name}" declares ${parsed.type} hook but no privileged Lambda is provisioned yet \u2014 hook will not execute. See docs/architecture/08-plugin-architecture.md.`
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
27
37
|
for (const plugin of untrustedPlugins) {
|
|
28
38
|
const hook = plugin.hooks?.[parsed.type];
|
|
29
39
|
if (!hook) continue;
|
package/dist/index.js
CHANGED
|
@@ -61,7 +61,7 @@ function defineAmplessBackend(opts) {
|
|
|
61
61
|
new PolicyStatement({
|
|
62
62
|
effect: Effect.ALLOW,
|
|
63
63
|
actions: ["cognito-idp:AdminAddUserToGroup", "cognito-idp:ListUsersInGroup"],
|
|
64
|
-
resources: [
|
|
64
|
+
resources: ["arn:aws:cognito-idp:*:*:userpool/*"]
|
|
65
65
|
})
|
|
66
66
|
);
|
|
67
67
|
backend.userAdmin.resources.lambda.addToRolePolicy(
|
|
@@ -73,7 +73,7 @@ function defineAmplessBackend(opts) {
|
|
|
73
73
|
"cognito-idp:AdminAddUserToGroup",
|
|
74
74
|
"cognito-idp:AdminRemoveUserFromGroup"
|
|
75
75
|
],
|
|
76
|
-
resources: [
|
|
76
|
+
resources: ["arn:aws:cognito-idp:*:*:userpool/*"]
|
|
77
77
|
})
|
|
78
78
|
);
|
|
79
79
|
backend.userAdmin.resources.lambda.addEnvironment(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ampless/backend",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.57",
|
|
4
4
|
"description": "Amplify Gen 2 backend factories for ampless: auth, data, storage, event processors, API key renewer",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"@smithy/protocol-http": "^5.4.4",
|
|
70
70
|
"@smithy/signature-v4": "^5.4.4",
|
|
71
71
|
"fflate": "^0.8.3",
|
|
72
|
-
"@ampless/mcp-server": "1.0.0-alpha.
|
|
73
|
-
"ampless": "1.0.0-alpha.
|
|
72
|
+
"@ampless/mcp-server": "1.0.0-alpha.41",
|
|
73
|
+
"ampless": "1.0.0-alpha.35"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"@aws-amplify/backend": "^1",
|