Skip to content

Commit 594e532

Browse files
Zie619claude
andcommitted
fix: resolve CI failures — ruff lint + missing Cedar policy file
- Remove quoted type annotation in cli.py (ruff UP037) - Add .cedar/ai-policy.cedar example for Cedar policy gate workflow Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5668514 commit 594e532

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

.cedar/ai-policy.cedar

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// AI-BOM Cedar Policy — Example Rules
2+
//
3+
// This file defines fine-grained rules for the AI-BOM Cedar policy gate.
4+
// The gate evaluates discovered AI components against these rules and
5+
// fails the CI pipeline if any component violates a "forbid" rule.
6+
//
7+
// Syntax (simplified Cedar-like):
8+
// permit|forbid (principal, action, resource) when { conditions };
9+
//
10+
// Supported condition fields:
11+
// resource.severity — "critical", "high", "medium", "low", "info"
12+
// resource.provider — e.g. "OpenAI", "Anthropic", "HuggingFace"
13+
// resource.component_type — "api_key", "model", "endpoint", "sdk", "framework"
14+
// resource.risk_score — integer 0-100
15+
// resource.name — component name string
16+
//
17+
// Operators: ==, !=, >, >=, <, <=
18+
19+
// ── Block critical and high-severity findings ──────────────────────
20+
forbid (principal, action, resource)
21+
when { resource.severity == "critical" };
22+
23+
forbid (principal, action, resource)
24+
when { resource.severity == "high" };
25+
26+
// ── Block exposed API keys (any severity) ──────────────────────────
27+
forbid (principal, action, resource)
28+
when { resource.component_type == "api_key" };
29+
30+
// ── Block components with risk score above 70 ──────────────────────
31+
forbid (principal, action, resource)
32+
when { resource.risk_score > 70 };
33+
34+
// ── Allow everything else ──────────────────────────────────────────
35+
permit (principal, action, resource);

src/ai_bom/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
logger = logging.getLogger("ai_bom")
4141

4242

43-
def _send_telemetry(result: "ScanResult", scan_type: str) -> None:
43+
def _send_telemetry(result: ScanResult, scan_type: str) -> None:
4444
"""Send anonymous telemetry data if opted in via AI_BOM_TELEMETRY=true.
4545
4646
Non-blocking: runs in a background thread. Fails silently on any error.

0 commit comments

Comments
 (0)