Skip to main content
Glama
README.md
# AuditTrail Sentinel

[![CI](https://github.com/devbox-zero-ops/audittrail-sentinel/actions/workflows/ci.yml/badge.svg)](https://github.com/devbox-zero-ops/audittrail-sentinel/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

**Regulated Compliance & Incident Evidence Copilot for Jira and Confluence**

- **Live Interactive Browser Sandbox (No Login Required):** https://devbox-zero-ops.github.io/audittrail-sentinel/
- **Latest Release:** [`v1.0.0`](https://github.com/devbox-zero-ops/audittrail-sentinel/releases/tag/v1.0.0)

AuditTrail Sentinel is a serverless Atlassian Forge application designed for FinTech, HealthTech, and other regulated engineering teams operating under **SOC-2**, **ISO-27001**, and **HIPAA**. It computes real-time compliance readiness scores directly on Jira issues, enforces Separation of Duties (SoD), generates tamper-evident **SHA-256** Confluence Audit Evidence Packs, and exposes compliance gates to both **Rovo Agents** and external IDE/CI-CD workflows via **Atlassian MCP**.

---

## Architecture

```
+-------------------------------------------------------------------------+
|                        Atlassian Cloud Site                             |
|                                                                         |
|  +------------------------+          +-------------------------------+  |
|  |   Jira Issue Panel     |          |  Confluence Compliance Macro  |  |
|  | (jira:issuePanel / UI) |          |     (confluence:macro)        |  |
|  +-----------+------------+          +---------------+---------------+  |
|              |                                       |                  |
|              +-------------------+-------------------+                  |
|                                  v                                      |
|  +-------------------------------------------------------------------+  |
|  |                  Atlassian Forge Serverless Runtime               |  |
|  |                                                                   |  |
|  |  +-------------------+   +-------------------+   +-------------+  |  |
|  |  |  Forge Resolver   |   |  Rovo Agent &     |   |  Atlassian  |  |  |
|  |  |  (src/index.mjs)  |   |  Rovo Actions     |   |  MCP Server |  |  |
|  |  +---------+---------+   +---------+---------+   +------+------+  |  |
|  |            |                       |                    |         |  |
|  |            +-----------+-----------+--------------------+         |  |
|  |                        v                                          |  |
|  |       +--------------------------------------------------+        |  |
|  |       |          src/core/actionHandlers.mjs             |        |  |
|  |       +-----------------------+--------------------------+        |  |
|  |                               |                                   |  |
|  |            +------------------+------------------+                |  |
|  |            v                                     v                |  |
|  |  +------------------------+         +--------------------------+  |  |
|  |  |  complianceEngine.mjs  |         |     evidencePack.mjs     |  |  |
|  |  |  SOC-2 / ISO / HIPAA   |         | Canonical JSON + SHA-256 |  |  |
|  |  |  0-100 Scoring + SoD   |         | Confluence Storage XHTML |  |  |
|  |  +------------------------+         +--------------------------+  |  |
|  +-------------------------------------------------------------------+  |
|              |                        |                     |           |
|              v                        v                     v           |
|      Jira REST API v3       Confluence REST API v2    Forge Storage     |
+-------------------------------------------------------------------------+
```

```mermaid
flowchart LR
  Jira[Jira Issue Panel] --> Resolver[Forge Resolver]
  Rovo[Rovo Agent] --> Actions[Rovo Actions]
  IDE[External IDE / CI Agent] --> MCP[rovo:mcp Server]

  Resolver --> Handlers[actionHandlers.mjs]
  Actions --> Handlers
  MCP --> Handlers

  Handlers --> Engine[complianceEngine.mjs]
  Handlers --> Evidence[evidencePack.mjs]

  Handlers --> JiraAPI[(Jira REST API v3)]
  Handlers --> ConfAPI[(Confluence REST API v2)]
  Handlers --> Storage[(Forge Storage)]
```

---

## Compliance Scoring Model (0–100)

| Control ID | Control Name | Weight | Standards Mapping | Pass Criteria |
| --- | --- | :---: | --- | --- |
| `SOD_01` | Separation of Duties (SoD) | 30 | SOC-2 CC8.1/CC6.1, ISO-27001 A.8.32/A.5.3, HIPAA §164.312(a)(1) | Independent approver recorded; `reporter != approver != deployer` and `assignee != approver` |
| `EVIDENCE_PR_02` | Linked Change / PR Evidence | 20 | SOC-2 CC8.1, ISO-27001 A.8.32, HIPAA §164.312(b) | At least one linked PR, commit, or CI/CD build artifact |
| `CONFLUENCE_RCA_03` | Confluence RCA / Audit Record Link | 20 | SOC-2 CC7.2/CC7.4, ISO-27001 A.5.24/A.5.28, HIPAA §164.308(a)(6) | Linked Confluence postmortem, RCA, or compliance record page |
| `SLA_04` | SLA Breach & Timeliness Check | 15 | SOC-2 CC7.3, ISO-27001 A.5.26, HIPAA §164.308(a)(6)(ii) | Within severity SLA (`CRITICAL`: 4h, `HIGH`: 24h, `MEDIUM`: 72h, `LOW`: 168h) |
| `MANDATORY_FIELDS_05` | Severity-Based Mandatory Audit Metadata | 15 | SOC-2 CC6.8/CC8.1, ISO-27001 A.5.28/A.8.32, HIPAA §164.312(b) | Required fields populated (`summary`, `environment`, plus `riskLevel`, `rollbackPlan`, `rootCause`, `affectedSystems` for High/Critical) |

### Grading Rules
- **`PASS`**: Score `>= 85` and `0` `CRITICAL` findings.
- **`WARN`**: Score `60–84` and `0` `CRITICAL` findings.
- **`FAIL`**: Any `CRITICAL` finding (e.g., SoD self-approval or Critical SLA breach) or score `< 60`.

---

## Project Structure

```text
audittrail-sentinel/
├── manifest.yml                 # Atlassian Forge manifest (Issue Panel, Macro, Rovo Agent, Actions, MCP)
├── package.json                 # Node 20+ ES module config & Forge dependencies
├── LICENSE                      # MIT License
├── README.md
├── src/
│   ├── index.mjs                # Forge resolver, Rovo action, and MCP entrypoints
│   ├── core/
│   │   ├── complianceEngine.mjs # Pure deterministic SOC-2 / ISO-27001 / HIPAA scoring & SoD engine
│   │   ├── evidencePack.mjs     # Canonical JSON serializer, SHA-256 digest & Confluence XHTML generator
│   │   └── actionHandlers.mjs   # Dependency-injected Jira/Confluence/Storage orchestration
│   └── frontend/
│       └── index.jsx            # Forge UI Kit (@forge/react) Jira Issue Panel
└── tests/
    └── compliance.test.mjs      # Node built-in test runner unit & integration suite
```

---

## Quickstart (Atlassian Forge)

### Prerequisites
- Node.js `>= 20.0.0`
- Atlassian Forge CLI (`npm install -g @forge/cli`)
- An Atlassian Developer Cloud site with Jira and Confluence enabled

### Local Unit Tests (Zero Install Required)

```bash
npm test
```

### Deploy to Atlassian Forge

```bash
npm install
forge login
forge register
forge deploy
forge install
```

Select your target Jira and Confluence site during `forge install`. Once installed, open any Jira issue to view the **AuditTrail Sentinel** panel and invoke the **AuditTrail Compliance Copilot** in Rovo.

---

## Rovo Agent & Action Reference

**Agent Key:** `audit-compliance-agent` (**AuditTrail Compliance Copilot**)

| Action Key | Verb | Inputs | Description |
| --- | --- | --- | --- |
| `scan-issue-compliance` | `GET` | `issueKey` (required), `frameworks` (optional) | Evaluates an issue across SOC-2, ISO-27001, and HIPAA controls and returns score, grade, findings, and remediation steps. |
| `verify-sod-approvals` | `GET` | `issueKey` (required) | Audits actor separation across reporter, implementer/assignee, approver, and deployer. |
| `draft-audit-pack` | `CREATE` | `issueKey` (required), `spaceKey` (default `COMP`), `publish` (boolean) | Generates a Confluence Storage Format Audit Evidence Pack with a deterministic SHA-256 digest and optionally publishes and links it. |

---

## Atlassian MCP Tool Reference

**Module Key:** `audittrail-mcp-server` (`rovo:mcp`)

| MCP Tool Name | Arguments | Output |
| --- | --- | --- |
| `get_compliance_score` | `{ issueKey, frameworks? }` | Full 0–100 compliance evaluation, control breakdown, findings, and remediation checklist. |
| `list_non_compliant_issues` | `{ projectKey?, jql?, maxResults?, frameworks? }` | Scans matching Jira issues and returns all non-compliant (`WARN`/`FAIL`) tickets with top findings. |
| `generate_evidence_digest` | `{ issueKey, spaceKey?, publish?, frameworks? }` | Produces a canonical JSON snapshot, cryptographic SHA-256 tamper-evident digest, and optional Confluence page link. |

---

## License

Released under the [MIT License](./LICENSE).