audit-logging
/audit-logging
Wdraża logowanie audytowe pod compliance: ustrukturyzowane zdarzenia, niezmienne logi, śledzenie akcji użytkowników i zmian w bazie oraz wymogi SOC2, HIPAA i GDPR.
- Autor
- claude-dev-suite ↗
- Repozytorium
- claude-dev-suite ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 21.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 21.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Wdraża logowanie audytowe pod compliance: ustrukturyzowane zdarzenia, niezmienne logi, śledzenie akcji użytkowników i zmian w bazie oraz wymogi SOC2, HIPAA i GDPR.
Wyzwalacze z opisu
Oryginalny opis (EN)
Audit logging for compliance and security. Structured audit events, immutable logs, user action tracking, database change tracking, and regulatory compliance (SOC2, HIPAA, GDPR). USE WHEN: user mentions "audit log", "audit trail", "activity log", "change tracking", "compliance logging", "who changed what", "SOC2 logging" DO NOT USE FOR: application logging - use logging skills; error tracking - use observability skills
Jak działa
- Audit Event Structure
- Audit Service
- Express Middleware
- Database Schema
- Anti-Patterns
- Production Checklist
Podgląd SKILL.md
---
name: audit-logging
description: |
Audit logging for compliance and security. Structured audit events, immutable
logs, user action tracking, database change tracking, and regulatory
compliance (SOC2, HIPAA, GDPR).
USE WHEN: user mentions "audit log", "audit trail", "activity log",
"change tracking", "compliance logging", "who changed what", "SOC2 logging"
DO NOT USE FOR: application logging - use logging skills;
error tracking - use observability skills
allowed-tools: Read, Grep, Glob, Write, Edit
---
# Audit Logging
## Audit Event Structure
```typescript
interface AuditEvent {
id: string;
timestamp: string; // ISO 8601
actor: {
id: string;
type: 'user' | 'system' | 'api_key';
ip?: string;
userAgent?: string;
};
action: string; // 'user.created', 'order.deleted'
resource: {
type: string; // 'user', 'order'
id: string;
};
changes?: { // Before/after for updates
field: string;
before: unknown;
after: unknown;
}[];
metadata?: Record<string, unknown>;
}
```
## Audit Service
```typescript
class AuditService {
async log(event: Omit<AuditEvent, 'id' | 'timestamp'>): Promise<void> {
const auditEntry: AuditEvent = {
id: randomUUID(),
timestamp: new Date().toISOString(),
...event,
};
// Write to append-only table
await db.auditLog.create({ data: auditEntry });
// Optionally stream to external system
await this.eventStream?.publish('audit', auditEntry);
}
}
// Usage in service layer
async function updateUser(userId: string, data: UpdateUserDto, actor: Actor) {
const before = await db.user.findUnique({ where: { id: userId } });
const after = await db.user.update({ where: { id: userId }, data });
await audit.log({
actor: { id: actor.id, type: 'user', ip: actor.ip },
action: 'user.updated',
resource: { type: 'user', id: userId },
changes: diffFields(before, after, ['name', 'email', 'role']),
});
return after;
}
function diffFields(before: any, after: any, fields: string[]) {
return fields
.filter((f) => before[f] !== after[f])
.map((f) => ({ field: f, before: before[f], after: after[f] }));
}
```
## Express Middleware
```typescript
function auditMiddleware(action: string) {
return (req: Request, res: Response, next: NextFunction) => {
const originalJson = res.json.bind(res);
res.json = (body) => {
audit.log({
actor: { id: req.user?.id ?? 'anonymous', type: 'user', ip: req.ip },
action,
resource: { type: action.split('.')[0], id: req.params.id ?? body?.id },
});
return originalJson(body);
};
next();
};
}
app.delete('/api/users/:id', auditMiddleware('user.deleted'), deleteUserHandler);
```
## Database Schema
```sql
CREATE TABLE audit_logs (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
timestamp TIMESTAMPTZ NOT NULL DEFAULT now(),
actor_id TEXT NOT NULL,
actor_type TEXT NOT NULL,
actor_ip INET,
action TEXT NOT NULL,
resource_type TEXT NOT NULL,
resource_id TEXT NOT NULL,
changes JSONB,
metadata JSONB
);
-- Append-only: revoke UPDATE and DELETE
REVOKE UPDATE, DELETE ON audit_logs FROM app_user;
-- Indexes for common queries
CREATE INDEX idx_audit_actor ON audit_logs (actor_id, timestamp DESC);
CREATE INDEX idx_audit_resource ON audit_logs (resource_type, resource_id, timestamp DESC);
CREATE INDEX idx_audit_action ON audit_logs (action, timestamp DESC);
```
## Anti-Patterns
| Anti-Pattern | Fix |
|--------------|-----|
| Logging inside transaction (fails = no log) | Log after successful commit |
| Mutable audit table | Revoke UPDATE/DELETE, use append-only |
| Missing actor identity | Always capture who performed the action |
| Logging sensitive field values | Redact PII (email → `j***@example.com`) |
| No retention policy | Partition by month, archive after retention period |
## Production Checklist
- [ ] Append-only audit table (no UPDATE/DELETE)
- [ ] Actor identity captured on all events
- [ ] Before/after values for data changes
- [ ] PII redaction in audit entries
- [ ] Indexed for common query patterns
- [ ] Retention policy and archival
- [ ] Tamper detection (hash chain or external storage)
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · claude-dev-suite/claude-dev-suite | 100 | MIT |
| TerminalSkills/skills | 100 | Apache-2.0 |
| FrancoStino/opencode-skills-collection | 100 | MIT |
| eyesecurity/skills | 100 | GPL-3.0 |
| BagelHole/DevOps-Security-Agent-Skills | 100 | MIT |
| Amey-Thakur/AI-SKILLS | 90 | MIT |
Migawka bazy z 13.11.2026 · wersja paczki cf11c3606666 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 1 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 90backend-audit-logging
Projektuje niezmienne dzienniki audytowe zgodne z SOC 2, SOX, HIPAA i RODO, np. kto co zmienił i kiedy. - 100audit-compliance
Obsługuje audyt i zgodność w Control Plane: logi audytowe, śledzenie zmian, konteksty audytu, własne zdarzenia audytowe oraz wymagania SOC 2, HIPAA i PCI. - 100audit-report
Generuje raporty audytowe i ślady zgodności z danych audit trail Harness przez narzędzia MCP v2: akcje użytkowników, zmiany zasobów, uwierzytelnianie oraz dowody dla SOC2, GDPR i HIPAA. - 100windsurf-audit-logging
Konfiguruje logowanie audytowe interakcji z AI na potrzeby zgodności i śledzenia aktywności w Windsurf. - 100klingai-audit-logging
Wdraża logi audytowe operacji Kling AI na potrzeby zgodności i bezpieczeństwa, przy śledzeniu użycia API i przygotowaniu do audytów. - 100compliance-review
Sprawdza zgodność regulacyjną z SOC2, PCI-DSS, GDPR i HIPAA: listy kontrolne, ślady audytowe i kontrola dostępu.