Compliance evidence export
The evidence export packages what your auditors usually ask for into one bundle: how the gateway is configured, whether its audit log is intact, and what it recorded over a period. Each bundle is stored with a SHA-256 checksum, so you and your auditor can confirm that a downloaded copy has not changed since it was handed over and that it matches the stored record. It is an enterprise feature, and every /compliance/evidence route returns 403 without a license.
The bundle is input for your own ISO/IEC 42001 or SOC 2 assessment. Generating it does not certify your deployment, your organization or Spanway against either standard. The control mapping is a suggestion for your auditor to confirm against your own scope and policies.
A real-world scenario
An auditor preparing a SOC 2 report asks for proof of access control, audit logging and retention over the last quarter. The security lead generates a 90 day bundle, downloads the JSON and the HTML report, and sends both with the checksum so the auditor can confirm that nothing changed after handover.
Steps
-
In the Admin UI open Settings, then Compliance, and select the Evidence tab.
-
Choose Last 90 days under Evidence window and click Generate bundle. The same call with the API:
curl -X POST http://localhost:4000/compliance/evidence/generate \-H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \-d '{"window_days": 90}' -
In the bundle's row click JSON and Report under Download, or fetch them with the
evidence_idfrom step 2.curl -s "http://localhost:4000/compliance/evidence/bundle?evidence_id=$ID" -H "Authorization: Bearer $SPANWAY_MASTER_KEY" -o bundle.jsoncurl -s "http://localhost:4000/compliance/evidence/report?evidence_id=$ID" -H "Authorization: Bearer $SPANWAY_MASTER_KEY" -o report.html -
Recompute the checksum as shown in Download and verify and send it with the files.
Expected result
A toast confirms "Evidence bundle" with the first 12 characters of its checksum. The JSON download carries "checksum_valid": true, and the recomputed SHA-256 matches the sha256 of the bundle and the X-Evidence-SHA256 header of the report.
What a bundle contains
| Section | Contents |
|---|---|
control_map | Each Spanway control with its suggested ISO/IEC 42001 clause or Annex A control, its SOC 2 criteria, a pass, fail or not_applicable status and the evidence behind it. |
compliance_report | The full regime catalogue evaluated against the running configuration, with its summary score. |
audit_log | Whether audit logging is on, the audit log retention period, and the hash chain verification result for the window, including the first broken row if there is one. |
retention | Every retention period the cleanup job honours and when the job last finished. |
access_control | SSO providers, whether environment credential login is disabled, whether the master key is a known default, custom roles with their granted and denied permissions, user counts by role, active SCIM tokens and SCIM-provisioned users, and the allowed_ips allow-list. |
guardrails | Every configured guardrail with its modes, and which ones mask personal data before the model call. |
evals and red_team | Up to 25 eval runs and 25 red-team runs started in the window, with their status and pass rates. |
change_history | Audit log counts by table and action for the window, and the newest 500 changes with who made them, when, and which object. Before and after values are left out. |
Window bounds, the trigger (manual or scheduled), who generated it and a scope_statement repeating the paragraph above are recorded with every bundle.
Control map
| Control | ISO/IEC 42001 | SOC 2 | Source |
|---|---|---|---|
access.sso | A.3.2 | CC6.1 | sso_configured evaluator |
access.master_key | CC6.1 | master_key_not_default evaluator | |
access.env_login | CC6.1 | env_credential_login_disabled evaluator | |
access.least_privilege | A.3.2 | CC6.2, CC6.3 | custom_roles_in_use evaluator |
access.provisioning | A.3.2 | CC6.2 | At least one active SCIM token |
access.network | CC6.6 | allowed_ips is set | |
access.transmission | CC6.7 | tls_on_public_url evaluator | |
logging.audit_trail | A.6.2.8, 7.5.3 | CC7.2, CC8.1 | Audit logging is on and the hash chain verifies for the window |
logging.audit_retention | 7.5.3 | CC7.3 | audit_log_retention_configured evaluator |
logging.monitoring | A.6.2.6 | CC7.2 | external_logging_sink evaluator |
data.request_log_retention | C1.2 | spend_log_retention_configured evaluator | |
data.prompt_minimisation | P4.2, C1.1 | prompts_not_stored_or_masked evaluator | |
data.residency | A.10.3 | CC9.2 | residency_policy_enforced evaluator |
guardrails.coverage | A.9.2, A.6.2.6 | CC5.2 | At least one guardrail is configured |
guardrails.pii | A.9.2 | C1.1, P4.1 | pii_masking_pre_call evaluator |
evaluation.evals | A.6.2.4, 9.1 | CC4.1 | At least one eval run completed in the window |
evaluation.red_team | A.6.2.4, 6.1.2 | CC3.2, CC4.1 | At least one red-team run completed in the window |
operations.capacity | A.4.5 | A1.1 | rate_limits_configured evaluator |
References are to ISO/IEC 42001:2023 and the 2017 Trust Services Criteria with the 2022 points of focus. The evaluators are described on the compliance page.
Generate a bundle
A proxy admin generates a bundle over the last window_days days, from 1 to 366, defaulting to 90.
curl -X POST http://localhost:4000/compliance/evidence/generate \
-H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \
-d '{"window_days": 90}'
{
"evidence_id": "5c0b0c2e-8f0e-4a51-9d0a-3e2f3f0c9b6e",
"trigger": "manual",
"window_start": "2026-07-20T12:00:00Z",
"window_end": "2026-10-18T12:00:00Z",
"sha256": "9f2c...",
"created_by": "admin@example.com",
"created_at": "2026-10-18T12:00:01Z"
}
Download and verify
GET /compliance/evidence lists stored bundles newest first, without their contents. GET /compliance/evidence/bundle?evidence_id=... returns the JSON bundle with checksum_valid, which is false when the stored contents no longer match the checksum recorded at generation. GET /compliance/evidence/report?evidence_id=... returns the same bundle as a self-contained HTML report, ready to print to PDF from a browser, with the checksum in the report and in the X-Evidence-SHA256 header. The report is refused with 409 when the stored bundle fails its checksum.
The checksum is SHA-256 over the bundle serialized as UTF-8 JSON with sorted keys and no whitespace. An auditor can recompute it from the bundle field of the JSON download.
The checksum has no key and is stored in the same database row as the bundle, so on its own it does not prove that the gateway produced the contents. Anyone who can write to that row can change the bundle and its checksum together. When audit logging is on, every generated bundle also writes a created row to the audit log that records its sha256, and the audit log is covered by the hash chain. To tie a bundle to its generation, compare its checksum with that audit row and check that the chain verifies over the period that contains it.
curl -s "http://localhost:4000/compliance/evidence/bundle?evidence_id=$ID" -H "Authorization: Bearer $SPANWAY_API_KEY" \
| python3 -c 'import hashlib, json, sys
bundle = json.load(sys.stdin)["bundle"]
print(hashlib.sha256(json.dumps(bundle, sort_keys=True, separators=(",", ":"), ensure_ascii=False).encode()).hexdigest())'
Reads are open to proxy admins and admin viewers, and generation needs a proxy admin. A custom role can open them to other people too: a role that grants compliance.read lists, downloads and verifies bundles, and a role that grants compliance.write as well can generate them. compliance.write covers only the changes, so grant both to an auditor who also generates bundles. A custom role built on proxy_admin_viewer can take reads away by denying compliance.read. Every generation is written to the audit log as created, and every download as exported, against Spanway_ComplianceEvidenceTable.
Scheduled bundles
Turn on scheduled bundles when your auditor expects fresh evidence every week or month without anyone remembering to click Generate. Set compliance_evidence_interval under general_settings to a duration such as 7d or 30d to store a bundle automatically. It is unset by default, which means bundles are made only when someone generates one. Each scheduled bundle costs one evidence query run against the database and the storage of one bundle, and a proxy admin changes it in the config file or through /config/field/update. A background job checks hourly and, once the interval has passed since the last scheduled bundle, generates a new one over the last 90 days and writes a created audit row for it with compliance_evidence_schedule as the actor. Manually generated bundles do not move the schedule. With Redis configured, the pods share a lock and only one of them generates the bundle. Without Redis there is no shared lock, so on a deployment with several pods each pod can store its own scheduled bundle for the same interval.
general_settings:
compliance_evidence_interval: 7d
Bundles are kept until maximum_compliance_evidence_retention_period deletes them, counted from when they were generated, or forever when it is unset. A bundle's change history names who changed what, so a data subject request exports the bundles that name the subject, and erasure replaces created_by with the pseudonym but leaves the bundle unchanged so its SHA-256 still verifies.
Admin UI
The Evidence tab of the Compliance page lists stored bundles with their checksum, generates a new one over a chosen window, and downloads the JSON bundle or the HTML report.
API
| Method | Path | Who | Purpose |
|---|---|---|---|
| GET | /compliance/evidence | Proxy admin, admin viewer, compliance.read | List stored bundles, newest first, with page and page_size. |
| POST | /compliance/evidence/generate | Proxy admin, compliance.write | Generate and store a bundle over window_days. |
| GET | /compliance/evidence/bundle | Proxy admin, admin viewer, compliance.read | Download one bundle as JSON with checksum_valid. |
| GET | /compliance/evidence/report | Proxy admin, admin viewer, compliance.read | Download one bundle as an HTML report. |
Errors
| Status | Message | Meaning and fix |
|---|---|---|
| 403 | The 'compliance_evidence' feature needs a Spanway enterprise license. You must be a Spanway Enterprise user to use this feature. ... | The gateway has no valid Enterprise license. Set SPANWAY_LICENSE. |
| 403 | Your Spanway license does not include the 'compliance_evidence' feature. Contact sales@spanway.ai to add it. | The license is valid but does not list compliance_evidence. |
| 403 | Only proxy admins can read this resource | Reads need a proxy admin, an admin viewer or a custom role with compliance.read. |
| 403 | Only proxy admins can change this resource | Generation needs a proxy admin or a custom role with compliance.write. |
| 404 | evidence bundle <id> not found | The id is wrong, or retention deleted the bundle. |
| 409 | stored evidence bundle does not match its checksum | The stored row changed after generation. Treat the bundle as damaged, check the audit log for the created row and generate a new one. |
| 500 | DB not connected | Set DATABASE_URL. |
Logs
| Level | Line | Meaning |
|---|---|---|
| INFO | compliance: stored scheduled evidence bundle <evidence_id> | The schedule set by compliance_evidence_interval stored a new bundle. Normal. |
| DEBUG | Compliance evidence exports are an Enterprise Feature. Skipping... | compliance_evidence_interval is set but the license does not include compliance_evidence, so no bundle is scheduled. Add the feature to the license or unset the interval. |
Related
- Compliance and data governance for the regime catalogue in the bundle.
- Compliance page for the Evidence tab.
- Audit logs for the hash chain the bundle verifies.