@node9/proxy 2.37.1 → 2.38.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/dist/cli.js +6835 -3672
- package/dist/cli.mjs +6725 -3561
- package/dist/dashboard.mjs +1198 -360
- package/dist/index.js +2150 -664
- package/dist/index.mjs +2146 -660
- package/dist/scan-ink.mjs +1308 -269
- package/package.json +1 -1
package/dist/scan-ink.mjs
CHANGED
|
@@ -67,7 +67,8 @@ var SmartConditionSchema = z.object({
|
|
|
67
67
|
}
|
|
68
68
|
),
|
|
69
69
|
value: z.string().optional(),
|
|
70
|
-
flags: z.string().optional()
|
|
70
|
+
flags: z.string().optional(),
|
|
71
|
+
reading: z.enum(["access"]).optional()
|
|
71
72
|
}).refine(
|
|
72
73
|
(c) => {
|
|
73
74
|
if (c.op === "matchesGlob" || c.op === "notMatchesGlob") return c.value !== void 0;
|
|
@@ -78,6 +79,9 @@ var SmartConditionSchema = z.object({
|
|
|
78
79
|
var SmartRuleSchema = z.object({
|
|
79
80
|
name: z.string().optional(),
|
|
80
81
|
tool: z.string().min(1, "Smart rule tool must not be empty"),
|
|
82
|
+
// Scope to an MCP server label (glob), or keep off one (node9Firewall#390).
|
|
83
|
+
server: z.string().min(1).optional(),
|
|
84
|
+
notServer: z.string().min(1).optional(),
|
|
81
85
|
conditions: z.array(SmartConditionSchema).min(1, "Smart rule must have at least one condition"),
|
|
82
86
|
conditionMode: z.enum(["all", "any"]).optional(),
|
|
83
87
|
verdict: z.enum(["allow", "review", "block"], {
|
|
@@ -236,12 +240,24 @@ import picomatch from "picomatch";
|
|
|
236
240
|
import safeRegex from "safe-regex2";
|
|
237
241
|
import pm from "picomatch";
|
|
238
242
|
import mvdanSh from "mvdan-sh";
|
|
239
|
-
import safeRegex2 from "safe-regex2";
|
|
240
243
|
import mvdanSh2 from "mvdan-sh";
|
|
241
|
-
import
|
|
244
|
+
import safeRegex2 from "safe-regex2";
|
|
242
245
|
import { createHash as createHash2 } from "crypto";
|
|
243
246
|
import mvdanSh3 from "mvdan-sh";
|
|
244
247
|
import mvdanSh4 from "mvdan-sh";
|
|
248
|
+
var MAX_REGEX_LENGTH = 256;
|
|
249
|
+
function validateRegex(pattern) {
|
|
250
|
+
if (!pattern) return "Pattern is required";
|
|
251
|
+
if (pattern.length > MAX_REGEX_LENGTH) return `Pattern exceeds max length of ${MAX_REGEX_LENGTH}`;
|
|
252
|
+
try {
|
|
253
|
+
new RegExp(pattern);
|
|
254
|
+
} catch (e) {
|
|
255
|
+
return `Invalid regex syntax: ${e.message}`;
|
|
256
|
+
}
|
|
257
|
+
if (/\\\d+[*+{]/.test(pattern)) return "Quantified backreferences are forbidden (ReDoS risk)";
|
|
258
|
+
if (!safeRegex(pattern)) return "Pattern rejected: potential ReDoS vulnerability detected";
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
245
261
|
var aws_default = {
|
|
246
262
|
name: "aws",
|
|
247
263
|
description: "Protects AWS infrastructure from destructive AI operations",
|
|
@@ -543,77 +559,6 @@ var filesystem_default = {
|
|
|
543
559
|
],
|
|
544
560
|
dangerousWords: ["wipefs"]
|
|
545
561
|
};
|
|
546
|
-
var finance_default = {
|
|
547
|
-
name: "finance",
|
|
548
|
-
description: "Asks before money moves through a payment or banking app (refunds, payouts, transfers, charges, invoices), whatever the request said. Reads are never asked about.",
|
|
549
|
-
aliases: ["payments", "money"],
|
|
550
|
-
smartRules: [
|
|
551
|
-
{
|
|
552
|
-
name: "shield:finance:review-refund",
|
|
553
|
-
tool: "{,mcp__*__}{create_refund,refund_payment,refund_charge,refund_order,issue_refund}",
|
|
554
|
-
conditions: [],
|
|
555
|
-
verdict: "review",
|
|
556
|
-
reason: "A refund returns money to a customer. node9 asks before money moves, whatever the request said (Finance shield)."
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
name: "shield:finance:review-payout",
|
|
560
|
-
tool: "{,mcp__*__}{create_payout,send_payout,payout,create_payouts_batch}",
|
|
561
|
-
conditions: [],
|
|
562
|
-
verdict: "review",
|
|
563
|
-
reason: "A payout moves the balance to a bank account. node9 asks before money moves (Finance shield)."
|
|
564
|
-
},
|
|
565
|
-
{
|
|
566
|
-
name: "shield:finance:review-transfer",
|
|
567
|
-
tool: "{,mcp__*__}{transfer_create,transfer_authorization_create,create_transfer,transfer_money,transfer_funds,send_money,wire_transfer,create_wire,schedule_transaction,update_scheduled_transaction,create_transaction}",
|
|
568
|
-
conditions: [],
|
|
569
|
-
verdict: "review",
|
|
570
|
-
reason: "A transfer moves money between accounts. node9 asks before money moves (Finance shield)."
|
|
571
|
-
},
|
|
572
|
-
{
|
|
573
|
-
name: "shield:finance:review-charge",
|
|
574
|
-
tool: "{,mcp__*__}{create_payment_intent,confirm_payment_intent,capture_payment_intent,create_charge,create_payment,capture_payment,capture_order,create_order,authorize_order,create_checkout_session}",
|
|
575
|
-
conditions: [],
|
|
576
|
-
verdict: "review",
|
|
577
|
-
reason: "This charges a card or captures a payment. node9 asks before money moves (Finance shield)."
|
|
578
|
-
},
|
|
579
|
-
{
|
|
580
|
-
name: "shield:finance:review-payment-link",
|
|
581
|
-
tool: "{,mcp__*__}{create_payment_link,create_invoice,finalize_invoice,send_invoice,pay_invoice,create_invoice_item}",
|
|
582
|
-
conditions: [],
|
|
583
|
-
verdict: "review",
|
|
584
|
-
reason: "This bills someone or creates a link that charges a card. node9 asks before money moves (Finance shield)."
|
|
585
|
-
},
|
|
586
|
-
{
|
|
587
|
-
name: "shield:finance:review-subscription",
|
|
588
|
-
tool: "{,mcp__*__}{create_subscription,cancel_subscription,update_subscription,pause_subscription,resume_subscription}",
|
|
589
|
-
conditions: [],
|
|
590
|
-
verdict: "review",
|
|
591
|
-
reason: "A subscription starts or stops recurring charges. node9 asks before money moves (Finance shield)."
|
|
592
|
-
},
|
|
593
|
-
{
|
|
594
|
-
name: "shield:finance:review-dispute",
|
|
595
|
-
tool: "{,mcp__*__}{update_dispute,accept_dispute,close_dispute}",
|
|
596
|
-
conditions: [],
|
|
597
|
-
verdict: "review",
|
|
598
|
-
reason: "This answers or concedes a chargeback. node9 asks before money moves (Finance shield)."
|
|
599
|
-
},
|
|
600
|
-
{
|
|
601
|
-
name: "shield:finance:review-card",
|
|
602
|
-
tool: "{,mcp__*__}{issue_card,create_virtual_card,create_issuing_card,update_card_limit}",
|
|
603
|
-
conditions: [],
|
|
604
|
-
verdict: "review",
|
|
605
|
-
reason: "This issues a card or changes its limit. node9 asks before money moves (Finance shield)."
|
|
606
|
-
},
|
|
607
|
-
{
|
|
608
|
-
name: "shield:finance:review-withdraw",
|
|
609
|
-
tool: "{,mcp__*__}{withdraw,withdraw_funds,create_withdrawal,request_withdrawal}",
|
|
610
|
-
conditions: [],
|
|
611
|
-
verdict: "review",
|
|
612
|
-
reason: "A withdrawal moves money out. node9 asks before money moves (Finance shield)."
|
|
613
|
-
}
|
|
614
|
-
],
|
|
615
|
-
dangerousWords: []
|
|
616
|
-
};
|
|
617
562
|
var github_default = {
|
|
618
563
|
name: "github",
|
|
619
564
|
description: "Protects GitHub repositories from destructive AI operations",
|
|
@@ -640,56 +585,6 @@ var github_default = {
|
|
|
640
585
|
],
|
|
641
586
|
dangerousWords: []
|
|
642
587
|
};
|
|
643
|
-
var identity_default = {
|
|
644
|
-
name: "identity",
|
|
645
|
-
description: "Asks before a password, a key, a token, a role or a user changes in an identity or admin app, whatever the request said. Reads are never asked about.",
|
|
646
|
-
aliases: ["access", "iam"],
|
|
647
|
-
smartRules: [
|
|
648
|
-
{
|
|
649
|
-
name: "shield:identity:review-password",
|
|
650
|
-
tool: "{,mcp__*__}{change_password,update_password,reset_password,set_password,expire_password,force_password_reset}",
|
|
651
|
-
conditions: [],
|
|
652
|
-
verdict: "review",
|
|
653
|
-
reason: "This changes or resets a password. node9 asks before credentials change, whatever the request said (Identity shield)."
|
|
654
|
-
},
|
|
655
|
-
{
|
|
656
|
-
name: "shield:identity:review-key",
|
|
657
|
-
tool: "{,mcp__*__}{rotate_key,rotate_api_key,create_api_key,create_token,create_access_token,create_personal_access_token,regenerate_secret,rotate_secret,create_service_account_key,create_credential}",
|
|
658
|
-
conditions: [],
|
|
659
|
-
verdict: "review",
|
|
660
|
-
reason: "This creates or rotates a key, token or secret. node9 asks before credentials change (Identity shield)."
|
|
661
|
-
},
|
|
662
|
-
{
|
|
663
|
-
name: "shield:identity:review-access",
|
|
664
|
-
tool: "{,mcp__*__}{grant_access,grant_permission,grant_role,revoke_access,revoke_permission,revoke_role,revoke_token,set_permission,set_permissions,set_role,assign_role,update_role,add_permission,remove_permission,attach_policy,detach_policy}",
|
|
665
|
-
conditions: [],
|
|
666
|
-
verdict: "review",
|
|
667
|
-
reason: "This grants or revokes access. node9 asks before access changes (Identity shield)."
|
|
668
|
-
},
|
|
669
|
-
{
|
|
670
|
-
name: "shield:identity:review-membership",
|
|
671
|
-
tool: "{,mcp__*__}{add_member,remove_member,add_user_to_group,remove_user_from_group,add_collaborator,remove_collaborator,invite_user,invite_member,invite_user_to_slack,invite_users,add_org_member,remove_org_member,add_team_member,remove_team_member}",
|
|
672
|
-
conditions: [],
|
|
673
|
-
verdict: "review",
|
|
674
|
-
reason: "This changes who belongs where. node9 asks before membership changes (Identity shield)."
|
|
675
|
-
},
|
|
676
|
-
{
|
|
677
|
-
name: "shield:identity:review-user",
|
|
678
|
-
tool: "{,mcp__*__}{create_user,delete_user,deactivate_user,suspend_user,activate_user,unlock_user,make_admin,promote_user,demote_user,update_user_role}",
|
|
679
|
-
conditions: [],
|
|
680
|
-
verdict: "review",
|
|
681
|
-
reason: "This creates, removes or promotes an account. node9 asks before accounts change (Identity shield)."
|
|
682
|
-
},
|
|
683
|
-
{
|
|
684
|
-
name: "shield:identity:review-mfa",
|
|
685
|
-
tool: "{,mcp__*__}{reset_mfa,reset_factors,disable_mfa,enroll_factor,deactivate_factor}",
|
|
686
|
-
conditions: [],
|
|
687
|
-
verdict: "review",
|
|
688
|
-
reason: "This changes a second factor. node9 asks before credentials change (Identity shield)."
|
|
689
|
-
}
|
|
690
|
-
],
|
|
691
|
-
dangerousWords: []
|
|
692
|
-
};
|
|
693
588
|
var k8s_default = {
|
|
694
589
|
name: "k8s",
|
|
695
590
|
description: "Protects Kubernetes clusters from destructive AI operations",
|
|
@@ -942,7 +837,7 @@ var project_jail_default = {
|
|
|
942
837
|
{
|
|
943
838
|
field: "command",
|
|
944
839
|
op: "matches",
|
|
945
|
-
value: "(cat|less|head|tail|bat|more|open|print|nano|vim
|
|
840
|
+
value: "(cat|less|head|tail|bat|more|open|print|nano|vim?|emacs|code|type|[ef]?grep|rg|ag|ack|g?awk|sed|cut|tr|[jy]q|od|xxd|hexdump|strings|base64|sort|uniq|tac|nl|dd)\\s+.*?\\.env(\\.(local|production|staging|development)){0,2}(?=[\\s;&|>)<]|$)",
|
|
946
841
|
flags: "i"
|
|
947
842
|
}
|
|
948
843
|
],
|
|
@@ -956,7 +851,7 @@ var project_jail_default = {
|
|
|
956
851
|
{
|
|
957
852
|
field: "command",
|
|
958
853
|
op: "matches",
|
|
959
|
-
value: "(cat|less|head|tail|bat|more|open|print|nano|vim
|
|
854
|
+
value: "(cat|less|head|tail|bat|more|open|print|nano|vim?|emacs|code|type|[ef]?grep|rg|ag|ack|g?awk|sed|cut|tr|[jy]q|od|xxd|hexdump|strings|base64|sort|uniq|tac|nl|dd)\\s+.*(credentials\\.json|\\.netrc|\\.npmrc|\\.docker[\\/\\\\]config\\.json|gcloud[\\/\\\\]credentials)",
|
|
960
855
|
flags: "i"
|
|
961
856
|
}
|
|
962
857
|
],
|
|
@@ -1022,6 +917,206 @@ var project_jail_default = {
|
|
|
1022
917
|
],
|
|
1023
918
|
dangerousWords: []
|
|
1024
919
|
};
|
|
920
|
+
var redis_default = {
|
|
921
|
+
name: "redis",
|
|
922
|
+
description: "Protects Redis instances from destructive AI operations",
|
|
923
|
+
aliases: [],
|
|
924
|
+
_scopeNote: "Every rule requires Redis to actually be involved: a client in the command (redis-cli / valkey-cli, in either order \u2014 `redis-cli FLUSHALL` and `echo FLUSHALL | redis-cli` are both real), OR the command field holding the bare keyword, which is what the MCP redis_command tool sends ({ command: 'FLUSHALL', args: [] }). Without the client requirement these rules matched the WORD anywhere \u2014 including prose in a heredoc writing a file \u2014 which produced two observed false positives: a test fixture describing the shield, and a commit message naming the rule. Every other builtin shield already scopes this way (aws s3, docker system prune, kubectl delete, gh repo delete). See redis-scope.spec.ts.",
|
|
925
|
+
smartRules: [
|
|
926
|
+
{
|
|
927
|
+
name: "shield:redis:block-flushall",
|
|
928
|
+
tool: "*",
|
|
929
|
+
conditions: [
|
|
930
|
+
{
|
|
931
|
+
field: "command",
|
|
932
|
+
op: "matches",
|
|
933
|
+
value: "(redis|valkey)-cli.*\\bFLUSHALL\\b|\\bFLUSHALL\\b.*(redis|valkey)-cli|^ ?FLUSHALL\\b|\\.flushall\\s*\\(",
|
|
934
|
+
flags: "i"
|
|
935
|
+
}
|
|
936
|
+
],
|
|
937
|
+
verdict: "block",
|
|
938
|
+
reason: "FLUSHALL deletes every key in every database \u2014 blocked by Redis shield"
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
name: "shield:redis:block-flushdb",
|
|
942
|
+
tool: "*",
|
|
943
|
+
conditions: [
|
|
944
|
+
{
|
|
945
|
+
field: "command",
|
|
946
|
+
op: "matches",
|
|
947
|
+
value: "(redis|valkey)-cli.*\\bFLUSHDB\\b|\\bFLUSHDB\\b.*(redis|valkey)-cli|^ ?FLUSHDB\\b|\\.flushdb\\s*\\(",
|
|
948
|
+
flags: "i"
|
|
949
|
+
}
|
|
950
|
+
],
|
|
951
|
+
verdict: "block",
|
|
952
|
+
reason: "FLUSHDB deletes all keys in the current database \u2014 blocked by Redis shield"
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
name: "shield:redis:block-config-resetstat",
|
|
956
|
+
tool: "*",
|
|
957
|
+
conditions: [
|
|
958
|
+
{
|
|
959
|
+
field: "command",
|
|
960
|
+
op: "matches",
|
|
961
|
+
value: "(redis|valkey)-cli.*CONFIG\\s+RESETSTAT|^ ?CONFIG\\s+RESETSTAT",
|
|
962
|
+
flags: "i"
|
|
963
|
+
}
|
|
964
|
+
],
|
|
965
|
+
verdict: "block",
|
|
966
|
+
reason: "CONFIG RESETSTAT resets server statistics irreversibly \u2014 blocked by Redis shield"
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
name: "shield:redis:review-config-set",
|
|
970
|
+
tool: "*",
|
|
971
|
+
conditions: [
|
|
972
|
+
{
|
|
973
|
+
field: "command",
|
|
974
|
+
op: "matches",
|
|
975
|
+
value: "(redis|valkey)-cli.*\\bCONFIG\\s+SET\\b|\\bCONFIG\\s+SET\\b.*(redis|valkey)-cli|^ ?CONFIG\\s+SET\\b",
|
|
976
|
+
flags: "i"
|
|
977
|
+
}
|
|
978
|
+
],
|
|
979
|
+
verdict: "review",
|
|
980
|
+
reason: "CONFIG SET changes live server configuration and requires human approval (Redis shield)"
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
name: "shield:redis:review-del-wildcard",
|
|
984
|
+
tool: "*",
|
|
985
|
+
conditions: [
|
|
986
|
+
{
|
|
987
|
+
field: "command",
|
|
988
|
+
op: "matches",
|
|
989
|
+
value: "(redis|valkey)-cli.*\\bDEL\\b.*[*?\\[]|^ ?DEL\\b.*[*?\\[]|-cli.*--scan.*xargs.*del",
|
|
990
|
+
flags: "i"
|
|
991
|
+
}
|
|
992
|
+
],
|
|
993
|
+
verdict: "review",
|
|
994
|
+
reason: "Wildcard key deletion requires human approval (Redis shield)"
|
|
995
|
+
}
|
|
996
|
+
],
|
|
997
|
+
dangerousWords: ["FLUSHALL", "FLUSHDB"]
|
|
998
|
+
};
|
|
999
|
+
var finance_default = {
|
|
1000
|
+
name: "finance",
|
|
1001
|
+
description: "Asks before money moves through a payment or banking app (refunds, payouts, transfers, charges, invoices), whatever the request said. Reads are never asked about.",
|
|
1002
|
+
aliases: ["payments", "money"],
|
|
1003
|
+
smartRules: [
|
|
1004
|
+
{
|
|
1005
|
+
name: "shield:finance:review-refund",
|
|
1006
|
+
tool: "{,mcp__*__}{create_refund,refund_payment,refund_charge,refund_order,issue_refund}",
|
|
1007
|
+
conditions: [],
|
|
1008
|
+
verdict: "review",
|
|
1009
|
+
reason: "A refund returns money to a customer. node9 asks before money moves, whatever the request said (Finance shield)."
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
name: "shield:finance:review-payout",
|
|
1013
|
+
tool: "{,mcp__*__}{create_payout,send_payout,payout,create_payouts_batch}",
|
|
1014
|
+
conditions: [],
|
|
1015
|
+
verdict: "review",
|
|
1016
|
+
reason: "A payout moves the balance to a bank account. node9 asks before money moves (Finance shield)."
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
name: "shield:finance:review-transfer",
|
|
1020
|
+
tool: "{,mcp__*__}{transfer_create,transfer_authorization_create,create_transfer,transfer_money,transfer_funds,send_money,wire_transfer,create_wire,schedule_transaction,update_scheduled_transaction}",
|
|
1021
|
+
conditions: [],
|
|
1022
|
+
verdict: "review",
|
|
1023
|
+
reason: "A transfer moves money between accounts. node9 asks before money moves (Finance shield)."
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
name: "shield:finance:review-charge",
|
|
1027
|
+
tool: "{,mcp__*__}{create_payment_intent,confirm_payment_intent,capture_payment_intent,create_charge,create_payment,capture_payment,capture_order,create_order,authorize_order,create_checkout_session}",
|
|
1028
|
+
conditions: [],
|
|
1029
|
+
verdict: "review",
|
|
1030
|
+
reason: "This charges a card or captures a payment. node9 asks before money moves (Finance shield)."
|
|
1031
|
+
},
|
|
1032
|
+
{
|
|
1033
|
+
name: "shield:finance:review-payment-link",
|
|
1034
|
+
tool: "{,mcp__*__}{create_payment_link,create_invoice,finalize_invoice,send_invoice,pay_invoice,create_invoice_item}",
|
|
1035
|
+
conditions: [],
|
|
1036
|
+
verdict: "review",
|
|
1037
|
+
reason: "This bills someone or creates a link that charges a card. node9 asks before money moves (Finance shield)."
|
|
1038
|
+
},
|
|
1039
|
+
{
|
|
1040
|
+
name: "shield:finance:review-subscription",
|
|
1041
|
+
tool: "{,mcp__*__}{create_subscription,cancel_subscription,update_subscription,pause_subscription,resume_subscription}",
|
|
1042
|
+
conditions: [],
|
|
1043
|
+
verdict: "review",
|
|
1044
|
+
reason: "A subscription starts or stops recurring charges. node9 asks before money moves (Finance shield)."
|
|
1045
|
+
},
|
|
1046
|
+
{
|
|
1047
|
+
name: "shield:finance:review-dispute",
|
|
1048
|
+
tool: "{,mcp__*__}{update_dispute,accept_dispute,close_dispute}",
|
|
1049
|
+
conditions: [],
|
|
1050
|
+
verdict: "review",
|
|
1051
|
+
reason: "This answers or concedes a chargeback. node9 asks before money moves (Finance shield)."
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
name: "shield:finance:review-card",
|
|
1055
|
+
tool: "{,mcp__*__}{issue_card,create_virtual_card,create_issuing_card,update_card_limit}",
|
|
1056
|
+
conditions: [],
|
|
1057
|
+
verdict: "review",
|
|
1058
|
+
reason: "This issues a card or changes its limit. node9 asks before money moves (Finance shield)."
|
|
1059
|
+
},
|
|
1060
|
+
{
|
|
1061
|
+
name: "shield:finance:review-withdraw",
|
|
1062
|
+
tool: "{,mcp__*__}{withdraw,withdraw_funds,create_withdrawal,request_withdrawal}",
|
|
1063
|
+
conditions: [],
|
|
1064
|
+
verdict: "review",
|
|
1065
|
+
reason: "A withdrawal moves money out. node9 asks before money moves (Finance shield)."
|
|
1066
|
+
}
|
|
1067
|
+
],
|
|
1068
|
+
dangerousWords: []
|
|
1069
|
+
};
|
|
1070
|
+
var identity_default = {
|
|
1071
|
+
name: "identity",
|
|
1072
|
+
description: "Asks before a password, a key, a token, a role or a user changes in an identity or admin app, whatever the request said. Reads are never asked about.",
|
|
1073
|
+
aliases: ["access", "iam"],
|
|
1074
|
+
smartRules: [
|
|
1075
|
+
{
|
|
1076
|
+
name: "shield:identity:review-password",
|
|
1077
|
+
tool: "{,mcp__*__}{change_password,update_password,reset_password,set_password,expire_password,force_password_reset}",
|
|
1078
|
+
conditions: [],
|
|
1079
|
+
verdict: "review",
|
|
1080
|
+
reason: "This changes or resets a password. node9 asks before credentials change, whatever the request said (Identity shield)."
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
name: "shield:identity:review-key",
|
|
1084
|
+
tool: "{,mcp__*__}{rotate_key,rotate_api_key,create_api_key,create_token,create_access_token,create_personal_access_token,regenerate_secret,rotate_secret,create_service_account_key,create_credential}",
|
|
1085
|
+
conditions: [],
|
|
1086
|
+
verdict: "review",
|
|
1087
|
+
reason: "This creates or rotates a key, token or secret. node9 asks before credentials change (Identity shield)."
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
name: "shield:identity:review-access",
|
|
1091
|
+
tool: "{,mcp__*__}{grant_access,grant_permission,grant_role,revoke_access,revoke_permission,revoke_role,revoke_token,set_permission,set_permissions,set_role,assign_role,update_role,add_permission,remove_permission,attach_policy,detach_policy,share_file}",
|
|
1092
|
+
conditions: [],
|
|
1093
|
+
verdict: "review",
|
|
1094
|
+
reason: "This grants or revokes access. node9 asks before access changes (Identity shield)."
|
|
1095
|
+
},
|
|
1096
|
+
{
|
|
1097
|
+
name: "shield:identity:review-membership",
|
|
1098
|
+
tool: "{,mcp__*__}{add_member,remove_member,add_user_to_group,remove_user_from_group,add_collaborator,remove_collaborator,invite_user,invite_member,invite_user_to_slack,invite_users,add_org_member,remove_org_member,add_team_member,remove_team_member,add_user_to_channel,remove_user_from_slack}",
|
|
1099
|
+
conditions: [],
|
|
1100
|
+
verdict: "review",
|
|
1101
|
+
reason: "This changes who belongs where. node9 asks before membership changes (Identity shield)."
|
|
1102
|
+
},
|
|
1103
|
+
{
|
|
1104
|
+
name: "shield:identity:review-user",
|
|
1105
|
+
tool: "{,mcp__*__}{create_user,delete_user,delete_deactivated_user,deactivate_user,suspend_user,activate_user,unlock_user,make_admin,promote_user,demote_user,update_user_role}",
|
|
1106
|
+
conditions: [],
|
|
1107
|
+
verdict: "review",
|
|
1108
|
+
reason: "This creates, removes or promotes an account. node9 asks before accounts change (Identity shield)."
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
name: "shield:identity:review-mfa",
|
|
1112
|
+
tool: "{,mcp__*__}{reset_mfa,reset_factors,disable_mfa,enroll_factor,deactivate_factor}",
|
|
1113
|
+
conditions: [],
|
|
1114
|
+
verdict: "review",
|
|
1115
|
+
reason: "This changes a second factor. node9 asks before credentials change (Identity shield)."
|
|
1116
|
+
}
|
|
1117
|
+
],
|
|
1118
|
+
dangerousWords: []
|
|
1119
|
+
};
|
|
1025
1120
|
var publishing_default = {
|
|
1026
1121
|
name: "publishing",
|
|
1027
1122
|
description: "Asks before something goes public or ships outside the organisation (a release, a package, a deploy, a post), whatever the request said. The same switch covers the shell commands that publish.",
|
|
@@ -1111,165 +1206,629 @@ var publishing_default = {
|
|
|
1111
1206
|
{
|
|
1112
1207
|
field: "command",
|
|
1113
1208
|
op: "matches",
|
|
1114
|
-
value: "(?:^|[^\\w-])(?:poetry|uv|hatch|flit)(?![\\w-])[^;&|]{0,200}?\\s(?:publish)(?![\\w-])",
|
|
1115
|
-
flags: "i"
|
|
1116
|
-
}
|
|
1117
|
-
],
|
|
1118
|
-
verdict: "review",
|
|
1119
|
-
reason: "This publishes the Python package to PyPI. node9 asks before publishing (Publishing shield)."
|
|
1120
|
-
},
|
|
1121
|
-
{
|
|
1122
|
-
name: "shield:publishing:review-release-tool-publish",
|
|
1123
|
-
tool: "bash",
|
|
1124
|
-
conditions: [
|
|
1125
|
-
{
|
|
1126
|
-
field: "command",
|
|
1127
|
-
op: "matches",
|
|
1128
|
-
value: "(?:^|[^\\w-])(?:lerna|changeset|vsce|ovsx)(?![\\w-])[^;&|]{0,200}?\\s(?:publish)(?![\\w-])",
|
|
1129
|
-
flags: "i"
|
|
1130
|
-
}
|
|
1131
|
-
],
|
|
1132
|
-
verdict: "review",
|
|
1133
|
-
reason: "This publishes packages or an editor extension through a release tool. node9 asks before publishing (Publishing shield)."
|
|
1134
|
-
},
|
|
1135
|
-
{
|
|
1136
|
-
name: "shield:publishing:review-cargo-publish",
|
|
1137
|
-
tool: "bash",
|
|
1138
|
-
conditions: [
|
|
1139
|
-
{
|
|
1140
|
-
field: "command",
|
|
1141
|
-
op: "matches",
|
|
1142
|
-
value: "(?:^|[^\\w-])(?:cargo)(?![\\w-])[^;&|]{0,200}?\\s(?:publish)(?![\\w-])",
|
|
1143
|
-
flags: "i"
|
|
1144
|
-
}
|
|
1145
|
-
],
|
|
1146
|
-
verdict: "review",
|
|
1147
|
-
reason: "cargo publish ships the crate. node9 asks before publishing (Publishing shield)."
|
|
1148
|
-
},
|
|
1149
|
-
{
|
|
1150
|
-
name: "shield:publishing:review-gem-push",
|
|
1151
|
-
tool: "bash",
|
|
1152
|
-
conditions: [
|
|
1153
|
-
{
|
|
1154
|
-
field: "command",
|
|
1155
|
-
op: "matches",
|
|
1156
|
-
value: "(?:^|[^\\w-])(?:gem)(?![\\w-])[^;&|]{0,200}?\\s(?:push)(?![\\w-])",
|
|
1157
|
-
flags: "i"
|
|
1158
|
-
}
|
|
1159
|
-
],
|
|
1160
|
-
verdict: "review",
|
|
1161
|
-
reason: "gem push publishes to RubyGems. node9 asks before publishing (Publishing shield)."
|
|
1162
|
-
},
|
|
1163
|
-
{
|
|
1164
|
-
name: "shield:publishing:review-docker-push",
|
|
1165
|
-
tool: "bash",
|
|
1166
|
-
conditions: [
|
|
1167
|
-
{
|
|
1168
|
-
field: "command",
|
|
1169
|
-
op: "matches",
|
|
1170
|
-
value: "(?:^|[^\\w-])(?:docker|podman)(?![\\w-])[^;&|]{0,200}?\\s(?:push|--push)(?![\\w-])",
|
|
1171
|
-
flags: "i"
|
|
1172
|
-
}
|
|
1173
|
-
],
|
|
1174
|
-
verdict: "review",
|
|
1175
|
-
reason: "docker push publishes the image to a registry. node9 asks before publishing (Publishing shield)."
|
|
1176
|
-
},
|
|
1177
|
-
{
|
|
1178
|
-
name: "shield:publishing:review-gh-release",
|
|
1179
|
-
tool: "bash",
|
|
1180
|
-
conditions: [
|
|
1181
|
-
{
|
|
1182
|
-
field: "command",
|
|
1183
|
-
op: "matches",
|
|
1184
|
-
value: "(?:^|[^\\w-])(?:gh)(?![\\w-])[^;&|]{0,200}?\\srelease\\s+(?:create|upload|edit)(?![\\w-])",
|
|
1209
|
+
value: "(?:^|[^\\w-])(?:poetry|uv|hatch|flit)(?![\\w-])[^;&|]{0,200}?\\s(?:publish)(?![\\w-])",
|
|
1185
1210
|
flags: "i"
|
|
1186
1211
|
}
|
|
1187
1212
|
],
|
|
1188
1213
|
verdict: "review",
|
|
1189
|
-
reason: "
|
|
1190
|
-
}
|
|
1191
|
-
],
|
|
1192
|
-
dangerousWords: []
|
|
1193
|
-
};
|
|
1194
|
-
var redis_default = {
|
|
1195
|
-
name: "redis",
|
|
1196
|
-
description: "Protects Redis instances from destructive AI operations",
|
|
1197
|
-
aliases: [],
|
|
1198
|
-
_scopeNote: "Every rule requires Redis to actually be involved: a client in the command (redis-cli / valkey-cli, in either order \u2014 `redis-cli FLUSHALL` and `echo FLUSHALL | redis-cli` are both real), OR the command field holding the bare keyword, which is what the MCP redis_command tool sends ({ command: 'FLUSHALL', args: [] }). Without the client requirement these rules matched the WORD anywhere \u2014 including prose in a heredoc writing a file \u2014 which produced two observed false positives: a test fixture describing the shield, and a commit message naming the rule. Every other builtin shield already scopes this way (aws s3, docker system prune, kubectl delete, gh repo delete). See redis-scope.spec.ts.",
|
|
1199
|
-
smartRules: [
|
|
1214
|
+
reason: "This publishes the Python package to PyPI. node9 asks before publishing (Publishing shield)."
|
|
1215
|
+
},
|
|
1200
1216
|
{
|
|
1201
|
-
name: "shield:
|
|
1202
|
-
tool: "
|
|
1217
|
+
name: "shield:publishing:review-release-tool-publish",
|
|
1218
|
+
tool: "bash",
|
|
1203
1219
|
conditions: [
|
|
1204
1220
|
{
|
|
1205
1221
|
field: "command",
|
|
1206
1222
|
op: "matches",
|
|
1207
|
-
value: "(
|
|
1223
|
+
value: "(?:^|[^\\w-])(?:lerna|changeset|vsce|ovsx)(?![\\w-])[^;&|]{0,200}?\\s(?:publish)(?![\\w-])",
|
|
1208
1224
|
flags: "i"
|
|
1209
1225
|
}
|
|
1210
1226
|
],
|
|
1211
|
-
verdict: "
|
|
1212
|
-
reason: "
|
|
1227
|
+
verdict: "review",
|
|
1228
|
+
reason: "This publishes packages or an editor extension through a release tool. node9 asks before publishing (Publishing shield)."
|
|
1213
1229
|
},
|
|
1214
1230
|
{
|
|
1215
|
-
name: "shield:
|
|
1216
|
-
tool: "
|
|
1231
|
+
name: "shield:publishing:review-cargo-publish",
|
|
1232
|
+
tool: "bash",
|
|
1217
1233
|
conditions: [
|
|
1218
1234
|
{
|
|
1219
1235
|
field: "command",
|
|
1220
1236
|
op: "matches",
|
|
1221
|
-
value: "(
|
|
1237
|
+
value: "(?:^|[^\\w-])(?:cargo)(?![\\w-])[^;&|]{0,200}?\\s(?:publish)(?![\\w-])",
|
|
1222
1238
|
flags: "i"
|
|
1223
1239
|
}
|
|
1224
1240
|
],
|
|
1225
|
-
verdict: "
|
|
1226
|
-
reason: "
|
|
1241
|
+
verdict: "review",
|
|
1242
|
+
reason: "cargo publish ships the crate. node9 asks before publishing (Publishing shield)."
|
|
1227
1243
|
},
|
|
1228
1244
|
{
|
|
1229
|
-
name: "shield:
|
|
1230
|
-
tool: "
|
|
1245
|
+
name: "shield:publishing:review-gem-push",
|
|
1246
|
+
tool: "bash",
|
|
1231
1247
|
conditions: [
|
|
1232
1248
|
{
|
|
1233
1249
|
field: "command",
|
|
1234
1250
|
op: "matches",
|
|
1235
|
-
value: "(
|
|
1251
|
+
value: "(?:^|[^\\w-])(?:gem)(?![\\w-])[^;&|]{0,200}?\\s(?:push)(?![\\w-])",
|
|
1236
1252
|
flags: "i"
|
|
1237
1253
|
}
|
|
1238
1254
|
],
|
|
1239
|
-
verdict: "
|
|
1240
|
-
reason: "
|
|
1255
|
+
verdict: "review",
|
|
1256
|
+
reason: "gem push publishes to RubyGems. node9 asks before publishing (Publishing shield)."
|
|
1241
1257
|
},
|
|
1242
1258
|
{
|
|
1243
|
-
name: "shield:
|
|
1244
|
-
tool: "
|
|
1259
|
+
name: "shield:publishing:review-docker-push",
|
|
1260
|
+
tool: "bash",
|
|
1245
1261
|
conditions: [
|
|
1246
1262
|
{
|
|
1247
1263
|
field: "command",
|
|
1248
1264
|
op: "matches",
|
|
1249
|
-
value: "(
|
|
1265
|
+
value: "(?:^|[^\\w-])(?:docker|podman)(?![\\w-])[^;&|]{0,200}?\\s(?:push|--push)(?![\\w-])",
|
|
1250
1266
|
flags: "i"
|
|
1251
1267
|
}
|
|
1252
1268
|
],
|
|
1253
1269
|
verdict: "review",
|
|
1254
|
-
reason: "
|
|
1270
|
+
reason: "docker push publishes the image to a registry. node9 asks before publishing (Publishing shield)."
|
|
1255
1271
|
},
|
|
1256
1272
|
{
|
|
1257
|
-
name: "shield:
|
|
1258
|
-
tool: "
|
|
1273
|
+
name: "shield:publishing:review-gh-release",
|
|
1274
|
+
tool: "bash",
|
|
1259
1275
|
conditions: [
|
|
1260
1276
|
{
|
|
1261
1277
|
field: "command",
|
|
1262
1278
|
op: "matches",
|
|
1263
|
-
value: "(
|
|
1279
|
+
value: "(?:^|[^\\w-])(?:gh)(?![\\w-])[^;&|]{0,200}?\\srelease\\s+(?:create|upload|edit)(?![\\w-])",
|
|
1264
1280
|
flags: "i"
|
|
1265
1281
|
}
|
|
1266
1282
|
],
|
|
1267
1283
|
verdict: "review",
|
|
1268
|
-
reason: "
|
|
1284
|
+
reason: "gh release ships a release on GitHub. node9 asks before publishing (Publishing shield)."
|
|
1269
1285
|
}
|
|
1270
1286
|
],
|
|
1271
|
-
dangerousWords: [
|
|
1287
|
+
dangerousWords: []
|
|
1288
|
+
};
|
|
1289
|
+
var ACTION_TEMPLATES = {
|
|
1290
|
+
finance: finance_default.smartRules,
|
|
1291
|
+
identity: identity_default.smartRules,
|
|
1292
|
+
publishing: publishing_default.smartRules
|
|
1293
|
+
};
|
|
1294
|
+
var ACTION_CHECKS = {
|
|
1295
|
+
finance: { checkId: "actions.money", slug: "money", label: "Money check" },
|
|
1296
|
+
identity: { checkId: "actions.access", slug: "access", label: "Accounts and access check" },
|
|
1297
|
+
publishing: { checkId: "actions.publish", slug: "publish", label: "Publishing check" }
|
|
1272
1298
|
};
|
|
1299
|
+
function isToolRule(rule) {
|
|
1300
|
+
return rule.tool.startsWith("{,mcp__*__}");
|
|
1301
|
+
}
|
|
1302
|
+
function actionPart(ruleName) {
|
|
1303
|
+
const m = /^shield:[^:]+:(.+)$/.exec(ruleName ?? "");
|
|
1304
|
+
return m ? m[1] : ruleName ?? "rule";
|
|
1305
|
+
}
|
|
1306
|
+
function ownReason(reason, owner) {
|
|
1307
|
+
if (!reason) return reason;
|
|
1308
|
+
return reason.replace(/\((?:Finance|Identity|Publishing) shield\)\.?$/, `(${owner}).`);
|
|
1309
|
+
}
|
|
1310
|
+
var GAP = "[^;&|]{0,200}?";
|
|
1311
|
+
var prog = (alt) => `(?:^|[^\\w-])(?:${alt})(?![\\w-])`;
|
|
1312
|
+
var httpTo = (host2) => prog("curl|wget|http|https|xh") + "[^;&|]{0,400}?" + host2;
|
|
1313
|
+
var httpWrite = (methods) => ({
|
|
1314
|
+
field: "command",
|
|
1315
|
+
op: "matches",
|
|
1316
|
+
value: `-X\\s*(?:${methods})|--(?:request|method)[=\\s]+(?:${methods})|--post-(?:data|file)|\\s(?:${methods}|${methods.toLowerCase()})\\s|^(?!.*\\s(?:-[a-zA-Z]*G|--get)(?![\\w-])).*(?:\\s-d[\\s'"@]|\\s--data|\\s--json\\s|\\s-F\\s|\\s--form\\s)`
|
|
1317
|
+
});
|
|
1318
|
+
var HTTP_WRITE = httpWrite("POST|DELETE");
|
|
1319
|
+
var HTTP_WRITE_ANY = httpWrite("POST|PUT|PATCH|DELETE");
|
|
1320
|
+
var NOT_STRIPE_TEST = {
|
|
1321
|
+
field: "command",
|
|
1322
|
+
op: "notMatches",
|
|
1323
|
+
value: "\\b[sr]k_test_"
|
|
1324
|
+
};
|
|
1325
|
+
var postTo = (host2) => `\\.post\\(\\s*["'\`][^"'\`]{0,80}${host2}`;
|
|
1326
|
+
var STRIPE_OBJECTS = "refunds|payouts|charges|transfers|payment_intents|payment_links|invoices|subscriptions|topups";
|
|
1327
|
+
var APP_SHIELD_SPECS = [
|
|
1328
|
+
{
|
|
1329
|
+
name: "stripe",
|
|
1330
|
+
label: "Stripe",
|
|
1331
|
+
description: "Asks before money moves in Stripe (refunds, payouts, charges, invoices, subscriptions), whether the agent uses the Stripe MCP server, the stripe CLI, the API or the Stripe library in a script. Reads are never asked about.",
|
|
1332
|
+
template: "finance",
|
|
1333
|
+
server: "*stripe*",
|
|
1334
|
+
doors: [
|
|
1335
|
+
{
|
|
1336
|
+
name: "shield:stripe:review-cli",
|
|
1337
|
+
tool: "bash",
|
|
1338
|
+
conditions: [
|
|
1339
|
+
{
|
|
1340
|
+
field: "command",
|
|
1341
|
+
op: "matches",
|
|
1342
|
+
value: prog("stripe") + GAP + `\\s(?:${STRIPE_OBJECTS})\\s+(?:create|cancel|capture|confirm|update|pay|finalize_invoice|send_invoice|void_invoice)(?![\\w-])`,
|
|
1343
|
+
flags: "i"
|
|
1344
|
+
},
|
|
1345
|
+
{
|
|
1346
|
+
field: "command",
|
|
1347
|
+
op: "matches",
|
|
1348
|
+
// The stripe CLI works in test mode unless told otherwise.
|
|
1349
|
+
value: "\\s--live(?![\\w-])|\\b[sr]k_live_"
|
|
1350
|
+
}
|
|
1351
|
+
],
|
|
1352
|
+
conditionMode: "all",
|
|
1353
|
+
verdict: "review",
|
|
1354
|
+
reason: "The stripe CLI is about to move money. node9 asks before money moves (Stripe)."
|
|
1355
|
+
},
|
|
1356
|
+
{
|
|
1357
|
+
name: "shield:stripe:review-cli-request",
|
|
1358
|
+
tool: "bash",
|
|
1359
|
+
conditions: [
|
|
1360
|
+
{
|
|
1361
|
+
field: "command",
|
|
1362
|
+
op: "matches",
|
|
1363
|
+
value: prog("stripe") + GAP + `\\s(?:post|delete)\\s+/?v1/(?:${STRIPE_OBJECTS})(?![\\w-])`,
|
|
1364
|
+
flags: "i"
|
|
1365
|
+
},
|
|
1366
|
+
{
|
|
1367
|
+
field: "command",
|
|
1368
|
+
op: "matches",
|
|
1369
|
+
// The stripe CLI works in test mode unless told otherwise.
|
|
1370
|
+
value: "\\s--live(?![\\w-])|\\b[sr]k_live_"
|
|
1371
|
+
}
|
|
1372
|
+
],
|
|
1373
|
+
conditionMode: "all",
|
|
1374
|
+
verdict: "review",
|
|
1375
|
+
reason: "A raw stripe CLI request is about to move money. node9 asks before money moves (Stripe)."
|
|
1376
|
+
},
|
|
1377
|
+
{
|
|
1378
|
+
name: "shield:stripe:review-api",
|
|
1379
|
+
tool: "bash",
|
|
1380
|
+
conditions: [
|
|
1381
|
+
{
|
|
1382
|
+
field: "command",
|
|
1383
|
+
op: "matches",
|
|
1384
|
+
value: httpTo(`api\\.stripe\\.com/v1/(?:${STRIPE_OBJECTS})(?![\\w-])`),
|
|
1385
|
+
flags: "i"
|
|
1386
|
+
},
|
|
1387
|
+
HTTP_WRITE,
|
|
1388
|
+
NOT_STRIPE_TEST
|
|
1389
|
+
],
|
|
1390
|
+
conditionMode: "all",
|
|
1391
|
+
verdict: "review",
|
|
1392
|
+
reason: "A request to the Stripe API is about to move money. node9 asks before money moves (Stripe)."
|
|
1393
|
+
},
|
|
1394
|
+
{
|
|
1395
|
+
name: "shield:stripe:review-code",
|
|
1396
|
+
tool: "bash",
|
|
1397
|
+
conditions: [
|
|
1398
|
+
{
|
|
1399
|
+
field: "command",
|
|
1400
|
+
op: "matches",
|
|
1401
|
+
// Python: stripe.Refund.create(...)
|
|
1402
|
+
value: "\\bstripe\\.(?:Refund|Payout|Transfer|Charge|PaymentIntent|PaymentLink|Invoice|Subscription|Topup)\\.(?:create|cancel|capture|confirm|modify|pay|finalize_invoice|send_invoice|void_invoice)\\b"
|
|
1403
|
+
},
|
|
1404
|
+
NOT_STRIPE_TEST
|
|
1405
|
+
],
|
|
1406
|
+
conditionMode: "all",
|
|
1407
|
+
verdict: "review",
|
|
1408
|
+
reason: "This code moves money through the Stripe library. node9 asks before money moves (Stripe)."
|
|
1409
|
+
},
|
|
1410
|
+
{
|
|
1411
|
+
name: "shield:stripe:review-code-node",
|
|
1412
|
+
tool: "bash",
|
|
1413
|
+
conditions: [
|
|
1414
|
+
{
|
|
1415
|
+
field: "command",
|
|
1416
|
+
op: "matches",
|
|
1417
|
+
// Node: stripe.refunds.create(...)
|
|
1418
|
+
value: "\\bstripe\\.(?:refunds|payouts|transfers|charges|paymentIntents|paymentLinks|invoices|subscriptions|topups)\\.(?:create|cancel|capture|confirm|update|pay|finalizeInvoice|sendInvoice|voidInvoice)\\s*\\("
|
|
1419
|
+
},
|
|
1420
|
+
NOT_STRIPE_TEST
|
|
1421
|
+
],
|
|
1422
|
+
conditionMode: "all",
|
|
1423
|
+
verdict: "review",
|
|
1424
|
+
reason: "This code moves money through the Stripe library. node9 asks before money moves (Stripe)."
|
|
1425
|
+
},
|
|
1426
|
+
{
|
|
1427
|
+
name: "shield:stripe:review-code-http",
|
|
1428
|
+
tool: "bash",
|
|
1429
|
+
conditions: [
|
|
1430
|
+
{
|
|
1431
|
+
field: "command",
|
|
1432
|
+
op: "matches",
|
|
1433
|
+
// requests.post("https://api.stripe.com/v1/refunds", ...)
|
|
1434
|
+
value: `\\.post\\(\\s*["'\`][^"'\`]{0,80}api\\.stripe\\.com/v1/(?:${STRIPE_OBJECTS})`
|
|
1435
|
+
},
|
|
1436
|
+
NOT_STRIPE_TEST
|
|
1437
|
+
],
|
|
1438
|
+
conditionMode: "all",
|
|
1439
|
+
verdict: "review",
|
|
1440
|
+
reason: "This code posts to the Stripe API. node9 asks before money moves (Stripe)."
|
|
1441
|
+
}
|
|
1442
|
+
]
|
|
1443
|
+
},
|
|
1444
|
+
{
|
|
1445
|
+
name: "paypal",
|
|
1446
|
+
label: "PayPal",
|
|
1447
|
+
description: "Asks before money moves in PayPal (refunds, payouts, captured orders, invoices, subscriptions), whether the agent uses a PayPal MCP server, the API or the PayPal SDK in a script. The sandbox is never asked about, and neither are reads.",
|
|
1448
|
+
template: "finance",
|
|
1449
|
+
server: "*paypal*",
|
|
1450
|
+
doors: [
|
|
1451
|
+
{
|
|
1452
|
+
name: "shield:paypal:review-api",
|
|
1453
|
+
tool: "bash",
|
|
1454
|
+
conditions: [
|
|
1455
|
+
{
|
|
1456
|
+
field: "command",
|
|
1457
|
+
op: "matches",
|
|
1458
|
+
// The live hosts only: api.paypal.com and api-m.paypal.com. The
|
|
1459
|
+
// sandbox (api-m.sandbox.paypal.com) moves no money.
|
|
1460
|
+
value: httpTo("api(?:-m)?\\.paypal\\.com/v[12]/"),
|
|
1461
|
+
flags: "i"
|
|
1462
|
+
},
|
|
1463
|
+
{
|
|
1464
|
+
field: "command",
|
|
1465
|
+
op: "matches",
|
|
1466
|
+
// The endpoints that move money.
|
|
1467
|
+
value: "\\.paypal\\.com/v[12]/(?:payments/(?:captures|authorizations|sale|payouts|payment|referenced-payouts)|checkout/orders/[^\\s/]{1,64}/(?:capture|authorize)|invoicing/invoices|billing/subscriptions)",
|
|
1468
|
+
flags: "i"
|
|
1469
|
+
},
|
|
1470
|
+
HTTP_WRITE
|
|
1471
|
+
],
|
|
1472
|
+
conditionMode: "all",
|
|
1473
|
+
verdict: "review",
|
|
1474
|
+
reason: "A request to the PayPal API is about to move money. node9 asks before money moves (PayPal)."
|
|
1475
|
+
},
|
|
1476
|
+
{
|
|
1477
|
+
name: "shield:paypal:review-code",
|
|
1478
|
+
tool: "bash",
|
|
1479
|
+
conditions: [
|
|
1480
|
+
{
|
|
1481
|
+
field: "command",
|
|
1482
|
+
op: "matches",
|
|
1483
|
+
// The Node SDKs (checkout-server-sdk, paypal-server-sdk) and the
|
|
1484
|
+
// Python paypalrestsdk.
|
|
1485
|
+
value: "\\b(?:CapturesRefundRequest|OrdersCaptureRequest|AuthorizationsCaptureRequest|PayoutsPostRequest)\\b|\\b(?:captureOrder|refundCapturedPayment|captureAuthorizedPayment|createBatchPayout)\\s*\\(|\\bpaypalrestsdk\\.(?:Payout|Sale|Capture|Invoice|BillingAgreement)\\b"
|
|
1486
|
+
}
|
|
1487
|
+
],
|
|
1488
|
+
verdict: "review",
|
|
1489
|
+
reason: "This code moves money through PayPal. node9 asks before money moves (PayPal)."
|
|
1490
|
+
},
|
|
1491
|
+
{
|
|
1492
|
+
name: "shield:paypal:review-code-http",
|
|
1493
|
+
tool: "bash",
|
|
1494
|
+
conditions: [
|
|
1495
|
+
{
|
|
1496
|
+
field: "command",
|
|
1497
|
+
op: "matches",
|
|
1498
|
+
// The endpoints that move money; the token call every script
|
|
1499
|
+
// starts with (/v1/oauth2/token) is not one.
|
|
1500
|
+
value: postTo(
|
|
1501
|
+
"api(?:-m)?\\.paypal\\.com/v[12]/(?:payments/(?:captures|authorizations|sale|payouts|payment|referenced-payouts)|checkout/orders/[^\\s/\"'`]{1,64}/(?:capture|authorize)|invoicing/invoices|billing/subscriptions)"
|
|
1502
|
+
)
|
|
1503
|
+
}
|
|
1504
|
+
],
|
|
1505
|
+
verdict: "review",
|
|
1506
|
+
reason: "This code posts to the PayPal API. node9 asks before money moves (PayPal)."
|
|
1507
|
+
}
|
|
1508
|
+
]
|
|
1509
|
+
},
|
|
1510
|
+
{
|
|
1511
|
+
name: "square",
|
|
1512
|
+
label: "Square",
|
|
1513
|
+
description: "Asks before money moves in Square (refunds, payments, paid orders, invoices, subscriptions), whether the agent uses a Square MCP server, the API or the Square SDK in a script. The sandbox host is never asked about, and neither are reads.",
|
|
1514
|
+
template: "finance",
|
|
1515
|
+
// Square's servers, never Squarespace (a website builder).
|
|
1516
|
+
server: "{*square,*square[-_]*,*squareup*}",
|
|
1517
|
+
mcpTools: [
|
|
1518
|
+
{
|
|
1519
|
+
// Square's official MCP server has one tool for every API call; the
|
|
1520
|
+
// service and method name what it does.
|
|
1521
|
+
name: "shield:square:review-mcp-request",
|
|
1522
|
+
tool: "{,mcp__*__}make_api_request",
|
|
1523
|
+
conditions: [
|
|
1524
|
+
{
|
|
1525
|
+
field: "service",
|
|
1526
|
+
op: "matches",
|
|
1527
|
+
value: "^(?:refunds|payments|orders|invoices|subscriptions|disputes|gift_cards|gift_card_activities|checkout|terminal)$",
|
|
1528
|
+
flags: "i"
|
|
1529
|
+
},
|
|
1530
|
+
{
|
|
1531
|
+
field: "method",
|
|
1532
|
+
op: "notMatches",
|
|
1533
|
+
value: "^(?:list|get|retrieve|search|batch_?retrieve|calculate)",
|
|
1534
|
+
flags: "i"
|
|
1535
|
+
}
|
|
1536
|
+
],
|
|
1537
|
+
conditionMode: "all",
|
|
1538
|
+
verdict: "review",
|
|
1539
|
+
reason: "A request through the Square MCP server is about to move money. node9 asks before money moves (Square)."
|
|
1540
|
+
}
|
|
1541
|
+
],
|
|
1542
|
+
doors: [
|
|
1543
|
+
{
|
|
1544
|
+
name: "shield:square:review-api",
|
|
1545
|
+
tool: "bash",
|
|
1546
|
+
conditions: [
|
|
1547
|
+
{
|
|
1548
|
+
field: "command",
|
|
1549
|
+
op: "matches",
|
|
1550
|
+
// The live host only; the sandbox is connect.squareupsandbox.com.
|
|
1551
|
+
value: httpTo(
|
|
1552
|
+
"connect\\.squareup\\.com/v2/(?:refunds|payments|orders/[^\\s/?]{1,64}/pay|invoices|subscriptions|disputes|gift-cards/activities)(?![\\w-]|/search)"
|
|
1553
|
+
),
|
|
1554
|
+
flags: "i"
|
|
1555
|
+
},
|
|
1556
|
+
HTTP_WRITE_ANY
|
|
1557
|
+
],
|
|
1558
|
+
conditionMode: "all",
|
|
1559
|
+
verdict: "review",
|
|
1560
|
+
reason: "A request to the Square API is about to move money. node9 asks before money moves (Square)."
|
|
1561
|
+
},
|
|
1562
|
+
{
|
|
1563
|
+
name: "shield:square:review-code",
|
|
1564
|
+
tool: "bash",
|
|
1565
|
+
conditions: [
|
|
1566
|
+
{
|
|
1567
|
+
field: "command",
|
|
1568
|
+
op: "matches",
|
|
1569
|
+
// The Square SDK in the script: Node (`square`) or Python (`square`, `squareup`).
|
|
1570
|
+
value: `\\bSquareClient\\b|\\bsquare\\.client\\b|from\\s+square[.\\s]|from\\s+["']square["']|require\\(\\s*["']square["']`
|
|
1571
|
+
},
|
|
1572
|
+
{
|
|
1573
|
+
field: "command",
|
|
1574
|
+
op: "matches",
|
|
1575
|
+
value: "\\.refunds(?:Api)?\\.refund(?:Payment|_payment)\\s*\\(|\\.payments(?:Api)?\\.(?:create|complete)(?:Payment|_payment)?\\s*\\(|\\.orders(?:Api)?\\.pay(?:Order|_order)?\\s*\\(|\\.invoices(?:Api)?\\.publish(?:Invoice|_invoice)?\\s*\\("
|
|
1576
|
+
}
|
|
1577
|
+
],
|
|
1578
|
+
conditionMode: "all",
|
|
1579
|
+
verdict: "review",
|
|
1580
|
+
reason: "This code moves money through the Square SDK. node9 asks before money moves (Square)."
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
name: "shield:square:review-code-http",
|
|
1584
|
+
tool: "bash",
|
|
1585
|
+
conditions: [
|
|
1586
|
+
{
|
|
1587
|
+
field: "command",
|
|
1588
|
+
op: "matches",
|
|
1589
|
+
value: postTo(
|
|
1590
|
+
"connect\\.squareup\\.com/v2/(?:refunds|payments|orders/[^\\s/?\"'`]{1,64}/pay|invoices|subscriptions|disputes|gift-cards/activities)(?![\\w-]|/search)"
|
|
1591
|
+
)
|
|
1592
|
+
}
|
|
1593
|
+
],
|
|
1594
|
+
verdict: "review",
|
|
1595
|
+
reason: "This code posts to the Square API. node9 asks before money moves (Square)."
|
|
1596
|
+
}
|
|
1597
|
+
]
|
|
1598
|
+
},
|
|
1599
|
+
{
|
|
1600
|
+
name: "plaid",
|
|
1601
|
+
label: "Plaid",
|
|
1602
|
+
description: "Asks before money moves through Plaid (transfers, transfer authorizations, payment initiation), whether the agent uses a Plaid MCP server, the API or the Plaid SDK in a script. The sandbox host is never asked about, and neither are reads such as balances or transactions.",
|
|
1603
|
+
template: "finance",
|
|
1604
|
+
server: "*plaid*",
|
|
1605
|
+
doors: [
|
|
1606
|
+
{
|
|
1607
|
+
name: "shield:plaid:review-api",
|
|
1608
|
+
tool: "bash",
|
|
1609
|
+
conditions: [
|
|
1610
|
+
{
|
|
1611
|
+
field: "command",
|
|
1612
|
+
op: "matches",
|
|
1613
|
+
// Every Plaid endpoint is a POST, so the path is what tells a
|
|
1614
|
+
// write; the live host only, never sandbox.plaid.com. A script
|
|
1615
|
+
// that posts to the URL meets this door too.
|
|
1616
|
+
value: httpTo(
|
|
1617
|
+
"production\\.plaid\\.com/(?:transfer/(?:create|authorization/create|recurring/create)|payment_initiation/payment/create|bank_transfer/create)(?![\\w-])"
|
|
1618
|
+
),
|
|
1619
|
+
flags: "i"
|
|
1620
|
+
}
|
|
1621
|
+
],
|
|
1622
|
+
verdict: "review",
|
|
1623
|
+
reason: "A request to the Plaid API is about to move money. node9 asks before money moves (Plaid)."
|
|
1624
|
+
},
|
|
1625
|
+
{
|
|
1626
|
+
name: "shield:plaid:review-code",
|
|
1627
|
+
tool: "bash",
|
|
1628
|
+
conditions: [
|
|
1629
|
+
{ field: "command", op: "matches", value: "\\bplaid", flags: "i" },
|
|
1630
|
+
{
|
|
1631
|
+
field: "command",
|
|
1632
|
+
op: "matches",
|
|
1633
|
+
value: "\\b(?:transfer(?:Authorization|Recurring)?Create|paymentInitiationPaymentCreate|bankTransferCreate|transfer_(?:authorization_|recurring_)?create|payment_initiation_payment_create|bank_transfer_create)\\s*\\("
|
|
1634
|
+
}
|
|
1635
|
+
],
|
|
1636
|
+
conditionMode: "all",
|
|
1637
|
+
verdict: "review",
|
|
1638
|
+
reason: "This code moves money through Plaid. node9 asks before money moves (Plaid)."
|
|
1639
|
+
}
|
|
1640
|
+
]
|
|
1641
|
+
},
|
|
1642
|
+
{
|
|
1643
|
+
name: "okta",
|
|
1644
|
+
label: "Okta",
|
|
1645
|
+
description: "Asks before a user, a group member, a role, a password or a key changes in Okta, whether the agent uses an Okta MCP server, the API or the Okta SDK in a script. Reads and signing in are never asked about.",
|
|
1646
|
+
template: "identity",
|
|
1647
|
+
server: "*okta*",
|
|
1648
|
+
doors: [
|
|
1649
|
+
{
|
|
1650
|
+
name: "shield:okta:review-api",
|
|
1651
|
+
tool: "bash",
|
|
1652
|
+
conditions: [
|
|
1653
|
+
{
|
|
1654
|
+
field: "command",
|
|
1655
|
+
op: "matches",
|
|
1656
|
+
// The management API only: sign-in (/api/v1/authn, /sessions,
|
|
1657
|
+
// /oauth2) is not under these paths.
|
|
1658
|
+
value: httpTo(
|
|
1659
|
+
"[\\w-]+\\.okta(?:-emea)?\\.com/api/v1/(?:users|groups|apps|iam|api-tokens|idps|authorizationServers|policies)(?![\\w-])"
|
|
1660
|
+
),
|
|
1661
|
+
flags: "i"
|
|
1662
|
+
},
|
|
1663
|
+
HTTP_WRITE_ANY
|
|
1664
|
+
],
|
|
1665
|
+
conditionMode: "all",
|
|
1666
|
+
verdict: "review",
|
|
1667
|
+
reason: "A request to the Okta API is about to change who has access. node9 asks before access changes (Okta)."
|
|
1668
|
+
},
|
|
1669
|
+
{
|
|
1670
|
+
name: "shield:okta:review-code",
|
|
1671
|
+
tool: "bash",
|
|
1672
|
+
conditions: [
|
|
1673
|
+
{
|
|
1674
|
+
field: "command",
|
|
1675
|
+
op: "matches",
|
|
1676
|
+
// The Okta SDK in the script: a method named createUser alone is
|
|
1677
|
+
// in half the applications ever written.
|
|
1678
|
+
value: "@okta/okta-sdk|\\bokta\\.Client\\b|from\\s+okta[.\\s]|\\bimport\\s+okta\\b"
|
|
1679
|
+
},
|
|
1680
|
+
{
|
|
1681
|
+
field: "command",
|
|
1682
|
+
op: "matches",
|
|
1683
|
+
value: "\\b(?:(?:create|delete|deactivate|suspend|unlock|activate)User|(?:reset|expire)Password|resetFactors|(?:assign|unassign)User(?:To|From)Group|assignRoleTo(?:User|Group))\\s*\\("
|
|
1684
|
+
}
|
|
1685
|
+
],
|
|
1686
|
+
conditionMode: "all",
|
|
1687
|
+
verdict: "review",
|
|
1688
|
+
reason: "This code changes who has access in Okta. node9 asks before access changes (Okta)."
|
|
1689
|
+
},
|
|
1690
|
+
{
|
|
1691
|
+
name: "shield:okta:review-code-py",
|
|
1692
|
+
tool: "bash",
|
|
1693
|
+
conditions: [
|
|
1694
|
+
{
|
|
1695
|
+
field: "command",
|
|
1696
|
+
op: "matches",
|
|
1697
|
+
value: "@okta/okta-sdk|\\bokta\\.Client\\b|from\\s+okta[.\\s]|\\bimport\\s+okta\\b"
|
|
1698
|
+
},
|
|
1699
|
+
{
|
|
1700
|
+
field: "command",
|
|
1701
|
+
op: "matches",
|
|
1702
|
+
value: "\\b(?:(?:create|delete|deactivate|deactivate_or_delete|suspend|unlock|activate)_user|(?:reset|expire)_password|reset_factors|(?:add|remove)_user_(?:to|from)_group|assign_role_to_(?:user|group))\\s*\\("
|
|
1703
|
+
}
|
|
1704
|
+
],
|
|
1705
|
+
conditionMode: "all",
|
|
1706
|
+
verdict: "review",
|
|
1707
|
+
reason: "This code changes who has access in Okta. node9 asks before access changes (Okta)."
|
|
1708
|
+
}
|
|
1709
|
+
]
|
|
1710
|
+
},
|
|
1711
|
+
{
|
|
1712
|
+
name: "auth0",
|
|
1713
|
+
label: "Auth0",
|
|
1714
|
+
description: "Asks before a user, a role, an application or its permissions change in Auth0, whether the agent uses an Auth0 MCP server, the auth0 CLI, the Management API or the Auth0 SDK in a script. Reads and signing in are never asked about.",
|
|
1715
|
+
template: "identity",
|
|
1716
|
+
server: "*auth0*",
|
|
1717
|
+
mcpTools: [
|
|
1718
|
+
{
|
|
1719
|
+
// Auth0's official MCP server: applications (their secrets and
|
|
1720
|
+
// callbacks), APIs and their scopes, and Actions (code that runs at
|
|
1721
|
+
// every sign-in).
|
|
1722
|
+
name: "shield:auth0:review-tenant-config",
|
|
1723
|
+
tool: "{,mcp__*__}{auth0_create_application,auth0_update_application,auth0_create_resource_server,auth0_update_resource_server,auth0_create_action,auth0_update_action,auth0_deploy_action}",
|
|
1724
|
+
conditions: [],
|
|
1725
|
+
verdict: "review",
|
|
1726
|
+
reason: "This changes an Auth0 application, API or sign-in Action. node9 asks before access changes (Auth0)."
|
|
1727
|
+
}
|
|
1728
|
+
],
|
|
1729
|
+
doors: [
|
|
1730
|
+
{
|
|
1731
|
+
name: "shield:auth0:review-cli",
|
|
1732
|
+
tool: "bash",
|
|
1733
|
+
conditions: [
|
|
1734
|
+
{
|
|
1735
|
+
field: "command",
|
|
1736
|
+
op: "matches",
|
|
1737
|
+
value: prog("auth0") + GAP + "\\s(?:(?:users|roles|apps|orgs)\\s+(?:create|update|delete|rm)|users\\s+roles\\s+(?:assign|add|remove|rm)|roles\\s+permissions\\s+(?:add|remove|rm)|users\\s+blocks\\s+unblock|api\\s+(?:post|put|patch|delete))(?![\\w-])",
|
|
1738
|
+
flags: "i"
|
|
1739
|
+
}
|
|
1740
|
+
],
|
|
1741
|
+
verdict: "review",
|
|
1742
|
+
reason: "The auth0 CLI is about to change who has access. node9 asks before access changes (Auth0)."
|
|
1743
|
+
},
|
|
1744
|
+
{
|
|
1745
|
+
name: "shield:auth0:review-api",
|
|
1746
|
+
tool: "bash",
|
|
1747
|
+
conditions: [
|
|
1748
|
+
{
|
|
1749
|
+
field: "command",
|
|
1750
|
+
op: "matches",
|
|
1751
|
+
// The Management API only; /oauth/token is signing in.
|
|
1752
|
+
value: httpTo(
|
|
1753
|
+
"\\.auth0\\.com/api/v2/(?:users|roles|clients|grants|client-grants|organizations|tickets|jobs/users-imports|device-credentials)(?![\\w-])"
|
|
1754
|
+
),
|
|
1755
|
+
flags: "i"
|
|
1756
|
+
},
|
|
1757
|
+
HTTP_WRITE_ANY
|
|
1758
|
+
],
|
|
1759
|
+
conditionMode: "all",
|
|
1760
|
+
verdict: "review",
|
|
1761
|
+
reason: "A request to the Auth0 Management API is about to change who has access. node9 asks before access changes (Auth0)."
|
|
1762
|
+
},
|
|
1763
|
+
{
|
|
1764
|
+
name: "shield:auth0:review-code",
|
|
1765
|
+
tool: "bash",
|
|
1766
|
+
conditions: [
|
|
1767
|
+
{
|
|
1768
|
+
field: "command",
|
|
1769
|
+
op: "matches",
|
|
1770
|
+
// The Auth0 SDK in the script (Node `auth0`, Python `auth0`).
|
|
1771
|
+
value: `\\bManagementClient\\b|from\\s+auth0[.\\s]|from\\s+["']auth0["']|require\\(\\s*["']auth0["']`
|
|
1772
|
+
},
|
|
1773
|
+
{
|
|
1774
|
+
field: "command",
|
|
1775
|
+
op: "matches",
|
|
1776
|
+
value: "\\.(?:users|roles|organizations|clients)\\.(?:create|delete|update|assignRoles|deleteRoles|assignUsers|addPermissions|deletePermissions|addMembers|deleteMembers|add_roles|remove_roles|add_users|add_permissions|remove_permissions)\\s*\\("
|
|
1777
|
+
}
|
|
1778
|
+
],
|
|
1779
|
+
conditionMode: "all",
|
|
1780
|
+
verdict: "review",
|
|
1781
|
+
reason: "This code changes who has access in Auth0. node9 asks before access changes (Auth0)."
|
|
1782
|
+
}
|
|
1783
|
+
]
|
|
1784
|
+
}
|
|
1785
|
+
];
|
|
1786
|
+
function buildAppShield(spec) {
|
|
1787
|
+
const owner = spec.label;
|
|
1788
|
+
const toolRules = ACTION_TEMPLATES[spec.template].filter(isToolRule).map((rule) => ({
|
|
1789
|
+
...rule,
|
|
1790
|
+
name: `shield:${spec.name}:${actionPart(rule.name)}`,
|
|
1791
|
+
server: spec.server,
|
|
1792
|
+
reason: ownReason(rule.reason, owner)
|
|
1793
|
+
}));
|
|
1794
|
+
const ownTools = (spec.mcpTools ?? []).map((rule) => ({
|
|
1795
|
+
...rule,
|
|
1796
|
+
server: spec.server
|
|
1797
|
+
}));
|
|
1798
|
+
return {
|
|
1799
|
+
name: spec.name,
|
|
1800
|
+
description: spec.description,
|
|
1801
|
+
aliases: [],
|
|
1802
|
+
smartRules: [...toolRules, ...ownTools, ...spec.doors],
|
|
1803
|
+
dangerousWords: []
|
|
1804
|
+
};
|
|
1805
|
+
}
|
|
1806
|
+
var APP_SHIELDS = APP_SHIELD_SPECS.map(buildAppShield);
|
|
1807
|
+
var APP_SHIELD_NAMES = new Set(APP_SHIELD_SPECS.map((s) => s.name));
|
|
1808
|
+
var APP_SERVER_GLOB = `{${APP_SHIELD_SPECS.map((s) => s.server).join(",")}}`;
|
|
1809
|
+
function buildGeneralRules() {
|
|
1810
|
+
const out = [];
|
|
1811
|
+
for (const name of Object.keys(ACTION_TEMPLATES)) {
|
|
1812
|
+
const { slug, label } = ACTION_CHECKS[name];
|
|
1813
|
+
for (const rule of ACTION_TEMPLATES[name].filter(isToolRule)) {
|
|
1814
|
+
const part = actionPart(rule.name).replace(/^review-/, "");
|
|
1815
|
+
out.push({
|
|
1816
|
+
...rule,
|
|
1817
|
+
name: `review-action-${slug}-${part}`,
|
|
1818
|
+
notServer: APP_SERVER_GLOB,
|
|
1819
|
+
reason: ownReason(rule.reason, label)
|
|
1820
|
+
});
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
return out;
|
|
1824
|
+
}
|
|
1825
|
+
var GENERAL_ACTION_RULES = buildGeneralRules();
|
|
1826
|
+
function generalActionRuleNames(template) {
|
|
1827
|
+
const { slug } = ACTION_CHECKS[template];
|
|
1828
|
+
return GENERAL_ACTION_RULES.filter((r) => r.name?.startsWith(`review-action-${slug}-`)).map(
|
|
1829
|
+
(r) => r.name
|
|
1830
|
+
);
|
|
1831
|
+
}
|
|
1273
1832
|
function validateShieldDefinition(raw) {
|
|
1274
1833
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
1275
1834
|
return { error: "Shield file is not an object" };
|
|
@@ -1288,36 +1847,36 @@ var BUILTIN_SHIELDS = {
|
|
|
1288
1847
|
[bash_safe_default.name]: bash_safe_default,
|
|
1289
1848
|
[docker_default.name]: docker_default,
|
|
1290
1849
|
[filesystem_default.name]: filesystem_default,
|
|
1291
|
-
// Dangerous actions as category shields (node9Firewall#385): an MCP app's
|
|
1292
|
-
// money, credential and publishing tools, asked about whatever the request
|
|
1293
|
-
// said. One glob per rule covers the bare name the gateway sends and the
|
|
1294
|
-
// mcp__<server>__ name the agent hook sends.
|
|
1295
|
-
[finance_default.name]: finance_default,
|
|
1296
1850
|
[github_default.name]: github_default,
|
|
1297
|
-
[identity_default.name]: identity_default,
|
|
1298
1851
|
[k8s_default.name]: k8s_default,
|
|
1299
1852
|
[mongodb_default.name]: mongodb_default,
|
|
1300
1853
|
[postgres_default.name]: postgres_default,
|
|
1301
1854
|
[project_jail_default.name]: project_jail_default,
|
|
1302
|
-
[
|
|
1303
|
-
|
|
1855
|
+
[redis_default.name]: redis_default,
|
|
1856
|
+
// App shields generated from the action templates (node9Firewall#390): one
|
|
1857
|
+
// per app, every door (MCP server, CLI, API, library), off by default.
|
|
1858
|
+
...Object.fromEntries(APP_SHIELDS.map((s) => [s.name, s]))
|
|
1304
1859
|
};
|
|
1305
|
-
var ACTION_SHIELD_NAMES = /* @__PURE__ */ new Set([
|
|
1306
|
-
"finance",
|
|
1307
|
-
"identity",
|
|
1308
|
-
"publishing"
|
|
1309
|
-
]);
|
|
1310
1860
|
function assertBuiltinShieldRegexesAreSafe() {
|
|
1311
|
-
|
|
1861
|
+
const sets = [
|
|
1862
|
+
...Object.values(BUILTIN_SHIELDS).map((sh) => ({
|
|
1863
|
+
name: sh.name,
|
|
1864
|
+
smartRules: sh.smartRules
|
|
1865
|
+
})),
|
|
1866
|
+
...Object.entries(ACTION_TEMPLATES).map(([name, smartRules]) => ({ name, smartRules })),
|
|
1867
|
+
{ name: "general-action-checks", smartRules: GENERAL_ACTION_RULES }
|
|
1868
|
+
];
|
|
1869
|
+
for (const shield of sets) {
|
|
1312
1870
|
for (const rule of shield.smartRules) {
|
|
1313
1871
|
const conditions = rule.conditions ?? [];
|
|
1314
1872
|
for (const cond of conditions) {
|
|
1315
1873
|
if (cond.op !== "matches" && cond.op !== "notMatches") continue;
|
|
1316
1874
|
const pattern = cond.value;
|
|
1317
1875
|
if (!pattern) continue;
|
|
1318
|
-
|
|
1876
|
+
const problem = validateRegex(pattern);
|
|
1877
|
+
if (problem) {
|
|
1319
1878
|
throw new Error(
|
|
1320
|
-
`[node9 engine] Shield '${shield.name}' rule '${rule.name ?? rule.tool}' has
|
|
1879
|
+
`[node9 engine] Shield '${shield.name}' rule '${rule.name ?? rule.tool}' has a regex the runtime refuses (${problem}): ${pattern}`
|
|
1321
1880
|
);
|
|
1322
1881
|
}
|
|
1323
1882
|
}
|
|
@@ -1348,9 +1907,9 @@ var CHECK_TEXT = {
|
|
|
1348
1907
|
},
|
|
1349
1908
|
// ── Commands ──────────────────────────────────────────────────────────────
|
|
1350
1909
|
"commands.inline-exec": {
|
|
1351
|
-
plain: "The agent runs a small program written inside the command itself.",
|
|
1910
|
+
plain: "The agent runs a small program written inside the command itself, and node9 reads it: ordinary code runs, code that deletes, sends data out, runs other commands or reads protected files is held, and so is code node9 cannot read.",
|
|
1352
1911
|
example: `node -e "require('fs').rmSync('dist', {recursive: true})"`,
|
|
1353
|
-
advice: "
|
|
1912
|
+
advice: "Keep Review. Strict mode reviews every inline call, harmless or not; Log or Off only if inline code never reaches anything that matters."
|
|
1354
1913
|
},
|
|
1355
1914
|
"commands.eval-dynamic": {
|
|
1356
1915
|
plain: "The agent runs code whose content is built at run time, so node9 cannot read it in advance.",
|
|
@@ -1382,6 +1941,21 @@ var CHECK_TEXT = {
|
|
|
1382
1941
|
example: "chmod 777 deploy.sh",
|
|
1383
1942
|
advice: "Keep Review. A narrower permission (755, 644) almost always does the job."
|
|
1384
1943
|
},
|
|
1944
|
+
"actions.money": {
|
|
1945
|
+
plain: "The agent moves money (a refund, a payout, a transfer, a charge) through an app node9 has no protection for, such as an internal billing server.",
|
|
1946
|
+
example: "refund_order on a server called acme-billing",
|
|
1947
|
+
advice: "Keep Review. When the app is Stripe or PayPal, turn on its own protection instead: it covers the CLI, the API and scripts too, and a call from it no longer comes here."
|
|
1948
|
+
},
|
|
1949
|
+
"actions.access": {
|
|
1950
|
+
plain: "The agent changes a password, a key, a role or who belongs to a team, through an app node9 has no protection for.",
|
|
1951
|
+
example: "invite_user or grant_role on a company admin server",
|
|
1952
|
+
advice: "Keep Review. Set Log on a sandbox workspace where agents manage test users all day."
|
|
1953
|
+
},
|
|
1954
|
+
"actions.publish": {
|
|
1955
|
+
plain: "The agent publishes something outside the organisation (a release, a package, a deploy, a public post) through an app node9 has no protection for.",
|
|
1956
|
+
example: "create_release or deploy_to_production on a company MCP server",
|
|
1957
|
+
advice: "Keep Review. Set Log on a release machine whose pipeline publishes on purpose, never on a developer laptop."
|
|
1958
|
+
},
|
|
1385
1959
|
"commands.sudo": {
|
|
1386
1960
|
plain: "The agent runs a command as the administrator (root).",
|
|
1387
1961
|
example: "sudo apt-get install -y nginx",
|
|
@@ -1542,7 +2116,7 @@ var CHECK_TEXT = {
|
|
|
1542
2116
|
advice: "Fixed at Block. A person accepts the change on the machine (node9 mcp pin update)."
|
|
1543
2117
|
},
|
|
1544
2118
|
"loading.malicious-package": {
|
|
1545
|
-
plain: "The agent installs a package that the public malicious-package database (OSV) lists, or one published minutes ago. Covers npm, PyPI, RubyGems, crates.io, Go, NuGet, Maven, Packagist and VS Code extensions; the publish-age and install-script signals are npm and PyPI only.",
|
|
2119
|
+
plain: "The agent installs a package that the public malicious-package database (OSV) lists, or one published minutes ago. Covers npm, PyPI, RubyGems, crates.io, Go, NuGet, Maven, Packagist and VS Code extensions; the publish-age and install-script signals are npm and PyPI only. A new release built from the same repository as the one before it (registry provenance) and an install script the package has always run do not stop; a release that lost the provenance its previous release had does.",
|
|
1546
2120
|
example: "npm install of a package flagged as malware",
|
|
1547
2121
|
advice: "Keep Block for known-malicious packages; brand-new packages already stop for Review."
|
|
1548
2122
|
}
|
|
@@ -1593,7 +2167,7 @@ var PRODUCT_CHECKS = [
|
|
|
1593
2167
|
id: "commands.inline-exec",
|
|
1594
2168
|
group: "commands",
|
|
1595
2169
|
title: "Inline code execution",
|
|
1596
|
-
catches: "
|
|
2170
|
+
catches: "inline code (python -c, node -e, a heredoc into an interpreter) that deletes, sends, opens a socket, runs commands, reads protected files or decodes and runs; unreadable inline code",
|
|
1597
2171
|
values: ALL,
|
|
1598
2172
|
defaultValue: "review",
|
|
1599
2173
|
legacy: ["Node9 Standard (Inline Execution)"]
|
|
@@ -1950,6 +2524,38 @@ var PRODUCT_CHECKS = [
|
|
|
1950
2524
|
values: ALL,
|
|
1951
2525
|
defaultValue: "block",
|
|
1952
2526
|
legacy: ["\u{1F4E6} Node9 Package Check (Malicious)", "\u{1F4E6} Node9 Package Check (Review)"]
|
|
2527
|
+
},
|
|
2528
|
+
// ── Actions in apps (node9Firewall#390) ──────────────────────────────────
|
|
2529
|
+
// The safety net under the app shields: an action that moves money, changes
|
|
2530
|
+
// access or publishes, on an MCP server no app shield claims (an internal
|
|
2531
|
+
// billing server, a vendor with no shield, Zapier). Review by default; the
|
|
2532
|
+
// rules come from the action templates (shields/apps.ts).
|
|
2533
|
+
{
|
|
2534
|
+
id: "actions.money",
|
|
2535
|
+
group: "actions",
|
|
2536
|
+
title: "Money moves",
|
|
2537
|
+
catches: "a refund, payout, transfer, charge or withdrawal through an app with no protection of its own",
|
|
2538
|
+
values: ALL,
|
|
2539
|
+
defaultValue: "review",
|
|
2540
|
+
legacy: generalActionRuleNames("finance")
|
|
2541
|
+
},
|
|
2542
|
+
{
|
|
2543
|
+
id: "actions.access",
|
|
2544
|
+
group: "actions",
|
|
2545
|
+
title: "Accounts and access change",
|
|
2546
|
+
catches: "a password, key, role, permission or user changed through an app with no protection of its own",
|
|
2547
|
+
values: ALL,
|
|
2548
|
+
defaultValue: "review",
|
|
2549
|
+
legacy: generalActionRuleNames("identity")
|
|
2550
|
+
},
|
|
2551
|
+
{
|
|
2552
|
+
id: "actions.publish",
|
|
2553
|
+
group: "actions",
|
|
2554
|
+
title: "Something is published",
|
|
2555
|
+
catches: "a release, package, deploy or public post through an app with no protection of its own",
|
|
2556
|
+
values: ALL,
|
|
2557
|
+
defaultValue: "review",
|
|
2558
|
+
legacy: generalActionRuleNames("publishing")
|
|
1953
2559
|
}
|
|
1954
2560
|
];
|
|
1955
2561
|
var SHIELD_RULE_NAME = /^shield:([^:]+):(block|review|allow)-(.+)$/;
|
|
@@ -2071,6 +2677,170 @@ var HOMOGLYPHS = {
|
|
|
2071
2677
|
\u03A7: "X"
|
|
2072
2678
|
};
|
|
2073
2679
|
var HOMOGLYPH_RE = new RegExp(`[${Object.keys(HOMOGLYPHS).join("")}]`, "g");
|
|
2680
|
+
var SYSTEM_DIRS = [
|
|
2681
|
+
"/usr",
|
|
2682
|
+
"/etc",
|
|
2683
|
+
"/boot",
|
|
2684
|
+
"/bin",
|
|
2685
|
+
"/sbin",
|
|
2686
|
+
"/lib",
|
|
2687
|
+
"/lib64",
|
|
2688
|
+
"/var/log"
|
|
2689
|
+
];
|
|
2690
|
+
var UPLOAD_SYSTEM_DIRS = [...SYSTEM_DIRS, "/proc", "/sys", "/root"];
|
|
2691
|
+
var LEGACY_SYSTEM_PATH_RE = /^(?:[a-zA-Z]:)?\/etc\/(?:passwd|shadow|sudoers)$/;
|
|
2692
|
+
var MAX_INLINE_CODE = 64 * 1024;
|
|
2693
|
+
var OUTSIDE = String.raw`(?:~|\.\.[\\/]|/(?!(?:tmp|var/tmp)/(?![^'"\n]*\.\.)|dev/(?:null|stdout|stderr)\b))`;
|
|
2694
|
+
var pyImport = (mods) => new RegExp(String.raw`\b(?:import\s+(?:[\w.]+(?:\s+as\s+\w+)?\s*,\s*)*|from\s+)(?:${mods})\b`);
|
|
2695
|
+
var either = (...res) => new RegExp(res.map((r) => `(?:${r.source})`).join("|"), "m");
|
|
2696
|
+
var PYTHON = [
|
|
2697
|
+
[
|
|
2698
|
+
"deletes",
|
|
2699
|
+
/\bos\.(?:remove|unlink|rmdir|removedirs)\s*\(|\bshutil\.rmtree\s*\(|\.(?:unlink|rmdir)\s*\(|\bfrom\s+(?:os|shutil)\s+import\s+[^\n]*\b(?:remove|unlink|rmdir|removedirs|rmtree)\b/
|
|
2700
|
+
],
|
|
2701
|
+
[
|
|
2702
|
+
"writes-outside",
|
|
2703
|
+
new RegExp(
|
|
2704
|
+
String.raw`\bopen\s*\(\s*[rRbBuU]?['"]${OUTSIDE}[^'"\n]*['"]\s*,\s*(?:mode\s*=\s*)?[rRbB]?['"][^'"\n]*[wax+]|\bPath\s*\(\s*[rR]?['"]${OUTSIDE}[^'"\n]*['"]\s*\)\s*\.(?:write_text|write_bytes|touch|mkdir|symlink_to)\s*\(|\bshutil\.(?:copy\w*|move)\s*\([^)\n]*['"]${OUTSIDE}|\bos\.(?:rename|replace|symlink|link|truncate|makedirs|mkdir)\s*\([^)\n]*['"]${OUTSIDE}`
|
|
2705
|
+
)
|
|
2706
|
+
],
|
|
2707
|
+
[
|
|
2708
|
+
"sends",
|
|
2709
|
+
either(
|
|
2710
|
+
pyImport(
|
|
2711
|
+
String.raw`socket|requests|urllib2|urllib3|http\.client|httplib|smtplib|ftplib|paramiko|telnetlib|aiohttp|httpx|websockets?|xmlrpc|poplib|imaplib|pycurl|scapy`
|
|
2712
|
+
),
|
|
2713
|
+
/\burllib\.request\b|\burlopen\s*\(|\bfrom\s+urllib\s+import\s+[^\n;]*\brequest\b|\basyncio\.open_connection\s*\(/
|
|
2714
|
+
)
|
|
2715
|
+
],
|
|
2716
|
+
[
|
|
2717
|
+
"listens",
|
|
2718
|
+
either(
|
|
2719
|
+
pyImport(String.raw`pty|socketserver|http\.server`),
|
|
2720
|
+
/\bpty\.spawn\s*\(|\.bind\s*\(\s*\(|\basyncio\.start_server\s*\(/
|
|
2721
|
+
)
|
|
2722
|
+
],
|
|
2723
|
+
[
|
|
2724
|
+
"runs-commands",
|
|
2725
|
+
either(
|
|
2726
|
+
pyImport("subprocess|pexpect|commands|psutil"),
|
|
2727
|
+
/\bos\.(?:system|popen|exec\w*|spawn\w*|posix_spawn\w*|fork|forkpty|kill|killpg)\s*\(|\bfrom\s+os\s+import\s+[^\n;]*\b(?:system|popen|exec\w*|spawn\w*|fork|kill)\b|\bfrom\s+(?:os|shutil|pty|ctypes)\s+import\s+\*/
|
|
2728
|
+
)
|
|
2729
|
+
],
|
|
2730
|
+
[
|
|
2731
|
+
"builds-code",
|
|
2732
|
+
/(?<![\w.])(?:exec|eval|compile|execfile)\s*\(|\b__import__\s*\(|\bimportlib\b|\b(?:c?pickle|dill|marshal|shelve)\.loads?\s*\(|\byaml\.(?:unsafe_)?load\s*\((?![^)\n]*SafeLoader)|\bctypes\b|\b(?:getattr|vars)\s*\(\s*(?:os|subprocess|shutil|socket|sys|pty|builtins|__builtins__)\b|\b(?:os|subprocess|shutil|socket|sys|pty|builtins)\.__dict__\b|\b__builtins__\b|\bsys\.modules\b|\bglobals\s*\(\s*\)\s*\[/
|
|
2733
|
+
],
|
|
2734
|
+
[
|
|
2735
|
+
// Spyware shapes: a screenshot, the clipboard, a key logger.
|
|
2736
|
+
"monitors",
|
|
2737
|
+
either(
|
|
2738
|
+
pyImport(String.raw`pyperclip|pynput|keyboard|pyautogui|pyscreenshot|mss|clipboard`),
|
|
2739
|
+
/\bImageGrab\b|\bpyautogui\.screenshot\b|\bscreencapture\b/
|
|
2740
|
+
)
|
|
2741
|
+
],
|
|
2742
|
+
[
|
|
2743
|
+
"permissions",
|
|
2744
|
+
/\bos\.(?:chmod|lchmod|fchmod|chown|lchown|fchown|setuid|setgid|seteuid|setegid|setreuid|setregid|setresuid)\s*\(|\.chmod\s*\(|\bshutil\.chown\s*\(/
|
|
2745
|
+
]
|
|
2746
|
+
];
|
|
2747
|
+
var NODE = [
|
|
2748
|
+
[
|
|
2749
|
+
"deletes",
|
|
2750
|
+
/\.(?:rm|rmSync|rmdir|rmdirSync|unlink|unlinkSync)\s*\(|\brimraf\b|\bDeno\.remove(?:Sync)?\s*\(/
|
|
2751
|
+
],
|
|
2752
|
+
[
|
|
2753
|
+
"writes-outside",
|
|
2754
|
+
new RegExp(
|
|
2755
|
+
String.raw`(?:\.(?:writeFile|writeFileSync|appendFile|appendFileSync|createWriteStream|copyFile|copyFileSync|cp|cpSync|rename|renameSync|truncate|truncateSync|symlink|symlinkSync|mkdir|mkdirSync)|\bDeno\.(?:writeTextFile|writeFile|rename|mkdir)(?:Sync)?|\bBun\.write)\s*\(\s*['"\x60]${OUTSIDE}`
|
|
2756
|
+
)
|
|
2757
|
+
],
|
|
2758
|
+
[
|
|
2759
|
+
"sends",
|
|
2760
|
+
/\bfetch\s*\(|(?:\brequire\s*\(\s*|\bfrom\s+|\bimport\s+)['"\x60](?:node:)?(?:http|https|http2|net|dgram|tls|axios|node-fetch|ws|request|got|undici|nodemailer)['"\x60]|\bnew\s+WebSocket\b|\bXMLHttpRequest\b|\b(?:Deno|Bun)\.connect\w*\s*\(/
|
|
2761
|
+
],
|
|
2762
|
+
["listens", /\bcreateServer\s*\(|\b(?:Deno\.(?:listen\w*|serve)|Bun\.(?:listen|serve))\s*\(/],
|
|
2763
|
+
[
|
|
2764
|
+
"runs-commands",
|
|
2765
|
+
/\bchild_process\b|\bprocess\.(?:binding|dlopen|kill)\s*\(|\bDeno\.(?:run|Command)\b|\bBun\.(?:spawn|spawnSync|\$)\b|\bexecSync\s*\(|\bspawnSync\s*\(/
|
|
2766
|
+
],
|
|
2767
|
+
[
|
|
2768
|
+
"builds-code",
|
|
2769
|
+
/(?<![\w.])eval\s*\(|\bnew\s+Function\s*\(|(?<![\w.])Function\s*\(|(?:\brequire\s*\(\s*|\bfrom\s+)['"\x60](?:node:)?vm['"\x60]|\bvm\.\w+|\brequire\s*\(\s*[^'"\x60\s)]|\bimport\s*\(\s*[^'"\x60\s)]/
|
|
2770
|
+
],
|
|
2771
|
+
[
|
|
2772
|
+
"permissions",
|
|
2773
|
+
/\.(?:chmod|chmodSync|chown|chownSync|lchown|lchownSync|fchmod|fchmodSync|fchown|fchownSync)\s*\(|\bprocess\.set(?:e)?[ug]id\s*\(|\bDeno\.(?:chmod|chown)(?:Sync)?\s*\(/
|
|
2774
|
+
]
|
|
2775
|
+
];
|
|
2776
|
+
var PERL = [
|
|
2777
|
+
["deletes", /\b(?:unlink|rmdir|rmtree|remove_tree)\b/],
|
|
2778
|
+
[
|
|
2779
|
+
"writes-outside",
|
|
2780
|
+
new RegExp(
|
|
2781
|
+
String.raw`['"]\s*(?:\+?>>?|\+<)\s*['"]?\s*,?\s*['"]?${OUTSIDE}|\b(?:rename|symlink|link|copy|move)\s*\(?[^;\n]*['"]${OUTSIDE}`
|
|
2782
|
+
)
|
|
2783
|
+
],
|
|
2784
|
+
[
|
|
2785
|
+
"sends",
|
|
2786
|
+
/\b(?:IO::Socket|Socket|LWP|HTTP::Tiny|Net::\w+|Mojo::UserAgent|WWW::Mechanize|IO::Socket::INET)\b/
|
|
2787
|
+
],
|
|
2788
|
+
[
|
|
2789
|
+
"runs-commands",
|
|
2790
|
+
/\b(?:system|exec|fork|kill|syscall)\b|`[^`]*`|\bqx\s*[{([/|!'"]|\bopen\s*\(?[^;\n]*(?:['"]\s*\||\|\s*['"]|['"]-\|['"])/
|
|
2791
|
+
],
|
|
2792
|
+
["builds-code", /\beval\b|\bStorable::thaw\b|\bdo\s+['"]/],
|
|
2793
|
+
["permissions", /\b(?:chmod|chown)\b/]
|
|
2794
|
+
];
|
|
2795
|
+
var RUBY = [
|
|
2796
|
+
[
|
|
2797
|
+
"deletes",
|
|
2798
|
+
/\bFile\.(?:delete|unlink)\b|\bFileUtils\.(?:rm\w*|remove\w*)\b|\bDir\.(?:rmdir|delete|unlink)\b|\.(?:rmtree|delete_all)\b/
|
|
2799
|
+
],
|
|
2800
|
+
[
|
|
2801
|
+
"writes-outside",
|
|
2802
|
+
new RegExp(
|
|
2803
|
+
String.raw`\bFile\.(?:write|binwrite|symlink|rename)\s*\(?\s*['"]${OUTSIDE}|\bFile\.open\s*\(?\s*['"]${OUTSIDE}[^'"\n]*['"]\s*,\s*['"][wa+]|\bFileUtils\.(?:cp\w*|mv|install|ln\w*|mkdir_p|touch)\s*\(?[^\n]*['"]${OUTSIDE}`
|
|
2804
|
+
)
|
|
2805
|
+
],
|
|
2806
|
+
[
|
|
2807
|
+
"sends",
|
|
2808
|
+
/\bNet::\w+|\b(?:TCPSocket|UDPSocket|UNIXSocket|Socket)\b|\bopen-uri\b|\bURI\.open\b|\b(?:HTTParty|Faraday|RestClient|Excon|Typhoeus)\b|\brequire\s+['"](?:socket|net\/\w+|open-uri)['"]/
|
|
2809
|
+
],
|
|
2810
|
+
["listens", /\b(?:TCPServer|UNIXServer|WEBrick|PTY)\b/],
|
|
2811
|
+
[
|
|
2812
|
+
"runs-commands",
|
|
2813
|
+
/(?<![\w.])(?:system|exec|spawn|fork)\b|`[^`]*`|%x[{([|!]|(?<![\w.])open\s*\(?\s*['"]\||\bIO\.popen\b|\bOpen3\b|\bProcess\.(?:spawn|kill|exec)\b|\bKernel\.(?:system|exec|spawn|open)\b/
|
|
2814
|
+
],
|
|
2815
|
+
[
|
|
2816
|
+
"builds-code",
|
|
2817
|
+
/(?<![\w.])eval\b|\b(?:instance|class|module)_eval\b|\b(?:send|public_send)\s*\(?\s*:?['"]?(?:system|eval|exec|spawn)\b|\bMarshal\.load\b|\bYAML\.(?:unsafe_)?load\b|\bconst_get\b/
|
|
2818
|
+
],
|
|
2819
|
+
["permissions", /\b(?:File|FileUtils)\.(?:chmod|chown|lchmod|lchown)\w*\b/]
|
|
2820
|
+
];
|
|
2821
|
+
var PHP = [
|
|
2822
|
+
["deletes", /\b(?:unlink|rmdir)\s*\(/],
|
|
2823
|
+
[
|
|
2824
|
+
"writes-outside",
|
|
2825
|
+
new RegExp(
|
|
2826
|
+
String.raw`\b(?:file_put_contents|symlink|link|copy|rename|mkdir|touch)\s*\([^)\n]*['"]${OUTSIDE}|\bfopen\s*\(\s*['"]${OUTSIDE}[^'"\n]*['"]\s*,\s*['"][waxc+]`
|
|
2827
|
+
)
|
|
2828
|
+
],
|
|
2829
|
+
[
|
|
2830
|
+
"sends",
|
|
2831
|
+
/\b(?:curl_exec|curl_init|fsockopen|pfsockopen|stream_socket_client|socket_create|socket_connect|mail|ftp_connect)\s*\(|\b(?:file_get_contents|fopen|file|readfile)\s*\(\s*['"](?:https?|ftp):/
|
|
2832
|
+
],
|
|
2833
|
+
["listens", /\b(?:stream_socket_server|socket_bind|socket_listen)\s*\(/],
|
|
2834
|
+
[
|
|
2835
|
+
"runs-commands",
|
|
2836
|
+
/\b(?:system|exec|shell_exec|passthru|proc_open|popen|pcntl_exec|pcntl_fork|posix_kill)\s*\(|`[^`]*`/
|
|
2837
|
+
],
|
|
2838
|
+
[
|
|
2839
|
+
"builds-code",
|
|
2840
|
+
/\b(?:eval|assert|create_function|unserialize|call_user_func(?:_array)?)\s*\(|\bbase64_decode\b/
|
|
2841
|
+
],
|
|
2842
|
+
["permissions", /\b(?:chmod|chown|chgrp|lchown|lchgrp)\s*\(/]
|
|
2843
|
+
];
|
|
2074
2844
|
var { syntax } = mvdanSh;
|
|
2075
2845
|
var sharedParser = syntax.NewParser();
|
|
2076
2846
|
var AST_CACHE_MAX = 5e3;
|
|
@@ -2646,18 +3416,6 @@ var DEFAULT_OPS = new Set(
|
|
|
2646
3416
|
(s) => parseShared(`echo ${s}`).Stmts[0].Cmd.Args[1].Parts[0].Exp.Op
|
|
2647
3417
|
)
|
|
2648
3418
|
);
|
|
2649
|
-
var SYSTEM_DIRS = [
|
|
2650
|
-
"/usr",
|
|
2651
|
-
"/etc",
|
|
2652
|
-
"/boot",
|
|
2653
|
-
"/bin",
|
|
2654
|
-
"/sbin",
|
|
2655
|
-
"/lib",
|
|
2656
|
-
"/lib64",
|
|
2657
|
-
"/var/log"
|
|
2658
|
-
];
|
|
2659
|
-
var UPLOAD_SYSTEM_DIRS = [...SYSTEM_DIRS, "/proc", "/sys", "/root"];
|
|
2660
|
-
var LEGACY_SYSTEM_PATH_RE = /^(?:[a-zA-Z]:)?\/etc\/(?:passwd|shadow|sudoers)$/;
|
|
2661
3419
|
var BIP39_ENGLISH = `abandon
|
|
2662
3420
|
ability
|
|
2663
3421
|
able
|
|
@@ -5718,14 +6476,14 @@ var SENSITIVE_PATH_REGEXES = [
|
|
|
5718
6476
|
];
|
|
5719
6477
|
function assertBuiltinPatternsAreSafe() {
|
|
5720
6478
|
for (const p of DLP_PATTERNS) {
|
|
5721
|
-
if (!
|
|
6479
|
+
if (!safeRegex2(p.regex.source)) {
|
|
5722
6480
|
throw new Error(
|
|
5723
6481
|
`[node9 engine] Builtin DLP pattern '${p.name}' is vulnerable to ReDoS: ${p.regex.source}`
|
|
5724
6482
|
);
|
|
5725
6483
|
}
|
|
5726
6484
|
}
|
|
5727
6485
|
for (const re of SENSITIVE_PATH_PATTERNS) {
|
|
5728
|
-
if (!
|
|
6486
|
+
if (!safeRegex2(re.source)) {
|
|
5729
6487
|
throw new Error(
|
|
5730
6488
|
`[node9 engine] Builtin sensitive-path pattern is vulnerable to ReDoS: ${re.source}`
|
|
5731
6489
|
);
|
|
@@ -5835,7 +6593,11 @@ var MAP_GOVERNED = /* @__PURE__ */ new Set([
|
|
|
5835
6593
|
"commands.disk-destroy",
|
|
5836
6594
|
"commands.dangerous-word",
|
|
5837
6595
|
"commands.node9-disarm",
|
|
5838
|
-
"data.pipe-chain"
|
|
6596
|
+
"data.pipe-chain",
|
|
6597
|
+
// The general action checks (node9Firewall#390): smart rules the map governs.
|
|
6598
|
+
"actions.money",
|
|
6599
|
+
"actions.access",
|
|
6600
|
+
"actions.publish"
|
|
5839
6601
|
]);
|
|
5840
6602
|
var KNOB_GOVERNED = {
|
|
5841
6603
|
"data.secrets": ["off", "block"],
|
|
@@ -5876,6 +6638,21 @@ var PUBLISH = {
|
|
|
5876
6638
|
var OWN_HEADS = /* @__PURE__ */ new Set([...Object.keys(PUBLISH), "git", "gh"]);
|
|
5877
6639
|
var LONG_OUTPUT_THRESHOLD_BYTES = 100 * 1024;
|
|
5878
6640
|
|
|
6641
|
+
// src/shields/build.ts
|
|
6642
|
+
var LEGACY_BASH_PATH_RULE = /^(?:block|review)-path-.+-bash$/;
|
|
6643
|
+
function withAccessReading(def) {
|
|
6644
|
+
let changed = false;
|
|
6645
|
+
const smartRules = def.smartRules.map((r) => {
|
|
6646
|
+
const [c, ...rest] = r.conditions ?? [];
|
|
6647
|
+
if (rest.length > 0 || !c || r.tool !== "bash" || !LEGACY_BASH_PATH_RULE.test(r.name ?? "") || c.field !== "command" || c.op !== "matches" || c.reading !== void 0) {
|
|
6648
|
+
return r;
|
|
6649
|
+
}
|
|
6650
|
+
changed = true;
|
|
6651
|
+
return { ...r, conditions: [{ ...c, reading: "access" }] };
|
|
6652
|
+
});
|
|
6653
|
+
return changed ? { ...def, smartRules } : def;
|
|
6654
|
+
}
|
|
6655
|
+
|
|
5879
6656
|
// src/shields.ts
|
|
5880
6657
|
var USER_SHIELDS_DIR = path.join(os.homedir(), ".node9", "shields");
|
|
5881
6658
|
function loadUserShields() {
|
|
@@ -5902,7 +6679,7 @@ function loadUserShields() {
|
|
|
5902
6679
|
`);
|
|
5903
6680
|
continue;
|
|
5904
6681
|
}
|
|
5905
|
-
result[v.ok.name] = v.ok;
|
|
6682
|
+
result[v.ok.name] = withAccessReading(v.ok);
|
|
5906
6683
|
} catch (err) {
|
|
5907
6684
|
process.stderr.write(`[node9] Failed to load user shield ${file}: ${String(err)}
|
|
5908
6685
|
`);
|
|
@@ -5921,6 +6698,268 @@ var TUNING_FIELDS_BY_NAME = new Map(TUNING_FIELDS.map((f) => [`${f.checkId}.${f.
|
|
|
5921
6698
|
|
|
5922
6699
|
// src/config/index.ts
|
|
5923
6700
|
var DANGEROUS_WORDS = [...BUILTIN_DANGEROUS_WORDS];
|
|
6701
|
+
var DEFAULT_CONFIG = {
|
|
6702
|
+
version: "1.0",
|
|
6703
|
+
policySource: "local",
|
|
6704
|
+
ssrfStrictSource: "default",
|
|
6705
|
+
settings: {
|
|
6706
|
+
mode: "standard",
|
|
6707
|
+
autoStartDaemon: true,
|
|
6708
|
+
// Off by default: this is a DEBUG facility, not part of the product's job.
|
|
6709
|
+
// When on, every tool call appends a row to ~/.node9/hook-debug.log, which
|
|
6710
|
+
// has no production reader and no size ceiling. Turn it on deliberately
|
|
6711
|
+
// (this setting, or NODE9_DEBUG=1) while investigating something.
|
|
6712
|
+
// Error breadcrumbs written from catch blocks are NOT gated by this and
|
|
6713
|
+
// keep working when it is off — see CLAUDE.md "Always write to
|
|
6714
|
+
// hook-debug.log in catch blocks that guard audit trail".
|
|
6715
|
+
enableHookLogDebug: false,
|
|
6716
|
+
approvalTimeoutMs: 12e4,
|
|
6717
|
+
// 120-second auto-deny timeout
|
|
6718
|
+
flightRecorder: true,
|
|
6719
|
+
auditHashArgs: true,
|
|
6720
|
+
approvers: { native: true, browser: false, cloud: false, terminal: true },
|
|
6721
|
+
cloudSyncIntervalHours: 5,
|
|
6722
|
+
shipper: { enabled: true, intervalSeconds: 20 }
|
|
6723
|
+
},
|
|
6724
|
+
policy: {
|
|
6725
|
+
sandboxPaths: ["/tmp/**", "**/sandbox/**", "**/test-results/**"],
|
|
6726
|
+
dangerousWords: DANGEROUS_WORDS,
|
|
6727
|
+
ignoredTools: [
|
|
6728
|
+
"list_*",
|
|
6729
|
+
"get_*",
|
|
6730
|
+
"read_*",
|
|
6731
|
+
"describe_*",
|
|
6732
|
+
"read",
|
|
6733
|
+
"glob",
|
|
6734
|
+
"grep",
|
|
6735
|
+
"ls",
|
|
6736
|
+
"notebookread",
|
|
6737
|
+
"notebookedit",
|
|
6738
|
+
"webfetch",
|
|
6739
|
+
"websearch",
|
|
6740
|
+
"exitplanmode",
|
|
6741
|
+
"askuserquestion",
|
|
6742
|
+
"agent",
|
|
6743
|
+
"task*",
|
|
6744
|
+
"toolsearch",
|
|
6745
|
+
"mcp__ide__*",
|
|
6746
|
+
"getDiagnostics"
|
|
6747
|
+
],
|
|
6748
|
+
toolInspection: {
|
|
6749
|
+
bash: "command",
|
|
6750
|
+
shell: "command",
|
|
6751
|
+
run_shell_command: "command",
|
|
6752
|
+
"terminal.execute": "command",
|
|
6753
|
+
"postgres:query": "sql"
|
|
6754
|
+
},
|
|
6755
|
+
smartRules: [
|
|
6756
|
+
// ── rm safety (critical — always evaluated first) ──────────────────────
|
|
6757
|
+
{
|
|
6758
|
+
name: "block-rm-rf-home",
|
|
6759
|
+
tool: "bash",
|
|
6760
|
+
conditionMode: "all",
|
|
6761
|
+
conditions: [
|
|
6762
|
+
{
|
|
6763
|
+
field: "command",
|
|
6764
|
+
op: "matches",
|
|
6765
|
+
// Anchor rm as a shell command (not inside a string arg like a git commit message).
|
|
6766
|
+
value: "(^|&&|\\|\\||;)\\s*rm\\b[^;&|]*\\s(-[rRfF]*[rR][rRfF]*|--recursive)(\\s|$)"
|
|
6767
|
+
},
|
|
6768
|
+
{
|
|
6769
|
+
field: "command",
|
|
6770
|
+
op: "matches",
|
|
6771
|
+
value: "(~|\\/root(\\/|$)|\\$HOME|\\/home\\/)"
|
|
6772
|
+
}
|
|
6773
|
+
],
|
|
6774
|
+
verdict: "block",
|
|
6775
|
+
reason: "Recursive delete of home directory is irreversible",
|
|
6776
|
+
description: "The AI wants to recursively delete your home directory. This will permanently destroy all your personal files and cannot be undone."
|
|
6777
|
+
},
|
|
6778
|
+
// ── SQL safety ────────────────────────────────────────────────────────
|
|
6779
|
+
{
|
|
6780
|
+
name: "no-delete-without-where",
|
|
6781
|
+
tool: "*",
|
|
6782
|
+
conditions: [
|
|
6783
|
+
{ field: "sql", op: "matches", value: "^(DELETE|UPDATE)\\s", flags: "i" },
|
|
6784
|
+
{ field: "sql", op: "notMatches", value: "\\bWHERE\\b", flags: "i" }
|
|
6785
|
+
],
|
|
6786
|
+
conditionMode: "all",
|
|
6787
|
+
verdict: "review",
|
|
6788
|
+
reason: "DELETE/UPDATE without WHERE clause \u2014 would affect every row in the table",
|
|
6789
|
+
description: "The AI is running a SQL statement that will modify every row in the table \u2014 no WHERE filter was found. This could wipe or corrupt all your data."
|
|
6790
|
+
},
|
|
6791
|
+
{
|
|
6792
|
+
name: "review-drop-truncate-shell",
|
|
6793
|
+
tool: "bash",
|
|
6794
|
+
conditions: [
|
|
6795
|
+
{
|
|
6796
|
+
field: "command",
|
|
6797
|
+
op: "matches",
|
|
6798
|
+
// Require a DB CLI in the command so grep/cat/echo of SQL strings don't trigger.
|
|
6799
|
+
value: "(^|&&|\\|\\||;|\\|)\\s*(psql|mysql|sqlite3|sqlplus|cockroach|clickhouse-client|mongo)\\b",
|
|
6800
|
+
flags: "i"
|
|
6801
|
+
},
|
|
6802
|
+
{
|
|
6803
|
+
field: "command",
|
|
6804
|
+
op: "matches",
|
|
6805
|
+
value: "\\b(DROP|TRUNCATE)\\s+(TABLE|DATABASE|SCHEMA|INDEX)",
|
|
6806
|
+
flags: "i"
|
|
6807
|
+
}
|
|
6808
|
+
],
|
|
6809
|
+
conditionMode: "all",
|
|
6810
|
+
verdict: "review",
|
|
6811
|
+
reason: "SQL DDL destructive statement inside a shell command",
|
|
6812
|
+
description: "The AI wants to drop or truncate a database table via the shell. This permanently deletes the table structure or all its data."
|
|
6813
|
+
},
|
|
6814
|
+
// ── node9 itself ──────────────────────────────────────────────────────
|
|
6815
|
+
// The agent runs as the user, so a `node9 ...` command from Bash can
|
|
6816
|
+
// clear the session's taint or exposure, trust a destination or pause
|
|
6817
|
+
// the gate. Those are the user's own commands; from the agent they are
|
|
6818
|
+
// a review (fw#318 review finding 1).
|
|
6819
|
+
{
|
|
6820
|
+
name: "review-node9-disarm",
|
|
6821
|
+
tool: "bash",
|
|
6822
|
+
conditions: [
|
|
6823
|
+
{
|
|
6824
|
+
field: "command",
|
|
6825
|
+
op: "matches",
|
|
6826
|
+
// Single spaces on purpose: a nested `\\s+` inside the alternation
|
|
6827
|
+
// fails the engine's ReDoS check and the rule would be dropped.
|
|
6828
|
+
// `apps`: turning an app off, allowing one of its actions, or
|
|
6829
|
+
// linking a server to an app (the general checks leave it).
|
|
6830
|
+
value: "(^|&&|\\|\\||;)\\s*(npx )?node9 (session-(exposure|taint) clear|trust (add|recipient add)|pause|shield (disable|set)|apps (link|[a-z0-9-]{1,32} (off|[a-z]{1,32} allow))|egress allow|approver set)\\b",
|
|
6831
|
+
flags: "i"
|
|
6832
|
+
}
|
|
6833
|
+
],
|
|
6834
|
+
conditionMode: "all",
|
|
6835
|
+
verdict: "review",
|
|
6836
|
+
reason: "node9 self-weakening command run by the agent",
|
|
6837
|
+
description: "The AI wants to run a node9 command that clears a session flag, trusts a destination, pauses the gate or weakens a shield. These are your commands to run, not the agent's."
|
|
6838
|
+
},
|
|
6839
|
+
// ── Git safety ────────────────────────────────────────────────────────
|
|
6840
|
+
{
|
|
6841
|
+
name: "review-force-push",
|
|
6842
|
+
tool: "bash",
|
|
6843
|
+
conditions: [
|
|
6844
|
+
{
|
|
6845
|
+
field: "command",
|
|
6846
|
+
op: "matches",
|
|
6847
|
+
// Anchor git as a shell command so node -e / python -c scripts containing
|
|
6848
|
+
// "git push --force" as a string don't false-positive.
|
|
6849
|
+
value: "(^|&&|\\|\\||;)\\s*git\\s+push[^;&|]*(--force|--force-with-lease|-f\\b)",
|
|
6850
|
+
flags: "i"
|
|
6851
|
+
}
|
|
6852
|
+
],
|
|
6853
|
+
conditionMode: "all",
|
|
6854
|
+
verdict: "review",
|
|
6855
|
+
reason: "Force push rewrites remote history \u2014 confirm this is intentional",
|
|
6856
|
+
description: "The AI wants to force push to a remote git branch. This rewrites shared history and can permanently destroy commits that teammates have already pulled."
|
|
6857
|
+
},
|
|
6858
|
+
{
|
|
6859
|
+
name: "review-git-destructive",
|
|
6860
|
+
tool: "bash",
|
|
6861
|
+
conditions: [
|
|
6862
|
+
{
|
|
6863
|
+
field: "command",
|
|
6864
|
+
op: "matches",
|
|
6865
|
+
// Anchor git as a shell command so node -e / python -c scripts containing
|
|
6866
|
+
// "git reset --hard" as a string don't false-positive.
|
|
6867
|
+
value: "(^|&&|\\|\\||;)\\s*git\\s+(reset\\s+--hard|clean\\s+-[fdxX]|rebase\\b|tag\\s+-d|branch\\s+-[dD])",
|
|
6868
|
+
flags: "i"
|
|
6869
|
+
},
|
|
6870
|
+
{
|
|
6871
|
+
field: "command",
|
|
6872
|
+
op: "notMatches",
|
|
6873
|
+
// Exclude recovery ops and routine branch-surgery (--onto) — these are not destructive.
|
|
6874
|
+
value: "\\bgit\\s+rebase\\s+--(abort|continue|skip|onto)\\b",
|
|
6875
|
+
flags: "i"
|
|
6876
|
+
}
|
|
6877
|
+
],
|
|
6878
|
+
conditionMode: "all",
|
|
6879
|
+
verdict: "review",
|
|
6880
|
+
reason: "Destructive git operation \u2014 discards history or working-tree changes",
|
|
6881
|
+
description: "The AI wants to run a destructive git operation (reset, rebase, clean, or branch delete) that can permanently discard commits or uncommitted work."
|
|
6882
|
+
},
|
|
6883
|
+
// ── Shell safety ──────────────────────────────────────────────────────
|
|
6884
|
+
{
|
|
6885
|
+
name: "review-sudo",
|
|
6886
|
+
tool: "bash",
|
|
6887
|
+
conditions: [{ field: "command", op: "matches", value: "\\bsudo\\s", flags: "i" }],
|
|
6888
|
+
conditionMode: "all",
|
|
6889
|
+
verdict: "review",
|
|
6890
|
+
reason: "Command requires elevated privileges",
|
|
6891
|
+
description: "The AI wants to run a command as root (sudo). Commands with root access can modify system files, install software, or change security settings."
|
|
6892
|
+
},
|
|
6893
|
+
{
|
|
6894
|
+
name: "review-curl-pipe-shell",
|
|
6895
|
+
tool: "bash",
|
|
6896
|
+
conditions: [
|
|
6897
|
+
{
|
|
6898
|
+
field: "command",
|
|
6899
|
+
op: "matches",
|
|
6900
|
+
// Anchor curl/wget as a shell command so node -e scripts testing this
|
|
6901
|
+
// regex pattern don't self-match as a false positive.
|
|
6902
|
+
// Downloader and sink groups mirror the engine's DOWNLOAD_CMDS and
|
|
6903
|
+
// SHELL_INTERPRETERS; pipe-to-shell-vocabulary-drift.spec.ts fails if
|
|
6904
|
+
// either list gains a name this regex does not. The PowerShell sinks
|
|
6905
|
+
// carry \b so `iex` cannot match inside e.g. `iexplore`, and so does
|
|
6906
|
+
// `sh`, so a quoted body containing `| Shipment` is not a shell
|
|
6907
|
+
// (fw#372 X3, node9Firewall#332).
|
|
6908
|
+
value: "(^|&&|\\|\\||;)\\s*(curl|wget|iwr|irm|invoke-webrequest|invoke-restmethod)[^|]*\\|\\s*(?:(ba|z|da|fi|c|k)?sh\\b|(?:iex|invoke-expression|powershell|pwsh)\\b)",
|
|
6909
|
+
flags: "i"
|
|
6910
|
+
}
|
|
6911
|
+
],
|
|
6912
|
+
conditionMode: "all",
|
|
6913
|
+
verdict: "block",
|
|
6914
|
+
reason: "Piping remote script into a shell is a supply-chain attack vector",
|
|
6915
|
+
description: "The AI wants to download a script from the internet and run it immediately, without you seeing what it contains. This is one of the most common ways malware gets installed."
|
|
6916
|
+
},
|
|
6917
|
+
// ── Actions in apps (node9Firewall#390) ───────────────────────────────
|
|
6918
|
+
// actions.money / actions.access / actions.publish: the action templates
|
|
6919
|
+
// on every MCP server no app shield claims, plus the shell publishing
|
|
6920
|
+
// rules. Review by default; the check value governs them.
|
|
6921
|
+
...GENERAL_ACTION_RULES
|
|
6922
|
+
],
|
|
6923
|
+
dlp: { enabled: true, scanIgnoredTools: true, pii: "block" },
|
|
6924
|
+
egress: {
|
|
6925
|
+
enabled: false,
|
|
6926
|
+
mode: "review",
|
|
6927
|
+
allow: [],
|
|
6928
|
+
deny: [],
|
|
6929
|
+
allowPrivate: true,
|
|
6930
|
+
// The SSRF floor is always on and needs no default; these two only
|
|
6931
|
+
// widen or narrow it. See doc/roadmap/active/ssrf-floor-design.md.
|
|
6932
|
+
ssrfAllow: [],
|
|
6933
|
+
ssrfStrict: false
|
|
6934
|
+
},
|
|
6935
|
+
loopDetection: { enabled: true, threshold: 5, windowSeconds: 120 },
|
|
6936
|
+
injectionScan: { enabled: false, minConfidence: "medium", allow: [] },
|
|
6937
|
+
packageCheck: {
|
|
6938
|
+
enabled: true,
|
|
6939
|
+
onMalicious: "block",
|
|
6940
|
+
newPackage: "review",
|
|
6941
|
+
maxAgeHours: 48,
|
|
6942
|
+
installScript: "review",
|
|
6943
|
+
onlineFallback: true,
|
|
6944
|
+
allow: []
|
|
6945
|
+
},
|
|
6946
|
+
skillPinning: { enabled: false, mode: "warn", roots: [] },
|
|
6947
|
+
untrustedContent: {
|
|
6948
|
+
enabled: true,
|
|
6949
|
+
spotlight: true,
|
|
6950
|
+
afterExposure: "ask-once",
|
|
6951
|
+
orgDomains: [],
|
|
6952
|
+
roles: {},
|
|
6953
|
+
trustedRecipients: []
|
|
6954
|
+
},
|
|
6955
|
+
trustedHosts: [],
|
|
6956
|
+
trustedHostsManaged: false,
|
|
6957
|
+
appPermissions: {},
|
|
6958
|
+
appLinks: {},
|
|
6959
|
+
managedJailPaths: []
|
|
6960
|
+
},
|
|
6961
|
+
environments: {}
|
|
6962
|
+
};
|
|
5924
6963
|
var CACHE_LOG_REARM_MS = 5 * 60 * 1e3;
|
|
5925
6964
|
|
|
5926
6965
|
// src/cli/render/ink/panels/cost-note.ts
|
|
@@ -6307,7 +7346,7 @@ function ShieldsPanel({ summary, width, enabledShields = [] }) {
|
|
|
6307
7346
|
});
|
|
6308
7347
|
const hitShields = ranked.filter((i) => i.totalCatches > 0);
|
|
6309
7348
|
const hitNames = new Set(hitShields.map((i) => i.shieldName));
|
|
6310
|
-
const zeroHitAll = Object.keys(BUILTIN_SHIELDS).filter((name) => !hitNames.has(name) && !
|
|
7349
|
+
const zeroHitAll = Object.keys(BUILTIN_SHIELDS).filter((name) => !hitNames.has(name) && !APP_SHIELD_NAMES.has(name)).sort();
|
|
6311
7350
|
const zeroHitBuiltins = zeroHitAll.filter((name) => !enabled.has(name));
|
|
6312
7351
|
const zeroHitEnabled = zeroHitAll.filter((name) => enabled.has(name));
|
|
6313
7352
|
const topRec = hitShields.find(
|