{"id":36439096,"url":"https://github.com/SecureAI-Team/asb-security-schema","last_synced_at":"2026-01-18T13:00:55.472Z","repository":{"id":326677537,"uuid":"1105012921","full_name":"SecureAI-Team/asb-security-schema","owner":"SecureAI-Team","description":"A unified security event schema for LLM, RAG, and Agent applications.","archived":false,"fork":false,"pushed_at":"2025-12-05T14:58:26.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-09T01:21:28.988Z","etag":null,"topics":["agent","ai-security","audit-logging","eu-ai-act","llm","opa","policy-as-code","rag","schema"],"latest_commit_sha":null,"homepage":"https://asbsecurity.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SecureAI-Team.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-27T02:34:49.000Z","updated_at":"2025-12-05T14:58:30.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/SecureAI-Team/asb-security-schema","commit_stats":null,"previous_names":["secureai-team/asb-security-schema"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SecureAI-Team/asb-security-schema","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SecureAI-Team%2Fasb-security-schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SecureAI-Team%2Fasb-security-schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SecureAI-Team%2Fasb-security-schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SecureAI-Team%2Fasb-security-schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SecureAI-Team","download_url":"https://codeload.github.com/SecureAI-Team/asb-security-schema/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SecureAI-Team%2Fasb-security-schema/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28536686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T10:13:46.436Z","status":"ssl_error","status_checked_at":"2026-01-18T10:13:11.045Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","ai-security","audit-logging","eu-ai-act","llm","opa","policy-as-code","rag","schema"],"created_at":"2026-01-11T21:00:17.905Z","updated_at":"2026-01-18T13:00:55.433Z","avatar_url":"https://github.com/SecureAI-Team.png","language":"Python","funding_links":[],"categories":["?? ASB Open Source Ecosystem"],"sub_categories":[],"readme":"# ASB Security Schema\n\n\u003e A unified security event model for securing LLM, RAG, and Agent applications.  \n\nASB Security Schema defines a **canonical JSON structure** for AI security events:\n\n- 🔒 Make AI security policies easier with **one standard `input`** for OPA / Policy-as-Code  \n- 🧾 Standardize **logs \u0026 audit trails** for EU AI Act, ISO 27001, ISO 42001 and internal governance  \n- 🧩 Works with **any LLM / RAG / Agent stack** – LangChain, Dify, AutoGen, CrewAI, custom apps…\n\nThis repo is a **specification repository**: it contains the **specification, JSON Schema, examples, and OPA policy samples**.  \nRuntime components (such as `asb-secure-gateway`) use this schema as their **canonical event format**.\n\n---\n\n## Quick Links\n\n- 📄 Spec: **[ASB Security Event Schema v0.1](spec/asb-security-schema-v0.1.md)**\n- 🧬 JSON Schema: **[asb-security-schema-v0.1.json](schema/asb-security-schema-v0.1.json)**\n- 🧪 Examples: **[examples/](examples/)** – LLM / RAG / Agent events  \n- 🧯 Policies: **[policies/](policies/)** – OPA / Rego samples\n\nFor a Chinese overview, see **[README_zh.md](README_zh.md)**.\n\n---\n\n## SDKs \u0026 Libraries\n\nNeed to integrate the schema directly in your app? Use the lightweight SDKs included here.\n\n- **Python** – `pip install git+https://github.com/asb-security/asb-security-schema.git#subdirectory=python`  \n  ```python\n  from asb_security_schema import SecurityEventBuilder, validate_event\n\n  builder = SecurityEventBuilder(\n      subject={\"user\": {\"id\": \"user-123\", \"type\": \"human\"}},\n      operation={\n          \"category\": \"llm_completion\",\n          \"name\": \"chat\",\n          \"direction\": \"input\",\n          \"model\": {\"name\": \"gpt-4o\"},\n      },\n      resource={\"llm\": {\"messages\": [{\"role\": \"user\", \"content\": \"hello\"}]}},\n  )\n  event = builder.build()  # validate_event(event) already runs by default\n  ```\n\n- **Go** – `go get github.com/asb-security/asb-security-schema/go/securityschema`  \n  ```go\n  import \"github.com/asb-security/asb-security-schema/go/securityschema\"\n\n  payload := map[string]any{\n      \"schema_version\": securityschema.SchemaVersion,\n      \"event_id\":       \"evt-123\",\n      \"timestamp\":      \"2024-01-01T00:00:00Z\",\n      \"subject\": map[string]any{\"user\": map[string]any{\"id\": \"user-123\", \"type\": \"human\"}},\n      \"operation\": map[string]any{\"category\": \"llm_completion\", \"name\": \"chat\", \"direction\": \"input\"},\n      \"resource\": map[string]any{\"llm\": map[string]any{\"messages\": []any{map[string]any{\"role\": \"user\", \"content\": \"hello\"}}}},\n  }\n  if err := securityschema.Validate(payload); err != nil {\n      panic(err)\n  }\n  ```\n\n\u003e Maintainers: run `python -m scripts.sync_schema_assets` whenever the canonical schema changes to keep the SDKs in sync.\n\n---\n\n## What is this?\n\n`asb-security-schema` is a **data model** for describing security-relevant actions in AI systems.\n\nIt defines:\n\n- A common **ASB Security Schema** for:\n  - LLM completions (chat / completion / embedding)\n  - RAG (Retrieval-Augmented Generation) queries\n  - Agent tool / action executions\n- A set of **JSON examples** for typical events\n- A few **OPA (Open Policy Agent) policy samples** that consume this schema\n\nThis repo does **not** implement a gateway itself.  \nRuntime components such as `asb-secure-gateway` use this schema as the **canonical input** for:\n\n- Policy decisions (allow / deny / mask / escalate)\n- Audit logs and forensic analysis\n- Compliance and reporting (e.g., EU AI Act, internal governance)\n\n---\n\n## 1. Goals\n\nThe ASB Security Schema aims to:\n\n1. **Standardize** how AI security events are represented across LLM, RAG, and Agent use cases.\n2. Enable **Policy-as-Code** using engines like OPA, by providing a consistent `input` shape.\n3. Make it easier to export AI security events into **SIEM / observability / audit** systems.\n4. Support both:\n   - **Real-time enforcement** (pre- / post-decision events)\n   - **Post-incident analysis** (rich context for investigations).\n\nIt is a **data model**, not a full security product or WAF / SIEM replacement.\n\n---\n\n## 2. Conceptual Model\n\nAt the core of this schema is a single object:\n\n\u003e **SecurityEvent** – a JSON document that describes one security-relevant action or decision in an AI system.\n\nEvery `SecurityEvent` answers the questions:\n\n- **Who** did something? → `subject`\n- **What** did they do? → `operation`\n- **On what** resource? → `resource`\n- In which **context**? → `context`\n- With which **decision** and risk level? → `decision` (optional for pre-decision events)\n\n---\n\n## 3. Top-Level Structure (v0.1)\n\nAll events follow this envelope:\n\n```jsonc\n{\n  \"schema_version\": \"asb-sec-0.1\",\n  \"event_id\": \"uuid-1234\",\n  \"timestamp\": \"2025-01-01T12:00:00Z\",\n\n  \"tenant_id\": \"tenant-a\",\n  \"app_id\": \"kb-copilot\",\n  \"env\": \"prod\",  // dev | test | prod\n\n  \"subject\":   { /* who */ },\n  \"operation\": { /* what */ },\n  \"resource\":  { /* on what */ },\n  \"context\":   { /* extra context */ },\n  \"decision\":  { /* policy result (optional) */ }\n}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSecureAI-Team%2Fasb-security-schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSecureAI-Team%2Fasb-security-schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSecureAI-Team%2Fasb-security-schema/lists"}