Skip to content

Commit 799ef23

Browse files
authored
adds ignore for W004 (#244)
* adds ignore for W004 - we dont want to fail the CI just because the mcpserver isn't in the invariantlabs for the registry Signed-off-by: Chris Burns <29541485+ChrisJBurns@users.noreply.github.com> * adds global issue ignore in scap script Signed-off-by: Chris Burns <29541485+ChrisJBurns@users.noreply.github.com> --------- Signed-off-by: Chris Burns <29541485+ChrisJBurns@users.noreply.github.com>
1 parent dd61d70 commit 799ef23

File tree

2 files changed

+42
-8
lines changed

2 files changed

+42
-8
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Global allowed issues for MCP security scanning
2+
# These issues are allowed for ALL MCP servers in the registry.
3+
# For server-specific exceptions, add them to the server's spec.yaml file instead.
4+
5+
allowed_issues:
6+
- code: "W004"
7+
reason: "Server not in Invariant Labs registry - we verify provenance independently via our own checks."

scripts/mcp-scan/process_scan_results.py

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,61 @@
1010
import yaml
1111
import os
1212

13+
# Global config file location (relative to this script)
14+
GLOBAL_CONFIG_FILE = os.path.join(os.path.dirname(__file__), 'global_allowed_issues.yaml')
15+
16+
def load_global_allowed_issues():
17+
"""
18+
Load globally allowed issues from the global config file.
19+
20+
Returns a dict of {issue_code: reason}.
21+
"""
22+
allowed_issues = {}
23+
24+
if os.path.exists(GLOBAL_CONFIG_FILE):
25+
try:
26+
with open(GLOBAL_CONFIG_FILE, 'r') as f:
27+
config = yaml.safe_load(f)
28+
29+
if config and 'allowed_issues' in config:
30+
for issue in config['allowed_issues']:
31+
if 'code' in issue:
32+
allowed_issues[issue['code']] = issue.get('reason', 'Globally allowed')
33+
except Exception as e:
34+
print(f"Warning: Could not load global config from {GLOBAL_CONFIG_FILE}: {e}", file=sys.stderr)
35+
36+
return allowed_issues
37+
1338
def load_security_config(config_file=None):
1439
"""
1540
Load security configuration from the YAML configuration file.
16-
41+
1742
Returns a tuple of (allowed_issues dict, insecure_ignore bool).
43+
Merges global allowed issues with per-server allowed issues.
1844
"""
19-
allowed_issues = {}
45+
# Start with globally allowed issues
46+
allowed_issues = load_global_allowed_issues()
2047
insecure_ignore = False
21-
48+
2249
if config_file and os.path.exists(config_file):
2350
try:
2451
with open(config_file, 'r') as f:
2552
config = yaml.safe_load(f)
26-
53+
2754
if config and 'security' in config:
2855
security_config = config['security']
29-
56+
3057
# Check for insecure_ignore flag
3158
insecure_ignore = security_config.get('insecure_ignore', False)
32-
33-
# Check for allowed_issues
59+
60+
# Check for allowed_issues (merge with global, per-server takes precedence)
3461
if 'allowed_issues' in security_config:
3562
for issue in security_config['allowed_issues']:
3663
if 'code' in issue:
3764
allowed_issues[issue['code']] = issue.get('reason', 'Explicitly allowed')
3865
except Exception as e:
3966
print(f"Warning: Could not load security config from {config_file}: {e}", file=sys.stderr)
40-
67+
4168
return allowed_issues, insecure_ignore
4269

4370
def main():

0 commit comments

Comments
 (0)