@frontmcp/plugin-approval 1.7.2 → 1.8.0
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/esm/index.mjs +11 -6
- package/esm/package.json +4 -4
- package/hooks/approval-check.hook.d.ts +9 -0
- package/hooks/approval-check.hook.d.ts.map +1 -1
- package/index.js +11 -6
- package/package.json +4 -4
package/esm/index.mjs
CHANGED
|
@@ -1035,14 +1035,19 @@ var ApprovalCheckPlugin = class extends DynamicPlugin {
|
|
|
1035
1035
|
if (!approval.expiresAt) return false;
|
|
1036
1036
|
return Date.now() > approval.expiresAt;
|
|
1037
1037
|
}
|
|
1038
|
+
/**
|
|
1039
|
+
* The context this call is running in, as established by the SESSION (GHSA-r848-p7wf-96rc).
|
|
1040
|
+
*
|
|
1041
|
+
* Deliberately ignores `toolContext.input.context`. The only consumer of this value is
|
|
1042
|
+
* `isPreApprovedContext`, which skips the approval prompt outright, so reading it from the
|
|
1043
|
+
* arguments of the call being gated let a caller name its own pre-approved context and walk
|
|
1044
|
+
* straight past the gate. Only `authInfo.extra.approvalContext`, which the server sets
|
|
1045
|
+
* while authenticating, can say what context a call belongs to.
|
|
1046
|
+
*/
|
|
1038
1047
|
getCurrentContext(flowCtx) {
|
|
1039
|
-
const
|
|
1040
|
-
const ctx = toolContext?.tryGetContext?.();
|
|
1041
|
-
const inputContext = toolContext?.input?.["context"];
|
|
1042
|
-
const contextFromInput = this.isApprovalContext(inputContext) ? inputContext : void 0;
|
|
1048
|
+
const ctx = flowCtx.state.toolContext?.tryGetContext?.();
|
|
1043
1049
|
const sessionContext = ctx?.authInfo?.extra?.["approvalContext"];
|
|
1044
|
-
|
|
1045
|
-
return contextFromInput ?? contextFromSession;
|
|
1050
|
+
return this.isApprovalContext(sessionContext) ? sessionContext : void 0;
|
|
1046
1051
|
}
|
|
1047
1052
|
isApprovalContext(value) {
|
|
1048
1053
|
return typeof value === "object" && value !== null && "type" in value && "identifier" in value && typeof value.type === "string" && typeof value.identifier === "string";
|
package/esm/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/plugin-approval",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Approval plugin for FrontMCP - tool authorization workflow with PKCE webhook security",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@frontmcp/sdk": "1.
|
|
53
|
-
"@frontmcp/utils": "1.
|
|
52
|
+
"@frontmcp/sdk": "1.8.0",
|
|
53
|
+
"@frontmcp/utils": "1.8.0",
|
|
54
54
|
"ioredis": "^5.8.0",
|
|
55
55
|
"reflect-metadata": "^0.2.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@frontmcp/lazy-zod": "1.
|
|
58
|
+
"@frontmcp/lazy-zod": "1.8.0",
|
|
59
59
|
"@vercel/kv": "^2.0.0 || ^3.0.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependenciesMeta": {
|
|
@@ -16,6 +16,15 @@ export default class ApprovalCheckPlugin extends DynamicPlugin<Record<string, ne
|
|
|
16
16
|
checkApproval(flowCtx: FlowCtxOf<'tools:call-tool'>): Promise<void>;
|
|
17
17
|
private resolveApprovalConfig;
|
|
18
18
|
private isExpired;
|
|
19
|
+
/**
|
|
20
|
+
* The context this call is running in, as established by the SESSION (GHSA-r848-p7wf-96rc).
|
|
21
|
+
*
|
|
22
|
+
* Deliberately ignores `toolContext.input.context`. The only consumer of this value is
|
|
23
|
+
* `isPreApprovedContext`, which skips the approval prompt outright, so reading it from the
|
|
24
|
+
* arguments of the call being gated let a caller name its own pre-approved context and walk
|
|
25
|
+
* straight past the gate. Only `authInfo.extra.approvalContext`, which the server sets
|
|
26
|
+
* while authenticating, can say what context a call belongs to.
|
|
27
|
+
*/
|
|
19
28
|
private getCurrentContext;
|
|
20
29
|
private isApprovalContext;
|
|
21
30
|
private getStringExtra;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval-check.hook.d.ts","sourceRoot":"","sources":["../../src/hooks/approval-check.hook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"approval-check.hook.d.ts","sourceRoot":"","sources":["../../src/hooks/approval-check.hook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,SAAS,EAAoB,MAAM,eAAe,CAAC;AAa3E;;;;GAIG;AAKH,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACnF;;OAEG;IAEG,aAAa,CAAC,OAAO,EAAE,SAAS,CAAC,iBAAiB,CAAC;IAwDzD,OAAO,CAAC,qBAAqB;IAc7B,OAAO,CAAC,SAAS;IAKjB;;;;;;;;OAQG;IACH,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,oBAAoB;YAUd,sBAAsB;CAsBrC"}
|
package/index.js
CHANGED
|
@@ -1085,14 +1085,19 @@ var ApprovalCheckPlugin = class extends import_sdk4.DynamicPlugin {
|
|
|
1085
1085
|
if (!approval.expiresAt) return false;
|
|
1086
1086
|
return Date.now() > approval.expiresAt;
|
|
1087
1087
|
}
|
|
1088
|
+
/**
|
|
1089
|
+
* The context this call is running in, as established by the SESSION (GHSA-r848-p7wf-96rc).
|
|
1090
|
+
*
|
|
1091
|
+
* Deliberately ignores `toolContext.input.context`. The only consumer of this value is
|
|
1092
|
+
* `isPreApprovedContext`, which skips the approval prompt outright, so reading it from the
|
|
1093
|
+
* arguments of the call being gated let a caller name its own pre-approved context and walk
|
|
1094
|
+
* straight past the gate. Only `authInfo.extra.approvalContext`, which the server sets
|
|
1095
|
+
* while authenticating, can say what context a call belongs to.
|
|
1096
|
+
*/
|
|
1088
1097
|
getCurrentContext(flowCtx) {
|
|
1089
|
-
const
|
|
1090
|
-
const ctx = toolContext?.tryGetContext?.();
|
|
1091
|
-
const inputContext = toolContext?.input?.["context"];
|
|
1092
|
-
const contextFromInput = this.isApprovalContext(inputContext) ? inputContext : void 0;
|
|
1098
|
+
const ctx = flowCtx.state.toolContext?.tryGetContext?.();
|
|
1093
1099
|
const sessionContext = ctx?.authInfo?.extra?.["approvalContext"];
|
|
1094
|
-
|
|
1095
|
-
return contextFromInput ?? contextFromSession;
|
|
1100
|
+
return this.isApprovalContext(sessionContext) ? sessionContext : void 0;
|
|
1096
1101
|
}
|
|
1097
1102
|
isApprovalContext(value) {
|
|
1098
1103
|
return typeof value === "object" && value !== null && "type" in value && "identifier" in value && typeof value.type === "string" && typeof value.identifier === "string";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/plugin-approval",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Approval plugin for FrontMCP - tool authorization workflow with PKCE webhook security",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@frontmcp/sdk": "1.
|
|
53
|
-
"@frontmcp/utils": "1.
|
|
52
|
+
"@frontmcp/sdk": "1.8.0",
|
|
53
|
+
"@frontmcp/utils": "1.8.0",
|
|
54
54
|
"ioredis": "^5.8.0",
|
|
55
55
|
"reflect-metadata": "^0.2.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@frontmcp/lazy-zod": "1.
|
|
58
|
+
"@frontmcp/lazy-zod": "1.8.0",
|
|
59
59
|
"@vercel/kv": "^2.0.0 || ^3.0.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependenciesMeta": {
|