Skip to main content

H-11 Image scanning

Brick H of the Enterprise AI Platform. Technology: Trivy (images, filesystem, IaC config, secrets) in CI and Harbor. French version: ../../fr/bricks/H-11-image-scanning.md.

Role and responsibilities​

  • Find CVEs, misconfigurations and leaked secrets before release; rescan running images daily.

Position and interactions​

  • Execution path: workflow (CI) and periodic rescans.
  • CI fails on critical vulnerabilities without accepted exception; results attached as attestations.

Open source and developed parts​

  • Open source reused: Trivy.
  • Developed in the platform: Thresholds, exception records with expiry.

Data model​

No dedicated table: state lives in Kubernetes objects, Git and the tool's own storage; actions are audited in eai.audit_events through the Control Plane when they go through the API.

Contract: contracts/v1/policy-contract.schema.json (schema_version 1.0). Usage is always reported with contracts/v1/usage-event.schema.json, audit with contracts/v1/audit-event.schema.json.

API endpoints​

MethodPath
POST/v1/policies/evaluate

POST /v1/policies/evaluate​

Request:

{
"action": "image.deploy",
"resource": {
"type": "image",
"digest": "sha256:ab12"
},
"context": {
"signed": true,
"critical_vulns": 0
}
}

Response:

{
"allow": true,
"reasons": [],
"decision_id": "dec_44"
}

SDK examples​

Python​

from enterprise_ai import EnterpriseAI

client = EnterpriseAI(base_url="<control-plane-url>", api_key="eai_live_xxx", tenant="acme", locale="en")
client.policies.evaluate(request={"action": "image.deploy", "resource": {"type": "image", "digest": "sha256:ab12"}})

TypeScript​

import { EnterpriseAI } from "@enterprise-ai/sdk";

const client = new EnterpriseAI({ baseUrl: "<control-plane-url>", apiKey: process.env.EAI_API_KEY, tenant: "acme", locale: "en" });
await client.policies.evaluate({ action: "image.deploy", resource: { type: "image", digest: "sha256:ab12" } });

Java​

EnterpriseAIClient client = EnterpriseAIClient.builder()
.baseUrl("<control-plane-url>")
.apiKey(System.getenv("EAI_API_KEY"))
.tenant("acme")
.locale(Locale.ENGLISH)
.build();
client.policies().evaluate(Map.of("action", "image.deploy", "resource", Map.of("type", "image", "digest", "sha256:ab12")));

Go​

client, err := eai.NewClient(eai.WithBaseURL("<control-plane-url>"), eai.WithAPIKey(os.Getenv("EAI_API_KEY")), eai.WithTenant("acme"), eai.WithLocale("en"))
if err != nil { log.Fatal(err) }
ctx := context.Background()
_, err = client.Policies.Evaluate(ctx, map[string]any{"action": "image.deploy", "resource": map[string]any{"type": "image", "digest": "sha256:ab12"}})

Configuration​

No EAI_* variable: configured through Helm values and the tool's own configuration.

Security​

  • Exceptions are risk exceptions (POST /v1/risk/exceptions) with owner and expiry.
  • Tenant resolved from the credential, never from the body; PostgreSQL row level security on every tenant table.
  • Every mutation and policy decision writes a hash chained audit event (G-11).
  • Errors use the standard envelope with message_i18n en and fr.

Observability​

  • Vulnerability counts per image and age.
  • W3C traceparent propagated, X-Request-Id returned, spans carry eai.tenant_id, eai.project, eai.agent_id, eai.run_id.

FinOps units​

  • Not applicable (CI cost only).

Failure modes and resilience​

  • Vulnerability DB unreachable -> use mirrored DB, fail if older than 72 h.

Standalone adoption​

Usable alone in client CI.

Acceptance tests​

  1. An image with a known critical CVE fails the pipeline.

Implementation roadmap