fullshield 0.4.0 → 1.0.1

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.
@@ -1,164 +1,2 @@
1
- // src/compliance/index.ts
2
- var COMPLIANCE_DISCLAIMER = "This is not a certification or audit. FullShield produces an evidence-style mapping only; it does not certify PCI DSS, SOC 2, ISO, or any other standard.";
3
- var ROW = (ruleId, owasp, cwe, asvs, pci) => ({
4
- ruleId,
5
- owasp,
6
- cwe,
7
- asvs,
8
- pci
9
- });
10
- var RULE_MAP = [
11
- ROW("SAST-SQLI-001", "A03:2021 Injection", "CWE-89", "V5.3.4", "PCI DSS 6.2.4"),
12
- ROW("SAST-NOSQLI-001", "A03:2021 Injection", "CWE-943", "V5.3.4", "PCI DSS 6.2.4"),
13
- ROW("SAST-CMDI-001", "A03:2021 Injection", "CWE-78", "V5.3.3", "PCI DSS 6.2.4"),
14
- ROW("SAST-PATH-001", "A01:2021 Broken Access Control", "CWE-22", "V12.3.1", "PCI DSS 6.2.4"),
15
- ROW("SAST-EVAL-001", "A03:2021 Injection", "CWE-95", "V5.3.3", "PCI DSS 6.2.4"),
16
- ROW("SAST-SSRF-001", "A10:2021 SSRF", "CWE-918", "V12.6.1", "PCI DSS 6.2.4"),
17
- ROW("SAST-REDIRECT-001", "A01:2021 Broken Access Control", "CWE-601", "V5.1.1", "PCI DSS 6.4.2"),
18
- ROW("SAST-PROTO-001", "A03:2021 Injection", "CWE-1321", "V5.3.3", "PCI DSS 6.2.4"),
19
- ROW("SAST-XSS-001", "A03:2021 Injection", "CWE-79", "V5.3.3", "PCI DSS 6.2.4"),
20
- ROW("SAST-JWT-001", "A07:2021 Identification Failures", "CWE-347", "V3.5.3", "PCI DSS 6.5.10"),
21
- ROW("SAST-CRYPTO-001", "A02:2021 Cryptographic Failures", "CWE-338", "V6.2.1", "PCI DSS 3.6 / 4.2"),
22
- ROW("SAST-AUTH-001", "A07:2021 Identification Failures", "CWE-306", "V4.1.1", "PCI DSS 8.2"),
23
- ROW("SECRET-AWS-001", "A02:2021 Cryptographic Failures", "CWE-798", "V6.4.1", "PCI DSS 3.2 / 8.3"),
24
- ROW("SECRET-STRIPE-001", "A02:2021 Cryptographic Failures", "CWE-798", "V6.4.1", "PCI DSS 3.2"),
25
- ROW("SECRET-GITHUB-001", "A02:2021 Cryptographic Failures", "CWE-798", "V6.4.1", "PCI DSS 8.3"),
26
- ROW("SECRET-SLACK-001", "A02:2021 Cryptographic Failures", "CWE-798", "V6.4.1", "PCI DSS 8.3"),
27
- ROW("SECRET-GOOGLE-001", "A02:2021 Cryptographic Failures", "CWE-798", "V6.4.1", "PCI DSS 8.3"),
28
- ROW("SECRET-AIKEY-001", "A02:2021 Cryptographic Failures", "CWE-798", "V6.4.1", "PCI DSS 8.3"),
29
- ROW("SECRET-PRIVKEY-001", "A02:2021 Cryptographic Failures", "CWE-321", "V6.4.1", "PCI DSS 3.5 / 4.2"),
30
- ROW("SECRET-DBURL-001", "A02:2021 Cryptographic Failures", "CWE-798", "V6.4.1", "PCI DSS 3.2 / 8.3"),
31
- ROW("SECRET-JWT-001", "A02:2021 Cryptographic Failures", "CWE-798", "V6.4.1", "PCI DSS 3.5"),
32
- ROW("SECRET-SESSION-001", "A02:2021 Cryptographic Failures", "CWE-798", "V6.4.1", "PCI DSS 3.5 / 6.2.4"),
33
- ROW("CONFIG-DIRLIST-001", "A05:2021 Security Misconfiguration", "CWE-548", "V12.1.1", "PCI DSS 2.2 / 6.4.3"),
34
- ROW("SECRET-ENVFILE-001", "A02:2021 Cryptographic Failures", "CWE-312", "V8.3.4", "PCI DSS 3.2"),
35
- ROW("SECRET-ENTROPY-001", "A02:2021 Cryptographic Failures", "CWE-798", "V6.4.1", "PCI DSS 8.3"),
36
- ROW("DEPS-VULN-001", "A06:2021 Vulnerable Components", "CWE-1104", "V14.2.1", "PCI DSS 6.3.3"),
37
- ROW("DEPS-MALICIOUS-001", "A06:2021 Vulnerable Components", "CWE-506", "V14.2.1", "PCI DSS 6.3.3 / 12.10"),
38
- ROW("DEPS-TYPOSQUAT-001", "A06:2021 Vulnerable Components", "CWE-494", "V14.2.1", "PCI DSS 6.3.3"),
39
- ROW("DEPS-NOLOCK-001", "A06:2021 Vulnerable Components", "CWE-1104", "V14.2.1", "PCI DSS 6.3.3"),
40
- ROW("DEPS-DEPRECATED-001", "A06:2021 Vulnerable Components", "CWE-1104", "V14.2.1", "PCI DSS 6.3.3"),
41
- ROW("CONFIG-HELMET-001", "A05:2021 Security Misconfiguration", "CWE-693", "V14.4.3", "PCI DSS 6.4.3"),
42
- ROW("CONFIG-BODYLIMIT-001", "A05:2021 Security Misconfiguration", "CWE-400", "V13.1.1", "PCI DSS 6.2.4"),
43
- ROW("CONFIG-CORS-001", "A05:2021 Security Misconfiguration", "CWE-942", "V14.4.5", "PCI DSS 6.4.3"),
44
- ROW("CONFIG-RATELIMIT-001", "A07:2021 Identification Failures", "CWE-307", "V2.2.1", "PCI DSS 8.3.4"),
45
- ROW("CONFIG-ERRSTACK-001", "A04:2021 Insecure Design", "CWE-209", "V7.4.1", "PCI DSS 6.2.4"),
46
- ROW("CONFIG-INSTALLSCRIPT-001", "A06:2021 Vulnerable Components", "CWE-829", "V14.2.1", "PCI DSS 6.3.3"),
47
- ROW("CONFIG-DOCKER-LATEST-001", "A05:2021 Security Misconfiguration", "CWE-1188", "V14.1.3", "PCI DSS 2.2"),
48
- ROW("CONFIG-DOCKER-ROOT-001", "A05:2021 Security Misconfiguration", "CWE-250", "V14.1.3", "PCI DSS 2.2"),
49
- ROW("CONFIG-DOCKER-ENV-001", "A02:2021 Cryptographic Failures", "CWE-798", "V6.4.1", "PCI DSS 3.2"),
50
- ROW("EDGE-CDN-001", "A05:2021 Security Misconfiguration", "CWE-693", "V14.4.3", "PCI DSS 1.2 / 6.4"),
51
- ROW("EDGE-CSP-001", "A05:2021 Security Misconfiguration", "CWE-693", "V14.4.3", "PCI DSS 6.4.3"),
52
- ROW("EDGE-EXPOSE-001", "A05:2021 Security Misconfiguration", "CWE-538", "V14.4.3", "PCI DSS 2.2 / 6.4"),
53
- ROW("EDGE-HSTS-001", "A05:2021 Security Misconfiguration", "CWE-319", "V9.1.1", "PCI DSS 4.2"),
54
- ROW("EDGE-REFERRER-001", "A05:2021 Security Misconfiguration", "CWE-201", "V14.4.3", "PCI DSS 6.4.3"),
55
- ROW("EDGE-TLS-001", "A02:2021 Cryptographic Failures", "CWE-319", "V9.1.1", "PCI DSS 4.2"),
56
- ROW("EDGE-XCTO-001", "A05:2021 Security Misconfiguration", "CWE-693", "V14.4.3", "PCI DSS 6.4.3"),
57
- ROW("EDGE-XFO-001", "A05:2021 Security Misconfiguration", "CWE-1021", "V14.4.3", "PCI DSS 6.4.3"),
58
- ROW("RASP-SQL-001", "A03:2021 Injection", "CWE-89", "V5.3.4", "PCI DSS 6.4.2"),
59
- ROW("RASP-SHELL-001", "A03:2021 Injection", "CWE-78", "V5.3.3", "PCI DSS 6.4.2"),
60
- ROW("RASP-PATH-001", "A01:2021 Broken Access Control", "CWE-22", "V12.3.1", "PCI DSS 6.4.2"),
61
- ROW("RASP-NOSQL-001", "A03:2021 Injection", "CWE-943", "V5.3.4", "PCI DSS 6.4.2"),
62
- ROW("RASP-SSRF-001", "A10:2021 SSRF", "CWE-918", "V12.6.1", "PCI DSS 1.3"),
63
- ROW("RASP-PROTO-001", "A03:2021 Injection", "CWE-1321", "V5.3.3", "PCI DSS 6.4.2"),
64
- ROW("AI-INJECT-001", "A03:2021 Injection", "CWE-1427", "V5.3.3", "PCI DSS 6.2.4"),
65
- ROW("LLM-001", "A03:2021 Injection", "CWE-1426", "V5.3.3", "PCI DSS 6.2.4"),
66
- ROW("LLM-002", "A03:2021 Injection", "CWE-94", "V5.3.3", "PCI DSS 6.2.4"),
67
- ROW("LLM-003", "A01:2021 Broken Access Control", "CWE-250", "V4.1.1", "PCI DSS 7.2"),
68
- ROW("LLM-004", "A02:2021 Cryptographic Failures", "CWE-798", "V6.4.1", "PCI DSS 3.2"),
69
- ROW("LLM-005", "A04:2021 Insecure Design", "CWE-770", "V13.1.1", "PCI DSS 6.2.4"),
70
- ROW("SUPPLY-INSTALLSCRIPT-001", "A06:2021 Vulnerable Components", "CWE-829", "V14.2.1", "PCI DSS 6.3.3"),
71
- ROW("SUPPLY-NPMRC-NET-001", "A06:2021 Vulnerable Components", "CWE-506", "V14.2.1", "PCI DSS 12.10"),
72
- ROW("SUPPLY-OBFUSCATE-001", "A06:2021 Vulnerable Components", "CWE-506", "V14.2.1", "PCI DSS 6.3.3"),
73
- ROW("SUPPLY-BEHAVIOR-001", "A06:2021 Vulnerable Components", "CWE-829", "V14.2.1", "PCI DSS 6.3.3"),
74
- ROW("SUPPLY-COOLDOWN-001", "A06:2021 Vulnerable Components", "CWE-1104", "V14.2.1", "PCI DSS 6.3.3"),
75
- ROW("SUPPLY-LOCKURL-001", "A08:2021 Integrity Failures", "CWE-494", "V14.2.3", "PCI DSS 6.3.3"),
76
- ROW("SUPPLY-LOCKINTEGRITY-001", "A08:2021 Integrity Failures", "CWE-353", "V14.2.3", "PCI DSS 6.3.3"),
77
- ROW("SUPPLY-CONFUSION-001", "A08:2021 Integrity Failures", "CWE-494", "V14.2.3", "PCI DSS 6.3.3"),
78
- ROW("SUPPLY-PROVENANCE-001", "A08:2021 Integrity Failures", "CWE-494", "V14.2.3", "PCI DSS 6.3.3"),
79
- ROW("SUPPLY-WORM-001", "A06:2021 Vulnerable Components", "CWE-506", "V14.2.1", "PCI DSS 6.3.3 / 12.10"),
80
- ROW("SUPPLY-WORKFLOW-001", "A08:2021 Integrity Failures", "CWE-829", "V14.2.3", "PCI DSS 6.3.3"),
81
- ROW("SUPPLY-CHAINC2-001", "A06:2021 Vulnerable Components", "CWE-506", "V14.2.1", "PCI DSS 6.3.3"),
82
- ROW("SUPPLY-STEALER-001", "A06:2021 Vulnerable Components", "CWE-506", "V14.2.1", "PCI DSS 12.10"),
83
- ROW("SUPPLY-PLATFORMGATE-001", "A06:2021 Vulnerable Components", "CWE-829", "V14.2.1", "PCI DSS 6.3.3"),
84
- ROW("SUPPLY-SECHOLDER-001", "A06:2021 Vulnerable Components", "CWE-506", "V14.2.1", "PCI DSS 6.3.3"),
85
- ROW("IAC-GHA-UNPINNED-001", "A08:2021 Integrity Failures", "CWE-494", "V14.2.3", "PCI DSS 6.3.3"),
86
- ROW("IAC-GHA-PRTARGET-001", "A01:2021 Broken Access Control", "CWE-269", "V4.1.1", "PCI DSS 7.2"),
87
- ROW("IAC-GHA-PERMS-001", "A01:2021 Broken Access Control", "CWE-250", "V4.1.1", "PCI DSS 7.2"),
88
- ROW("IAC-GHA-SECRETLOG-001", "A09:2021 Security Logging Failures", "CWE-532", "V7.1.1", "PCI DSS 3.2 / 10.2"),
89
- ROW("IAC-GHA-INJECT-001", "A03:2021 Injection", "CWE-94", "V5.2.4", "PCI DSS 6.2.4"),
90
- ROW("IAC-GHA-PRCHECKOUT-001", "A01:2021 Broken Access Control", "CWE-829", "V4.1.1", "PCI DSS 6.2.4"),
91
- ROW("DEPS-LICENSE-001", "A06:2021 Vulnerable Components", "CWE-1104", "V14.2.1", "PCI DSS 6.3.3"),
92
- ROW("IAC-TF-S3PUBLIC-001", "A01:2021 Broken Access Control", "CWE-284", "V12.1.1", "PCI DSS 1.3 / 3.2"),
93
- ROW("IAC-TF-SGOPEN-001", "A05:2021 Security Misconfiguration", "CWE-284", "V1.4.1", "PCI DSS 1.2 / 1.3"),
94
- ROW("IAC-TF-UNENCRYPTED-001", "A02:2021 Cryptographic Failures", "CWE-311", "V6.2.1", "PCI DSS 3.4 / 4.2"),
95
- ROW("IAC-K8S-PRIV-001", "A05:2021 Security Misconfiguration", "CWE-250", "V14.1.3", "PCI DSS 2.2"),
96
- ROW("IAC-COMPOSE-PRIV-001", "A05:2021 Security Misconfiguration", "CWE-250", "V14.1.3", "PCI DSS 2.2"),
97
- ROW("RASP-EGRESS-001", "A10:2021 SSRF", "CWE-918", "V12.6.1", "PCI DSS 1.3"),
98
- ROW("RASP-HONEY-001", "A09:2021 Security Logging Failures", "CWE-778", "V7.1.1", "PCI DSS 10.2 / 11.5"),
99
- ROW("RASP-FAIL-OPEN-001", "A05:2021 Security Misconfiguration", "CWE-755", "V14.4.3", "PCI DSS 6.4.3"),
100
- ROW("RUNTIME-SQLI-001", "A03:2021 Injection", "CWE-89", "V5.3.4", "PCI DSS 6.4.2"),
101
- ROW("RUNTIME-XSS-001", "A03:2021 Injection", "CWE-79", "V5.3.3", "PCI DSS 6.4.2"),
102
- ROW("RUNTIME-PATH-001", "A01:2021 Broken Access Control", "CWE-22", "V12.3.1", "PCI DSS 6.4.2"),
103
- ROW("RUNTIME-RATELIMIT-001", "A07:2021 Identification Failures", "CWE-307", "V2.2.1", "PCI DSS 8.3.4"),
104
- ROW("RUNTIME-BODY-001", "A05:2021 Security Misconfiguration", "CWE-400", "V13.1.1", "PCI DSS 6.2.4"),
105
- ROW("RUNTIME-ANOMALY-001", "A04:2021 Insecure Design", "CWE-754", "V14.4.3", "PCI DSS 10.2"),
106
- ROW("AI-IDOR-001", "A01:2021 Broken Access Control", "CWE-639", "V4.1.1", "PCI DSS 7.2"),
107
- ROW("AI-MASSASSIGN-001", "A01:2021 Broken Access Control", "CWE-915", "V5.1.1", "PCI DSS 6.2.4"),
108
- ROW("SAST-REDOS-001", "A05:2021 Security Misconfiguration", "CWE-1333", "V5.1.5", "PCI DSS 6.2.4"),
109
- ROW("SAST-DESER-001", "A08:2021 Integrity Failures", "CWE-502", "V5.5.3", "PCI DSS 6.2.4"),
110
- ROW("SAST-XXE-001", "A05:2021 Security Misconfiguration", "CWE-611", "V5.5.2", "PCI DSS 6.2.4"),
111
- ROW("SAST-UPLOAD-001", "A04:2021 Insecure Design", "CWE-434", "V12.5.1", "PCI DSS 6.2.4"),
112
- ROW("SAST-COOKIE-001", "A05:2021 Security Misconfiguration", "CWE-614/1004", "V3.4.2", "PCI DSS 6.2.4"),
113
- ROW("SAST-CSRF-001", "A01:2021 Broken Access Control", "CWE-352", "V4.2.2", "PCI DSS 6.4.3"),
114
- ROW("SAST-MASSASSIGN-001", "A01:2021 Broken Access Control", "CWE-915", "V5.1.1", "PCI DSS 6.2.4"),
115
- ROW("SAST-TIMING-001", "A07:2021 Identification Failures", "CWE-208", "V2.10.3", "PCI DSS 8.3"),
116
- ROW("SAST-HASH-001", "A02:2021 Cryptographic Failures", "CWE-916", "V6.2.2", "PCI DSS 8.3.1"),
117
- ROW("SAST-GQL-001", "A04:2021 Insecure Design", "CWE-770/200", "V13.1.1", "PCI DSS 6.2.4"),
118
- ROW("SAST-SKIP-001", "A05:2021 Security Misconfiguration", "CWE-693", "V1.1.1", "PCI DSS 6.2.4"),
119
- ROW("CONFIG-TRUSTPROXY-001", "A07:2021 Identification Failures", "CWE-290", "V2.2.1", "PCI DSS 8.3.4"),
120
- ROW("SECRET-BUNDLE-001", "A02:2021 Cryptographic Failures", "CWE-798", "V6.4.1", "PCI DSS 3.2 / 8.3"),
121
- ROW("DLP-SECRET-001", "A02:2021 Cryptographic Failures", "CWE-200", "V8.3.4", "PCI DSS 3.2 / 8.3"),
122
- ROW("DLP-STACK-001", "A04:2021 Insecure Design", "CWE-209", "V7.4.1", "PCI DSS 6.2.4"),
123
- ROW("DLP-INTERNAL-001", "A01:2021 Broken Access Control", "CWE-200", "V8.3.4", "PCI DSS 1.3 / 2.2"),
124
- ROW("DLP-CARD-001", "A02:2021 Cryptographic Failures", "CWE-359", "V8.3.4", "PCI DSS 3.3 / 3.4"),
125
- ROW("DLP-PII-001", "A01:2021 Broken Access Control", "CWE-359", "V8.3.4", "PCI DSS 3.2 / 6.4.2"),
126
- ROW("MCP-001", "A02:2021 Cryptographic Failures", "CWE-798", "V6.4.1", "PCI DSS 3.2 / 8.3"),
127
- ROW("MCP-002", "A08:2021 Integrity Failures", "CWE-494", "V14.2.3", "PCI DSS 6.3.3"),
128
- ROW("MCP-003", "A01:2021 Broken Access Control", "CWE-250", "V4.1.1", "PCI DSS 7.2"),
129
- ROW("MCP-004", "A03:2021 Injection", "CWE-74", "V5.3.3", "PCI DSS 6.2.4"),
130
- ROW("MCP-005", "A02:2021 Cryptographic Failures", "CWE-319", "V9.1.1", "PCI DSS 4.2"),
131
- ROW("HOST-SSH-001", "A06:2021 Vulnerable Components", "CWE-364", "V14.2.1", "PCI DSS 6.3.3"),
132
- ROW("HOST-SSH-002", "A05:2021 Security Misconfiguration", "CWE-693", "V14.4.3", "PCI DSS 2.2"),
133
- ROW("HOST-SSH-003", "A07:2021 Identification Failures", "CWE-307", "V7.1.1", "PCI DSS 10.2 / 11.5")
134
- ];
135
- var byId = new Map(RULE_MAP.map((r) => [r.ruleId, r]));
136
- function mappingFor(ruleId) {
137
- return byId.get(ruleId);
138
- }
139
- function renderCompliance(findings, standard = "pci") {
140
- const rows = findings.map((f) => {
141
- const m = mappingFor(f.ruleId);
142
- return `${f.ruleId} ${f.severity ?? ""} ${f.file ?? ""} ${m?.pci ?? "unmapped"} ${m?.owasp ?? ""} ${m?.cwe ?? ""}`;
143
- });
144
- return [
145
- `FullShield compliance mapping (${standard})`,
146
- COMPLIANCE_DISCLAIMER,
147
- "",
148
- "ruleId severity file pci owasp cwe",
149
- ...rows,
150
- "",
151
- COMPLIANCE_DISCLAIMER
152
- ].join("\n");
153
- }
154
- function collectRuleIdsFromSources(texts) {
155
- const ids = /* @__PURE__ */ new Set();
156
- const re = /\b((?:SAST|SECRET|DEPS|CONFIG|EDGE|AI|LLM|SUPPLY|IAC|RASP|RUNTIME|DLP|MCP|HOST)(?:-[A-Z0-9]+)*-\d{3})\b/g;
157
- for (const text of texts) {
158
- let m;
159
- while ((m = re.exec(text)) !== null) ids.add(m[1] ?? "");
160
- }
161
- return [...ids].sort();
162
- }
163
-
164
- export { COMPLIANCE_DISCLAIMER, RULE_MAP, collectRuleIdsFromSources, mappingFor, renderCompliance };
1
+ var I="This is not a certification or audit. FullShield produces an evidence-style mapping only; it does not certify PCI DSS, SOC 2, ISO, or any other standard.",S=(C,i,r,e,n)=>({ruleId:C,owasp:i,cwe:r,asvs:e,pci:n}),E=[S("SAST-SQLI-001","A03:2021 Injection","CWE-89","V5.3.4","PCI DSS 6.2.4"),S("SAST-NOSQLI-001","A03:2021 Injection","CWE-943","V5.3.4","PCI DSS 6.2.4"),S("SAST-CMDI-001","A03:2021 Injection","CWE-78","V5.3.3","PCI DSS 6.2.4"),S("SAST-PATH-001","A01:2021 Broken Access Control","CWE-22","V12.3.1","PCI DSS 6.2.4"),S("SAST-EVAL-001","A03:2021 Injection","CWE-95","V5.3.3","PCI DSS 6.2.4"),S("SAST-SSRF-001","A10:2021 SSRF","CWE-918","V12.6.1","PCI DSS 6.2.4"),S("SAST-REDIRECT-001","A01:2021 Broken Access Control","CWE-601","V5.1.1","PCI DSS 6.4.2"),S("SAST-PROTO-001","A03:2021 Injection","CWE-1321","V5.3.3","PCI DSS 6.2.4"),S("SAST-XSS-001","A03:2021 Injection","CWE-79","V5.3.3","PCI DSS 6.2.4"),S("SAST-JWT-001","A07:2021 Identification Failures","CWE-347","V3.5.3","PCI DSS 6.5.10"),S("SAST-CRYPTO-001","A02:2021 Cryptographic Failures","CWE-338","V6.2.1","PCI DSS 3.6 / 4.2"),S("SAST-AUTH-001","A07:2021 Identification Failures","CWE-306","V4.1.1","PCI DSS 8.2"),S("SECRET-AWS-001","A02:2021 Cryptographic Failures","CWE-798","V6.4.1","PCI DSS 3.2 / 8.3"),S("SECRET-STRIPE-001","A02:2021 Cryptographic Failures","CWE-798","V6.4.1","PCI DSS 3.2"),S("SECRET-GITHUB-001","A02:2021 Cryptographic Failures","CWE-798","V6.4.1","PCI DSS 8.3"),S("SECRET-SLACK-001","A02:2021 Cryptographic Failures","CWE-798","V6.4.1","PCI DSS 8.3"),S("SECRET-GOOGLE-001","A02:2021 Cryptographic Failures","CWE-798","V6.4.1","PCI DSS 8.3"),S("SECRET-AIKEY-001","A02:2021 Cryptographic Failures","CWE-798","V6.4.1","PCI DSS 8.3"),S("SECRET-PRIVKEY-001","A02:2021 Cryptographic Failures","CWE-321","V6.4.1","PCI DSS 3.5 / 4.2"),S("SECRET-DBURL-001","A02:2021 Cryptographic Failures","CWE-798","V6.4.1","PCI DSS 3.2 / 8.3"),S("SECRET-JWT-001","A02:2021 Cryptographic Failures","CWE-798","V6.4.1","PCI DSS 3.5"),S("SECRET-SESSION-001","A02:2021 Cryptographic Failures","CWE-798","V6.4.1","PCI DSS 3.5 / 6.2.4"),S("CONFIG-DIRLIST-001","A05:2021 Security Misconfiguration","CWE-548","V12.1.1","PCI DSS 2.2 / 6.4.3"),S("SECRET-ENVFILE-001","A02:2021 Cryptographic Failures","CWE-312","V8.3.4","PCI DSS 3.2"),S("SECRET-ENTROPY-001","A02:2021 Cryptographic Failures","CWE-798","V6.4.1","PCI DSS 8.3"),S("DEPS-VULN-001","A06:2021 Vulnerable Components","CWE-1104","V14.2.1","PCI DSS 6.3.3"),S("DEPS-MALICIOUS-001","A06:2021 Vulnerable Components","CWE-506","V14.2.1","PCI DSS 6.3.3 / 12.10"),S("DEPS-TYPOSQUAT-001","A06:2021 Vulnerable Components","CWE-494","V14.2.1","PCI DSS 6.3.3"),S("DEPS-NOLOCK-001","A06:2021 Vulnerable Components","CWE-1104","V14.2.1","PCI DSS 6.3.3"),S("DEPS-DEPRECATED-001","A06:2021 Vulnerable Components","CWE-1104","V14.2.1","PCI DSS 6.3.3"),S("CONFIG-HELMET-001","A05:2021 Security Misconfiguration","CWE-693","V14.4.3","PCI DSS 6.4.3"),S("CONFIG-BODYLIMIT-001","A05:2021 Security Misconfiguration","CWE-400","V13.1.1","PCI DSS 6.2.4"),S("CONFIG-CORS-001","A05:2021 Security Misconfiguration","CWE-942","V14.4.5","PCI DSS 6.4.3"),S("CONFIG-RATELIMIT-001","A07:2021 Identification Failures","CWE-307","V2.2.1","PCI DSS 8.3.4"),S("CONFIG-ERRSTACK-001","A04:2021 Insecure Design","CWE-209","V7.4.1","PCI DSS 6.2.4"),S("CONFIG-INSTALLSCRIPT-001","A06:2021 Vulnerable Components","CWE-829","V14.2.1","PCI DSS 6.3.3"),S("CONFIG-DOCKER-LATEST-001","A05:2021 Security Misconfiguration","CWE-1188","V14.1.3","PCI DSS 2.2"),S("CONFIG-DOCKER-ROOT-001","A05:2021 Security Misconfiguration","CWE-250","V14.1.3","PCI DSS 2.2"),S("CONFIG-DOCKER-ENV-001","A02:2021 Cryptographic Failures","CWE-798","V6.4.1","PCI DSS 3.2"),S("EDGE-CDN-001","A05:2021 Security Misconfiguration","CWE-693","V14.4.3","PCI DSS 1.2 / 6.4"),S("EDGE-CSP-001","A05:2021 Security Misconfiguration","CWE-693","V14.4.3","PCI DSS 6.4.3"),S("EDGE-EXPOSE-001","A05:2021 Security Misconfiguration","CWE-538","V14.4.3","PCI DSS 2.2 / 6.4"),S("EDGE-HSTS-001","A05:2021 Security Misconfiguration","CWE-319","V9.1.1","PCI DSS 4.2"),S("EDGE-REFERRER-001","A05:2021 Security Misconfiguration","CWE-201","V14.4.3","PCI DSS 6.4.3"),S("EDGE-TLS-001","A02:2021 Cryptographic Failures","CWE-319","V9.1.1","PCI DSS 4.2"),S("EDGE-XCTO-001","A05:2021 Security Misconfiguration","CWE-693","V14.4.3","PCI DSS 6.4.3"),S("EDGE-XFO-001","A05:2021 Security Misconfiguration","CWE-1021","V14.4.3","PCI DSS 6.4.3"),S("RASP-SQL-001","A03:2021 Injection","CWE-89","V5.3.4","PCI DSS 6.4.2"),S("RASP-SHELL-001","A03:2021 Injection","CWE-78","V5.3.3","PCI DSS 6.4.2"),S("RASP-PATH-001","A01:2021 Broken Access Control","CWE-22","V12.3.1","PCI DSS 6.4.2"),S("RASP-NOSQL-001","A03:2021 Injection","CWE-943","V5.3.4","PCI DSS 6.4.2"),S("RASP-SSRF-001","A10:2021 SSRF","CWE-918","V12.6.1","PCI DSS 1.3"),S("RASP-PROTO-001","A03:2021 Injection","CWE-1321","V5.3.3","PCI DSS 6.4.2"),S("AI-INJECT-001","A03:2021 Injection","CWE-1427","V5.3.3","PCI DSS 6.2.4"),S("LLM-001","A03:2021 Injection","CWE-1426","V5.3.3","PCI DSS 6.2.4"),S("LLM-002","A03:2021 Injection","CWE-94","V5.3.3","PCI DSS 6.2.4"),S("LLM-003","A01:2021 Broken Access Control","CWE-250","V4.1.1","PCI DSS 7.2"),S("LLM-004","A02:2021 Cryptographic Failures","CWE-798","V6.4.1","PCI DSS 3.2"),S("LLM-005","A04:2021 Insecure Design","CWE-770","V13.1.1","PCI DSS 6.2.4"),S("SUPPLY-INSTALLSCRIPT-001","A06:2021 Vulnerable Components","CWE-829","V14.2.1","PCI DSS 6.3.3"),S("SUPPLY-NPMRC-NET-001","A06:2021 Vulnerable Components","CWE-506","V14.2.1","PCI DSS 12.10"),S("SUPPLY-OBFUSCATE-001","A06:2021 Vulnerable Components","CWE-506","V14.2.1","PCI DSS 6.3.3"),S("SUPPLY-BEHAVIOR-001","A06:2021 Vulnerable Components","CWE-829","V14.2.1","PCI DSS 6.3.3"),S("SUPPLY-COOLDOWN-001","A06:2021 Vulnerable Components","CWE-1104","V14.2.1","PCI DSS 6.3.3"),S("SUPPLY-LOCKURL-001","A08:2021 Integrity Failures","CWE-494","V14.2.3","PCI DSS 6.3.3"),S("SUPPLY-LOCKINTEGRITY-001","A08:2021 Integrity Failures","CWE-353","V14.2.3","PCI DSS 6.3.3"),S("SUPPLY-CONFUSION-001","A08:2021 Integrity Failures","CWE-494","V14.2.3","PCI DSS 6.3.3"),S("SUPPLY-PROVENANCE-001","A08:2021 Integrity Failures","CWE-494","V14.2.3","PCI DSS 6.3.3"),S("SUPPLY-PROV-001","A08:2021 Integrity Failures","CWE-494","V14.2.3","PCI DSS 6.3.3"),S("SUPPLY-WORM-001","A06:2021 Vulnerable Components","CWE-506","V14.2.1","PCI DSS 6.3.3 / 12.10"),S("SUPPLY-WORKFLOW-001","A08:2021 Integrity Failures","CWE-829","V14.2.3","PCI DSS 6.3.3"),S("SUPPLY-CHAINC2-001","A06:2021 Vulnerable Components","CWE-506","V14.2.1","PCI DSS 6.3.3"),S("SUPPLY-STEALER-001","A06:2021 Vulnerable Components","CWE-506","V14.2.1","PCI DSS 12.10"),S("SUPPLY-PLATFORMGATE-001","A06:2021 Vulnerable Components","CWE-829","V14.2.1","PCI DSS 6.3.3"),S("SUPPLY-SECHOLDER-001","A06:2021 Vulnerable Components","CWE-506","V14.2.1","PCI DSS 6.3.3"),S("SUPPLY-CAP-001","A06:2021 Vulnerable Components","CWE-829","V14.2.1","PCI DSS 6.3.3"),S("IAC-GHA-UNPINNED-001","A08:2021 Integrity Failures","CWE-494","V14.2.3","PCI DSS 6.3.3"),S("IAC-GHA-PRTARGET-001","A01:2021 Broken Access Control","CWE-269","V4.1.1","PCI DSS 7.2"),S("IAC-GHA-PERMS-001","A01:2021 Broken Access Control","CWE-250","V4.1.1","PCI DSS 7.2"),S("IAC-GHA-SECRETLOG-001","A09:2021 Security Logging Failures","CWE-532","V7.1.1","PCI DSS 3.2 / 10.2"),S("IAC-GHA-INJECT-001","A03:2021 Injection","CWE-94","V5.2.4","PCI DSS 6.2.4"),S("IAC-GHA-PRCHECKOUT-001","A01:2021 Broken Access Control","CWE-829","V4.1.1","PCI DSS 6.2.4"),S("DEPS-LICENSE-001","A06:2021 Vulnerable Components","CWE-1104","V14.2.1","PCI DSS 6.3.3"),S("IAC-TF-S3PUBLIC-001","A01:2021 Broken Access Control","CWE-284","V12.1.1","PCI DSS 1.3 / 3.2"),S("IAC-TF-SGOPEN-001","A05:2021 Security Misconfiguration","CWE-284","V1.4.1","PCI DSS 1.2 / 1.3"),S("IAC-TF-UNENCRYPTED-001","A02:2021 Cryptographic Failures","CWE-311","V6.2.1","PCI DSS 3.4 / 4.2"),S("IAC-K8S-PRIV-001","A05:2021 Security Misconfiguration","CWE-250","V14.1.3","PCI DSS 2.2"),S("IAC-COMPOSE-PRIV-001","A05:2021 Security Misconfiguration","CWE-250","V14.1.3","PCI DSS 2.2"),S("RASP-EGRESS-001","A10:2021 SSRF","CWE-918","V12.6.1","PCI DSS 1.3"),S("RASP-HONEY-001","A09:2021 Security Logging Failures","CWE-778","V7.1.1","PCI DSS 10.2 / 11.5"),S("RASP-FAIL-OPEN-001","A05:2021 Security Misconfiguration","CWE-755","V14.4.3","PCI DSS 6.4.3"),S("RUNTIME-SQLI-001","A03:2021 Injection","CWE-89","V5.3.4","PCI DSS 6.4.2"),S("RUNTIME-XSS-001","A03:2021 Injection","CWE-79","V5.3.3","PCI DSS 6.4.2"),S("RUNTIME-PATH-001","A01:2021 Broken Access Control","CWE-22","V12.3.1","PCI DSS 6.4.2"),S("RUNTIME-RATELIMIT-001","A07:2021 Identification Failures","CWE-307","V2.2.1","PCI DSS 8.3.4"),S("RUNTIME-BODY-001","A05:2021 Security Misconfiguration","CWE-400","V13.1.1","PCI DSS 6.2.4"),S("RUNTIME-ANOMALY-001","A04:2021 Insecure Design","CWE-754","V14.4.3","PCI DSS 10.2"),S("AI-IDOR-001","A01:2021 Broken Access Control","CWE-639","V4.1.1","PCI DSS 7.2"),S("AI-MASSASSIGN-001","A01:2021 Broken Access Control","CWE-915","V5.1.1","PCI DSS 6.2.4"),S("SAST-REDOS-001","A05:2021 Security Misconfiguration","CWE-1333","V5.1.5","PCI DSS 6.2.4"),S("SAST-DESER-001","A08:2021 Integrity Failures","CWE-502","V5.5.3","PCI DSS 6.2.4"),S("SAST-XXE-001","A05:2021 Security Misconfiguration","CWE-611","V5.5.2","PCI DSS 6.2.4"),S("SAST-UPLOAD-001","A04:2021 Insecure Design","CWE-434","V12.5.1","PCI DSS 6.2.4"),S("SAST-COOKIE-001","A05:2021 Security Misconfiguration","CWE-614/1004","V3.4.2","PCI DSS 6.2.4"),S("SAST-CSRF-001","A01:2021 Broken Access Control","CWE-352","V4.2.2","PCI DSS 6.4.3"),S("SAST-MASSASSIGN-001","A01:2021 Broken Access Control","CWE-915","V5.1.1","PCI DSS 6.2.4"),S("SAST-TIMING-001","A07:2021 Identification Failures","CWE-208","V2.10.3","PCI DSS 8.3"),S("SAST-HASH-001","A02:2021 Cryptographic Failures","CWE-916","V6.2.2","PCI DSS 8.3.1"),S("SAST-GQL-001","A04:2021 Insecure Design","CWE-770/200","V13.1.1","PCI DSS 6.2.4"),S("SAST-SKIP-001","A05:2021 Security Misconfiguration","CWE-693","V1.1.1","PCI DSS 6.2.4"),S("CONFIG-TRUSTPROXY-001","A07:2021 Identification Failures","CWE-290","V2.2.1","PCI DSS 8.3.4"),S("SECRET-BUNDLE-001","A02:2021 Cryptographic Failures","CWE-798","V6.4.1","PCI DSS 3.2 / 8.3"),S("DLP-SECRET-001","A02:2021 Cryptographic Failures","CWE-200","V8.3.4","PCI DSS 3.2 / 8.3"),S("DLP-STACK-001","A04:2021 Insecure Design","CWE-209","V7.4.1","PCI DSS 6.2.4"),S("DLP-INTERNAL-001","A01:2021 Broken Access Control","CWE-200","V8.3.4","PCI DSS 1.3 / 2.2"),S("DLP-CARD-001","A02:2021 Cryptographic Failures","CWE-359","V8.3.4","PCI DSS 3.3 / 3.4"),S("DLP-PII-001","A01:2021 Broken Access Control","CWE-359","V8.3.4","PCI DSS 3.2 / 6.4.2"),S("MCP-001","A02:2021 Cryptographic Failures","CWE-798","V6.4.1","PCI DSS 3.2 / 8.3"),S("MCP-002","A08:2021 Integrity Failures","CWE-494","V14.2.3","PCI DSS 6.3.3"),S("MCP-003","A01:2021 Broken Access Control","CWE-250","V4.1.1","PCI DSS 7.2"),S("MCP-004","A03:2021 Injection","CWE-74","V5.3.3","PCI DSS 6.2.4"),S("MCP-005","A02:2021 Cryptographic Failures","CWE-319","V9.1.1","PCI DSS 4.2"),S("HOST-SSH-001","A06:2021 Vulnerable Components","CWE-364","V14.2.1","PCI DSS 6.3.3"),S("HOST-SSH-002","A05:2021 Security Misconfiguration","CWE-693","V14.4.3","PCI DSS 2.2"),S("HOST-SSH-003","A07:2021 Identification Failures","CWE-307","V7.1.1","PCI DSS 10.2 / 11.5"),S("DEPS-PHANTOM-001","A06:2021 Vulnerable Components","CWE-829","V14.2.1","PCI DSS 6.3.3"),S("DEPS-LOCKMISMATCH-001","A06:2021 Vulnerable Components","CWE-1104","V14.2.1","PCI DSS 6.3.3")],A=new Map(E.map(C=>[C.ruleId,C]));function P(C){return A.get(C)}function o(C,i="pci"){let r=C.map(e=>{let n=P(e.ruleId);return `${e.ruleId} ${e.severity??""} ${e.file??""} ${n?.pci??"unmapped"} ${n?.owasp??""} ${n?.cwe??""}`});return [`FullShield compliance mapping (${i})`,I,"","ruleId severity file pci owasp cwe",...r,"",I].join(`
2
+ `)}function t(C){let i=new Set,r=/\b((?:SAST|SECRET|DEPS|CONFIG|EDGE|AI|LLM|SUPPLY|IAC|RASP|RUNTIME|DLP|MCP|HOST)(?:-[A-Z0-9]+)*-\d{3})\b/g;for(let e of C){let n;for(;(n=r.exec(e))!==null;)i.add(n[1]??"");}return [...i].sort()}export{I as COMPLIANCE_DISCLAIMER,E as RULE_MAP,t as collectRuleIdsFromSources,P as mappingFor,o as renderCompliance};
package/dist/confirm.js CHANGED
@@ -1,146 +1,2 @@
1
- // src/confirm/index.ts
2
- var DESTRUCTIVE = /\b(drop|delete|update|insert|truncate|alter)\b|\brm\s|unlink|mkfs|\bdd\s|format\s|>\s*\/dev/i;
3
- var containers = /* @__PURE__ */ new Map();
4
- function registerConfirmContainer(entry) {
5
- containers.set(entry.id, entry);
6
- }
7
- function resetConfirmContainers() {
8
- containers.clear();
9
- }
10
- function hostnameOf(raw) {
11
- const href = raw.includes("://") ? raw : `http://${raw}`;
12
- const url = new URL(href);
13
- const m = href.match(/^https?:\/\/([^/?#]+)/i);
14
- let authority = m?.[1] ?? url.hostname;
15
- if (authority.includes("@")) authority = authority.slice(authority.lastIndexOf("@") + 1);
16
- let rawHost;
17
- if (authority.startsWith("[")) {
18
- const end = authority.indexOf("]");
19
- rawHost = end >= 0 ? authority.slice(0, end + 1) : authority;
20
- } else {
21
- rawHost = authority.split(":")[0] ?? url.hostname;
22
- }
23
- return { host: url.hostname, href: url.href, rawHost };
24
- }
25
- function isLiteralLocal(host) {
26
- return host === "localhost" || host === "127.0.0.1";
27
- }
28
- function isRegisteredContainer(host) {
29
- for (const c of containers.values()) {
30
- if (c.host === host || c.ip === host) return true;
31
- }
32
- return false;
33
- }
34
- function assertLocalTarget(raw, opts = {}) {
35
- let host;
36
- let rawHost;
37
- try {
38
- const parsed = hostnameOf(raw);
39
- host = parsed.host;
40
- rawHost = parsed.rawHost;
41
- } catch {
42
- throw new Error(`confirm: refused target ${raw}`);
43
- }
44
- if (isLiteralLocal(rawHost) && isLiteralLocal(host)) return;
45
- if (isRegisteredContainer(host) || isRegisteredContainer(rawHost)) return;
46
- if (opts.lookup) {
47
- const ips = opts.lookup(host);
48
- throw new Error(`confirm: refused target ${raw} (resolved ${ips.join(",")})`);
49
- }
50
- throw new Error(`confirm: refused target ${raw} (host ${host} is not localhost/127.0.0.1/FullShield container)`);
51
- }
52
- function buildCanary(kind, token) {
53
- if (DESTRUCTIVE.test(token)) {
54
- throw new Error("confirm: canary must be harmless (no DROP/DELETE/rm/dd)");
55
- }
56
- if (kind === "sql") return `1 UNION SELECT 0,'${token}'`;
57
- if (kind === "shell") return `; echo ${token}`;
58
- if (kind === "path") return "../canary.txt";
59
- return token;
60
- }
61
- function curlProof(method, url, extra = "") {
62
- return `curl -sS -X ${method} ${extra}${url}`.trim();
63
- }
64
- async function probe(fetchImpl, url, method, body, headers) {
65
- try {
66
- const res = await fetchImpl(url, {
67
- method,
68
- headers: {
69
- ...body !== void 0 ? { "content-type": "application/json" } : {},
70
- ...headers
71
- },
72
- body: body !== void 0 ? JSON.stringify(body) : void 0
73
- });
74
- const text = await res.text();
75
- return { ok: res.ok, text };
76
- } catch (err) {
77
- return { ok: false, text: err instanceof Error ? err.message : String(err) };
78
- }
79
- }
80
- async function confirmTarget(baseUrl, opts) {
81
- if (!opts.experimental && process.env.FULLSHIELD_EXPERIMENTAL_CONFIRM !== "1") {
82
- return { confirmations: [], skipped: true };
83
- }
84
- try {
85
- assertLocalTarget(baseUrl);
86
- } catch (err) {
87
- return {
88
- confirmations: [
89
- {
90
- kind: "sql",
91
- status: "unconfirmed",
92
- detail: err instanceof Error ? err.message : String(err)
93
- }
94
- ]
95
- };
96
- }
97
- const token = opts.canaryToken ?? `FULLSHIELD_CANARY_${Date.now().toString(16)}`;
98
- const fetchImpl = opts.fetchImpl ?? fetch;
99
- const origin = baseUrl.replace(/\/$/, "");
100
- const confirmations = [];
101
- for (const route of opts.routes) {
102
- try {
103
- if (route.kind === "idor") {
104
- const url2 = `${origin}${route.path}`;
105
- const hit2 = await probe(fetchImpl, url2, route.method, void 0, {
106
- "x-user": route.asUser ?? opts.users?.b ?? "bob"
107
- });
108
- const owner = route.expectOwner ?? opts.users?.a ?? "alice";
109
- const confirmed2 = hit2.ok && hit2.text.includes(owner);
110
- confirmations.push({
111
- kind: "idor",
112
- status: confirmed2 ? "confirmed" : "unconfirmed",
113
- proof: curlProof(route.method, url2, `-H 'x-user: ${route.asUser ?? "bob"}' `),
114
- detail: hit2.text.slice(0, 200)
115
- });
116
- continue;
117
- }
118
- const payload = buildCanary(route.kind, token);
119
- const param = route.param ?? "q";
120
- let url = `${origin}${route.path}`;
121
- let body;
122
- if (route.method === "GET") {
123
- url += `?${encodeURIComponent(param)}=${encodeURIComponent(payload)}`;
124
- } else {
125
- body = { [param]: payload };
126
- }
127
- const hit = await probe(fetchImpl, url, route.method, body);
128
- const confirmed = hit.text.includes(token) || route.kind === "path" && hit.text.includes("FULLSHIELD_CANARY");
129
- confirmations.push({
130
- kind: route.kind,
131
- status: confirmed ? "confirmed" : "unconfirmed",
132
- proof: curlProof(route.method, url),
133
- detail: hit.text.slice(0, 200)
134
- });
135
- } catch (err) {
136
- confirmations.push({
137
- kind: route.kind,
138
- status: "unconfirmed",
139
- detail: err instanceof Error ? err.message : String(err)
140
- });
141
- }
142
- }
143
- return { confirmations };
144
- }
145
-
146
- export { assertLocalTarget, buildCanary, confirmTarget, registerConfirmContainer, resetConfirmContainers };
1
+ var w=/\b(drop|delete|update|insert|truncate|alter)\b|\brm\s|unlink|mkfs|\bdd\s|format\s|>\s*\/dev/i,d=new Map;function O(t){d.set(t.id,t);}function S(){d.clear();}function L(t){let r=t.includes("://")?t:`http://${t}`,o=new URL(r),e=r.match(/^https?:\/\/([^/?#]+)/i)?.[1]??o.hostname;e.includes("@")&&(e=e.slice(e.lastIndexOf("@")+1));let i;if(e.startsWith("[")){let n=e.indexOf("]");i=n>=0?e.slice(0,n+1):e;}else i=e.split(":")[0]??o.hostname;return {host:o.hostname,href:o.href,rawHost:i}}function h(t){return t==="localhost"||t==="127.0.0.1"}function g(t){for(let r of d.values())if(r.host===t||r.ip===t)return true;return false}function b(t,r={}){let o,s;try{let e=L(t);o=e.host,s=e.rawHost;}catch{throw new Error(`confirm: refused target ${t}`)}if(!(h(s)&&h(o))&&!(g(o)||g(s))){if(r.lookup){let e=r.lookup(o);throw new Error(`confirm: refused target ${t} (resolved ${e.join(",")})`)}throw new Error(`confirm: refused target ${t} (host ${o} is not localhost/127.0.0.1/FullShield container)`)}}function y(t,r){if(w.test(r))throw new Error("confirm: canary must be harmless (no DROP/DELETE/rm/dd)");return t==="sql"?`1 UNION SELECT 0,'${r}'`:t==="shell"?`; echo ${r}`:t==="path"?"../canary.txt":r}function x(t,r,o=""){return `curl -sS -X ${t} ${o}${r}`.trim()}async function C(t,r,o,s,e){try{let i=await t(r,{method:o,headers:{...s!==void 0?{"content-type":"application/json"}:{},...e},body:s!==void 0?JSON.stringify(s):void 0}),n=await i.text();return {ok:i.ok,text:n}}catch(i){return {ok:false,text:i instanceof Error?i.message:String(i)}}}async function T(t,r){if(!r.experimental&&process.env.FULLSHIELD_EXPERIMENTAL_CONFIRM!=="1")return {confirmations:[],skipped:true};try{b(t);}catch(n){return {confirmations:[{kind:"sql",status:"unconfirmed",detail:n instanceof Error?n.message:String(n)}]}}let o=r.canaryToken??`FULLSHIELD_CANARY_${Date.now().toString(16)}`,s=r.fetchImpl??fetch,e=t.replace(/\/$/,""),i=[];for(let n of r.routes)try{if(n.kind==="idor"){let p=`${e}${n.path}`,u=await C(s,p,n.method,void 0,{"x-user":n.asUser??r.users?.b??"bob"}),E=n.expectOwner??r.users?.a??"alice",$=u.ok&&u.text.includes(E);i.push({kind:"idor",status:$?"confirmed":"unconfirmed",proof:x(n.method,p,`-H 'x-user: ${n.asUser??"bob"}' `),detail:u.text.slice(0,200)});continue}let a=y(n.kind,o),l=n.param??"q",c=`${e}${n.path}`,m;n.method==="GET"?c+=`?${encodeURIComponent(l)}=${encodeURIComponent(a)}`:m={[l]:a};let f=await C(s,c,n.method,m),k=f.text.includes(o)||n.kind==="path"&&f.text.includes("FULLSHIELD_CANARY");i.push({kind:n.kind,status:k?"confirmed":"unconfirmed",proof:x(n.method,c),detail:f.text.slice(0,200)});}catch(a){i.push({kind:n.kind,status:"unconfirmed",detail:a instanceof Error?a.message:String(a)});}return {confirmations:i}}
2
+ export{b as assertLocalTarget,y as buildCanary,T as confirmTarget,O as registerConfirmContainer,S as resetConfirmContainers};
package/dist/dashboard.js CHANGED
@@ -1,179 +1,2 @@
1
- import { mkdirSync, existsSync } from 'fs';
2
- import { createRequire } from 'module';
3
- import { createServer } from 'http';
4
- import { join } from 'path';
5
-
6
- // src/dashboard/index.ts
7
- var require2 = createRequire(import.meta.url);
8
- function nodeSqliteAvailable() {
9
- try {
10
- require2("node:sqlite");
11
- return true;
12
- } catch {
13
- return false;
14
- }
15
- }
16
- function nodeSqliteUnavailableMessage(feature) {
17
- return `${feature} requires Node 22.13+ (node:sqlite is not available on Node ${process.versions.node})`;
18
- }
19
-
20
- // src/dashboard/index.ts
21
- var require3 = createRequire(import.meta.url);
22
- function sqliteDb(file) {
23
- const { DatabaseSync } = require3("node:sqlite");
24
- let db;
25
- try {
26
- db = new DatabaseSync(file);
27
- db.exec(
28
- "CREATE TABLE IF NOT EXISTS scans (scannedAt TEXT NOT NULL, total INTEGER NOT NULL, highCrit INTEGER NOT NULL)"
29
- );
30
- db.exec(
31
- "CREATE TABLE IF NOT EXISTS provenance (scannedAt TEXT NOT NULL, percent REAL NOT NULL, withProvenance INTEGER NOT NULL, total INTEGER NOT NULL)"
32
- );
33
- } catch (error) {
34
- try {
35
- db?.close();
36
- } catch {
37
- }
38
- throw error;
39
- }
40
- let closed = false;
41
- const handle = db;
42
- return {
43
- list() {
44
- return handle.prepare("SELECT scannedAt, total, highCrit FROM scans ORDER BY scannedAt").all();
45
- },
46
- insert(row) {
47
- handle.prepare("INSERT INTO scans (scannedAt, total, highCrit) VALUES (?, ?, ?)").run(
48
- row.scannedAt,
49
- row.total,
50
- row.highCrit
51
- );
52
- },
53
- listProvenance() {
54
- return handle.prepare(
55
- "SELECT scannedAt, percent, withProvenance, total FROM provenance ORDER BY scannedAt"
56
- ).all();
57
- },
58
- insertProvenance(row) {
59
- handle.prepare(
60
- "INSERT INTO provenance (scannedAt, percent, withProvenance, total) VALUES (?, ?, ?, ?)"
61
- ).run(row.scannedAt, row.percent, row.withProvenance, row.total);
62
- },
63
- close() {
64
- if (closed) return;
65
- closed = true;
66
- try {
67
- handle.close();
68
- } catch {
69
- }
70
- }
71
- };
72
- }
73
- function openHistory(dir) {
74
- if (!nodeSqliteAvailable()) {
75
- throw new Error(nodeSqliteUnavailableMessage("history"));
76
- }
77
- const root = join(dir, ".fullshield");
78
- mkdirSync(root, { recursive: true });
79
- return sqliteDb(join(root, "history.db"));
80
- }
81
- function recordHistory(db, row) {
82
- db.insert(row);
83
- }
84
- function recordProvenance(db, row) {
85
- db.insertProvenance(row);
86
- }
87
- function listProvenance(db) {
88
- return db.listProvenance();
89
- }
90
- function assertDashboardHost(host) {
91
- if (host === void 0 || host.length === 0) return false;
92
- const h = host.split(":")[0]?.toLowerCase() ?? "";
93
- return h === "localhost" || h === "127.0.0.1";
94
- }
95
- function createDashboardHandler(opts) {
96
- if (!opts.experimental && process.env.FULLSHIELD_EXPERIMENTAL_PLATFORM !== "1") {
97
- throw new Error("dashboard requires FULLSHIELD_EXPERIMENTAL_PLATFORM=1");
98
- }
99
- const db = opts.db ?? openHistory(opts.dbPath);
100
- return (req, res) => {
101
- if (!assertDashboardHost(typeof req.headers.host === "string" ? req.headers.host : void 0)) {
102
- res.writeHead(400, { "content-type": "text/plain" });
103
- res.end("invalid host");
104
- return;
105
- }
106
- const url = new URL(req.url ?? "/", "http://127.0.0.1");
107
- if (url.pathname === "/api/ingest" && req.method !== "POST") {
108
- res.writeHead(405, { allow: "POST" });
109
- res.end("method not allowed");
110
- return;
111
- }
112
- if (req.method === "POST" && url.pathname === "/api/ingest") {
113
- const chunks = [];
114
- req.on("data", (c) => chunks.push(c));
115
- req.on("end", () => {
116
- try {
117
- const body = JSON.parse(Buffer.concat(chunks).toString("utf8"));
118
- db.insert(body);
119
- res.writeHead(204);
120
- res.end();
121
- } catch {
122
- res.writeHead(400);
123
- res.end("bad json");
124
- }
125
- });
126
- return;
127
- }
128
- if (req.method === "GET" && url.pathname === "/api/history") {
129
- res.writeHead(200, { "content-type": "application/json" });
130
- res.end(JSON.stringify({ scans: db.list() }));
131
- return;
132
- }
133
- if (req.method === "GET" && (url.pathname === "/" || url.pathname === "/index.html")) {
134
- const scans = db.list();
135
- const rows = scans.map((s) => `<tr><td>${s.scannedAt}</td><td>${s.total}</td><td>${s.highCrit}</td></tr>`).join("");
136
- res.writeHead(200, { "content-type": "text/html; charset=utf-8" });
137
- res.end(
138
- `<!DOCTYPE html><html><body><h1>FullShield history</h1><table><tr><th>at</th><th>total</th><th>high+crit</th></tr>${rows}</table></body></html>`
139
- );
140
- return;
141
- }
142
- res.writeHead(404);
143
- res.end("not found");
144
- };
145
- }
146
- function startDashboard(opts) {
147
- if (!existsSync(opts.dir)) mkdirSync(opts.dir, { recursive: true });
148
- const db = openHistory(opts.dir);
149
- const handler = createDashboardHandler({ dbPath: opts.dir, experimental: opts.experimental, db });
150
- const server = createServer(handler);
151
- return new Promise((resolve, reject) => {
152
- server.listen(opts.port ?? 0, "127.0.0.1", () => {
153
- const addr = server.address();
154
- const port = typeof addr === "object" && addr !== null ? addr.port : 0;
155
- resolve({
156
- port,
157
- close: () => new Promise((res, rej) => {
158
- server.close((err) => {
159
- try {
160
- db.close();
161
- } catch {
162
- }
163
- if (err) rej(err);
164
- else res();
165
- });
166
- })
167
- });
168
- });
169
- server.on("error", (err) => {
170
- try {
171
- db.close();
172
- } catch {
173
- }
174
- reject(err);
175
- });
176
- });
177
- }
178
-
179
- export { assertDashboardHost, createDashboardHandler, listProvenance, openHistory, recordHistory, recordProvenance, startDashboard };
1
+ import {mkdirSync,existsSync}from'fs';import {createRequire}from'module';import {createServer}from'http';import {join}from'path';var y=createRequire(import.meta.url);function d(){try{return y("node:sqlite"),!0}catch{return false}}function l(e){return `${e} requires Node 22.13+ (node:sqlite is not available on Node ${process.versions.node})`}var E=new Set;function h(e){E.add(e);}var P=createRequire(import.meta.url);function L(e){let{DatabaseSync:r}=P("node:sqlite"),o;try{o=new r(e),o.exec("CREATE TABLE IF NOT EXISTS scans (scannedAt TEXT NOT NULL, total INTEGER NOT NULL, highCrit INTEGER NOT NULL)"),o.exec("CREATE TABLE IF NOT EXISTS provenance (scannedAt TEXT NOT NULL, percent REAL NOT NULL, withProvenance INTEGER NOT NULL, total INTEGER NOT NULL)");}catch(n){try{o?.close();}catch{}throw n}let t=false,a=o,i={list(){return a.prepare("SELECT scannedAt, total, highCrit FROM scans ORDER BY scannedAt").all()},insert(n){a.prepare("INSERT INTO scans (scannedAt, total, highCrit) VALUES (?, ?, ?)").run(n.scannedAt,n.total,n.highCrit);},listProvenance(){return a.prepare("SELECT scannedAt, percent, withProvenance, total FROM provenance ORDER BY scannedAt").all()},insertProvenance(n){a.prepare("INSERT INTO provenance (scannedAt, percent, withProvenance, total) VALUES (?, ?, ?, ?)").run(n.scannedAt,n.percent,n.withProvenance,n.total);},close(){if(!t){t=true;try{a.close();}catch{}}}};return h(i),i}function f(e){if(!d())throw new Error(l("history"));let r=join(e,".fullshield");return mkdirSync(r,{recursive:true}),L(join(r,"history.db"))}function U(e,r){e.insert(r);}function C(e,r){e.insertProvenance(r);}function M(e){return e.listProvenance()}function H(e){if(e===void 0||e.length===0)return false;let r=e.split(":")[0]?.toLowerCase()??"";return r==="localhost"||r==="127.0.0.1"}function S(e){if(!e.experimental&&process.env.FULLSHIELD_EXPERIMENTAL_PLATFORM!=="1")throw new Error("dashboard requires FULLSHIELD_EXPERIMENTAL_PLATFORM=1");let r=e.db??f(e.dbPath);return (o,t)=>{if(!H(typeof o.headers.host=="string"?o.headers.host:void 0)){t.writeHead(400,{"content-type":"text/plain"}),t.end("invalid host");return}let a=new URL(o.url??"/","http://127.0.0.1");if(a.pathname==="/api/ingest"&&o.method!=="POST"){t.writeHead(405,{allow:"POST"}),t.end("method not allowed");return}if(o.method==="POST"&&a.pathname==="/api/ingest"){let i=[];o.on("data",n=>i.push(n)),o.on("end",()=>{try{let n=JSON.parse(Buffer.concat(i).toString("utf8"));r.insert(n),t.writeHead(204),t.end();}catch{t.writeHead(400),t.end("bad json");}});return}if(o.method==="GET"&&a.pathname==="/api/history"){t.writeHead(200,{"content-type":"application/json"}),t.end(JSON.stringify({scans:r.list()}));return}if(o.method==="GET"&&(a.pathname==="/"||a.pathname==="/index.html")){let n=r.list().map(s=>`<tr><td>${s.scannedAt}</td><td>${s.total}</td><td>${s.highCrit}</td></tr>`).join("");t.writeHead(200,{"content-type":"text/html; charset=utf-8"}),t.end(`<!DOCTYPE html><html><body><h1>FullShield history</h1><table><tr><th>at</th><th>total</th><th>high+crit</th></tr>${n}</table></body></html>`);return}t.writeHead(404),t.end("not found");}}function F(e){existsSync(e.dir)||mkdirSync(e.dir,{recursive:true});let r=f(e.dir),o=S({dbPath:e.dir,experimental:e.experimental,db:r}),t=createServer(o);return new Promise((a,i)=>{t.listen(e.port??0,"127.0.0.1",()=>{let n=t.address(),s=typeof n=="object"&&n!==null?n.port:0;a({port:s,close:()=>new Promise((m,b)=>{t.close(c=>{try{r.close();}catch{}c?b(c):m();});})});}),t.on("error",n=>{try{r.close();}catch{}i(n);});})}
2
+ export{H as assertDashboardHost,S as createDashboardHandler,M as listProvenance,f as openHistory,U as recordHistory,C as recordProvenance,F as startDashboard};