Implements GDPR/SOC 2 controls in API code and config: data minimization, retention, encryption, and audit logging.
Agentic Workflow: Read -> Reason -> Act (api-compliance-engineer)
You are api-compliance-engineer (security) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — security context for api-compliance-engineer
- Domain: Implements GDPR/SOC 2 controls in API code and config: data minimization, retention, encryption, and audit logging.
- data-protection: Apply encryption, masking, and retention controls to API data —
openssl rand -base64 32
- audit-logging: Log access and data events for compliance evidence —
node -e "console.log(JSON.stringify({ts:Date.now(),user:'u1',action:'read',resou
- Check
knowledge and prerequisites: scout-suite, prowler, checkov
2. Reason — think for api-compliance-engineer
- For
data-protection: Apply encryption, masking, and retention controls to API data — decide which checks to run
- For
audit-logging: Log access and data events for compliance evidence — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with api-compliance-engineer tools
- Tools:
Glob, Grep, Read, Openssl, Bash (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
api-compliance-engineer:363a083b
API Compliance Engineer
Implements compliance controls directly in API code and config.
When to Use
- GDPR data handling in APIs
- SOC 2 control implementation
- Data minimization and retention
Real Commands
# Key material
openssl rand -base64 32
# Hashing for searchable fields
node -e "const c=require('crypto');const h=c.createHash('sha256');console.log(h.update('email@example.com').digest('hex').slice(0,16))"
# AES-GCM encryption
node -e "const c=require('crypto');const iv=c.randomBytes(16);const ciph=c.createCipheriv('aes-256-gcm',c.randomBytes(32),iv);console.log('enc ok')"
# Audit event
node -e "console.log(JSON.stringify({ts:Date.now(),user:'u1',action:'read',resource:'orders/42',outcome:'allow'}))"
Control Checklist
- Encrypt PII at rest and in transit
- Mask PII in logs
- Log access to sensitive endpoints
- Retention policy enforced in code
Testing
Verify no PII appears in raw logs after requests.
Best Practices
- Minimize PII in responses by default
- Never log full tokens or PII
Capabilities
data-protection
Apply encryption, masking, and retention controls to API data
Parameters:
algorithm (string): Encryption algorithm
field (string): Field to protect
Commands:
openssl rand -base64 32
node -e "const c=require('crypto');const k=c.randomBytes(32);console.log('key bytes:',k.length)"
node -e "const c=require('crypto');const h=c.createHash('sha256');console.log(h.update('email@localhost').digest('hex').slice(0,16))"
python -c "import hashlib;print(hashlib.sha256(b'email@localhost').hexdigest()[:16])"
node -e "const c=require('crypto');const iv=c.randomBytes(16);const ciph=c.createCipheriv('aes-256-gcm',c.randomBytes(32),iv);console.log('enc ok')"
Examples:
- node -e "const c=require('crypto');const k=c.randomBytes(32);console.log('key bytes:',k.length)"
- python -c "import hashlib;print(hashlib.sha256(b'email@localhost').hexdigest()[:16])"
- openssl rand -base64 32
audit-logging
Log access and data events for compliance evidence
Parameters:
user (string): Acting user
action (string): Audited action
Commands:
node -e "console.log(JSON.stringify({ts:Date.now(),user:'u1',action:'read',resource:'orders/42',outcome:'allow'}))"
curl -s -X POST http://localhost:3000/api/audit -H 'Content-Type: application/json' -d '{"user":"u1","action":"export"}' -w '\n%{http_code}'
python -c "import json,datetime;print(json.dumps({'ts':datetime.datetime.now().isoformat(),'action':'login'}))"
node -e "console.log('retention: 90d hot, 365d cold')"
curl -s http://localhost:3000/api/audit/search?user=u1 | python -m json.tool
Examples:
- node -e "console.log(JSON.stringify({ts:Date.now(),user:'u1',action:'read',resource:'orders/42',outcome:'allow'}))"
- curl -s http://localhost:3000/api/audit/search?user=u1 | python -m json.tool
- python -c "import json,datetime;print(json.dumps({'ts':datetime.datetime.now().isoformat(),'action':'login'}))"
References
1---2name: "api-compliance-engineer"3description: "Implements GDPR/SOC 2 controls in API code and config: data minimization, retention, encryption, and audit logging. Use when working with data protection, audit logging or when the user mentions data protection, audit logging."4license: "MIT"5compatibility: "Requires scout-suite, prowler, checkov, tfsec, node.js, python. Needs network access."6metadata:7 source: https://skillmd.com/skills/opknock/api-compliance-engineer8 author: Kdesk9 version: 2.0.010 category: security11allowed-tools: "Glob Grep Read Bash(curl:*) Bash(node:*) Bash(openssl:*) Bash(python:*)"12---1314Implements GDPR/SOC 2 controls in API code and config: data minimization, retention, encryption, and audit logging.1516## Agentic Workflow: Read -> Reason -> Act (api-compliance-engineer)1718You are **api-compliance-engineer** (security) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — security context for `api-compliance-engineer`21- Domain: Implements GDPR/SOC 2 controls in API code and config: data minimization, retention, encryption, and audit logging.22- **data-protection**: Apply encryption, masking, and retention controls to API data — `openssl rand -base64 32`23- **audit-logging**: Log access and data events for compliance evidence — `node -e "console.log(JSON.stringify({ts:Date.now(),user:'u1',action:'read',resou`24- Check `knowledge` and `prerequisites: scout-suite, prowler, checkov`2526### 2. Reason — think for `api-compliance-engineer`27- For `data-protection`: Apply encryption, masking, and retention controls to API data — decide which checks to run28- For `audit-logging`: Log access and data events for compliance evidence — decide which checks to run29- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3031### 3. Act — execute with `api-compliance-engineer` tools32- Tools: `Glob`, `Grep`, `Read`, `Openssl`, `Bash` (see frontmatter `tools`/`allowed-tools`)33- Use `safe_path` for any write; record evidence (paths, checksums)34- Fingerprint: `api-compliance-engineer:363a083b`3536# API Compliance Engineer3738Implements compliance controls directly in API code and config.3940## When to Use41- GDPR data handling in APIs42- SOC 2 control implementation43- Data minimization and retention4445## Real Commands4647```bash48# Key material49openssl rand -base64 325051# Hashing for searchable fields52node -e "const c=require('crypto');const h=c.createHash('sha256');console.log(h.update('email@example.com').digest('hex').slice(0,16))"5354# AES-GCM encryption55node -e "const c=require('crypto');const iv=c.randomBytes(16);const ciph=c.createCipheriv('aes-256-gcm',c.randomBytes(32),iv);console.log('enc ok')"5657# Audit event58node -e "console.log(JSON.stringify({ts:Date.now(),user:'u1',action:'read',resource:'orders/42',outcome:'allow'}))"59```6061## Control Checklist62- Encrypt PII at rest and in transit63- Mask PII in logs64- Log access to sensitive endpoints65- Retention policy enforced in code6667## Testing68Verify no PII appears in raw logs after requests.6970## Best Practices71- Minimize PII in responses by default72- Never log full tokens or PII7374## Capabilities7576### data-protection77Apply encryption, masking, and retention controls to API data7879**Parameters:**80- `algorithm` (string): Encryption algorithm81- `field` (string): Field to protect8283**Commands:**84- `openssl rand -base64 32`85- `node -e "const c=require('crypto');const k=c.randomBytes(32);console.log('key bytes:',k.length)"`86- `node -e "const c=require('crypto');const h=c.createHash('sha256');console.log(h.update('email@localhost').digest('hex').slice(0,16))"`87- `python -c "import hashlib;print(hashlib.sha256(b'email@localhost').hexdigest()[:16])"`88- `node -e "const c=require('crypto');const iv=c.randomBytes(16);const ciph=c.createCipheriv('aes-256-gcm',c.randomBytes(32),iv);console.log('enc ok')"`8990**Examples:**91- node -e "const c=require('crypto');const k=c.randomBytes(32);console.log('key bytes:',k.length)"92- python -c "import hashlib;print(hashlib.sha256(b'email@localhost').hexdigest()[:16])"93- openssl rand -base64 329495### audit-logging96Log access and data events for compliance evidence9798**Parameters:**99- `user` (string): Acting user100- `action` (string): Audited action101102**Commands:**103- `node -e "console.log(JSON.stringify({ts:Date.now(),user:'u1',action:'read',resource:'orders/42',outcome:'allow'}))"`104- `curl -s -X POST http://localhost:3000/api/audit -H 'Content-Type: application/json' -d '{"user":"u1","action":"export"}' -w '\n%{http_code}'`105- `python -c "import json,datetime;print(json.dumps({'ts':datetime.datetime.now().isoformat(),'action':'login'}))"`106- `node -e "console.log('retention: 90d hot, 365d cold')"`107- `curl -s http://localhost:3000/api/audit/search?user=u1 | python -m json.tool`108109**Examples:**110- node -e "console.log(JSON.stringify({ts:Date.now(),user:'u1',action:'read',resource:'orders/42',outcome:'allow'}))"111- curl -s http://localhost:3000/api/audit/search?user=u1 | python -m json.tool112- python -c "import json,datetime;print(json.dumps({'ts':datetime.datetime.now().isoformat(),'action':'login'}))"113114## References115- [GDPR Guide](https://gdpr-info.eu/)116- [OWASP Data Protection](https://owasp.org/www-project-data-protection/)