Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

audit-trail-test-author

БесплатноБез исполняемых скриптовНе проверен

Use when audit logs need tests for HIPAA, PCI DSS, SOC 2, GDPR or another framework: the required events (logins, privilege changes, data access, admin…

testlandот testland★ 18 звёзд на GitHub

Об этом скилле

audit-trail-test-author

Overview

Audit logs are the universal compliance-evidence artifact. Every major framework requires them, with overlapping but framework-specific requirements:

Framework Audit log requirement
HIPAA Security Rule §164.312(b) "implement hardware, software, and/or procedural mechanisms that record and examine activity in information systems that contain or use ePHI"
PCI DSS v4.0 Req 10 Audit trails for all access to system components, plus log review + retention
SOC 2 CC7.3 Detection of security events + logging
GDPR Art. 5(1)(f) + Art. 32 Integrity + confidentiality of personal data; audit log is the standard evidence
ISO 27001 A.8.15 Logging
NIST 800-53 AU family Audit + accountability controls

This is a build-an-X workflow - the per-system audit-log test recipe. Different from a generic logging skill; specifically focused on compliance-grade audit trails (tamper-evidence, retention, required events).

When to use

  • Compliance framework requires audit logging.
  • Authoring tests for a new feature that handles regulated data.
  • Audit findings flagged audit-log gaps in a previous review.
  • New service/component must be onboarded to org-wide audit pipeline.

Step 1 - Required-events catalog

Universal events (required by most compliance frameworks):

Event class Examples
Authentication Login success / failure / lockout / session expiry / MFA challenge
Authorization Permission grant / revoke / failed-access-attempt / role change
Data access Read PHI / PII / payment data; query that returns regulated data
Data modification Create / update / delete of regulated records (with before/after)
Admin action Config change / user provision / deprovision / privilege escalation
System events Service start / stop / crash / restart / config-reload
Export / disclosure Bulk download / API export / cross-org sharing
Impersonation / escalation "Sign in as" / sudo / break-glass access
Failed actions Anything in the above categories that errored / was denied

Per-framework additions:

  • HIPAA: emergency-access invocation
  • PCI: PAN access (must NOT contain the PAN itself)
  • SOC 2: change-management events
  • GDPR: data-subject-rights workflow events (SAR, erasure)

Step 2 - Structured log format

Per OWASP A09:2021 (Security Logging + Monitoring Failures), audit logs MUST be structured (JSON) - NOT free-text. Schema:

{
  "event_id": "audit-2026-05-06T12:00:00Z-abc123",
  "timestamp": "2026-05-06T12:00:00.123Z",
  "event_type": "phi_access",
  "actor": {
    "user_id": "[email protected]",
    "session_id": "sess-xyz",
    "ip_address": "203.0.113.42",
    "user_agent": "Mozilla/5.0..."
  },
  "subject": {
    "type": "patient_record",
    "id": "patient:123",
    "phi_type": "clinical_notes"
  },
  "action": "read",
  "outcome": "success",
  "context": {
    "request_id": "req-abc",
    "service": "ehr-api",
    "version": "1.2.3"
  },
  "previous_event_hash": "sha256:abc...",
  "this_event_hash": "sha256:def..."
}

Test pattern:

def test_audit_log_structure_valid():
    user.access_phi(patient_id=123)
    audit = AuditLog.objects.latest('timestamp')
    # Required fields
    for field in ['event_id', 'timestamp', 'event_type', 'actor', 'subject', 'action', 'outcome']:
        assert field in audit.to_dict()
    # Actor structure
    for sub_field in ['user_id', 'session_id', 'ip_address', 'user_agent']:
        assert sub_field in audit.actor
    # Schema-validated
    assert validate_against_schema(audit, 'audit-event-v1.json-schema')

Step 3 - Tamper-evident chain (hash-chain)

For HIPAA §164.312(b) / PCI Req 10 / SOC 2 CC7.3 integrity requirements:

def test_audit_log_hash_chain_integrity():
    """Each event references the previous event's hash; tampering breaks the chain."""
    events = AuditLog.objects.all().order_by('timestamp')
    for i in range(1, len(events)):
        previous = events[i - 1]
        current = events[i]
        # current event's previous_event_hash must equal previous event's hash
        assert current.previous_event_hash == previous.this_event_hash, \
            f"Hash chain broken at event {current.event_id}"
        # Each event's hash is reproducible from its content
        recomputed = sha256(current.canonical_serialization())
        assert current.this_event_hash == recomputed, \
            f"Event {current.event_id} hash mismatch (tampered?)"

For higher integrity (PCI / fintech), use signed-batch logs:

def test_audit_batch_signed_by_kms():
    """Daily batches signed by KMS; tampering invalidates signature."""
    today_batch = AuditBatch.objects.get(date=today())
    # Verify signature against KMS public key
    assert kms.verify_signature(today_batch.content, today_batch.signature)

Step 4 - Immutability + retention

Audit logs MUST be appen

Полный SKILL.md на GitHub

Установить audit-trail-test-author в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

.tessl-plugin/plugin.json

FAQ

Что делает скилл audit-trail-test-author?

Use when audit logs need tests for HIPAA, PCI DSS, SOC 2, GDPR or another framework: the required events (logins, privilege changes, data access, admin actions, exports), structured log format, tamper-evident hash chains, immutability and retention, and replaying logs for forensics.

Как установить скилл audit-trail-test-author?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл audit-trail-test-author запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить audit-trail-test-author с