secrets-management
Use when storing credentials in OCI Vault, troubleshooting secret retrieval failures, implementing secret rotation, or setting up application authentication to Vault. Covers vault hierarchy confusion, IAM permission gotchas, cost optimization, temp file security, and audit logging.
What this skill does
# OCI Vault and Secrets Management - Expert Knowledge
## ๐๏ธ Use OCI Landing Zone Terraform Modules
**Don't reinvent the wheel.** Use [oracle-terraform-modules/landing-zone](https://github.com/oracle-terraform-modules/terraform-oci-landing-zones) for Vault setup.
**Landing Zone solves:**
- โ Bad Practice #1: Generic compartments (Landing Zone creates Security compartment for Vault)
- โ Bad Practice #7: No security services (Landing Zone integrates Cloud Guard monitoring)
- โ Bad Practice #10: No audit logging (Landing Zone enables Vault audit logs)
**This skill provides**: Vault operations, secret management patterns, and troubleshooting for vaults deployed WITHIN a Landing Zone.
---
## โ ๏ธ OCI CLI/API Knowledge Gap
**You don't know OCI CLI commands or OCI API structure.**
Your training data has limited and outdated knowledge of:
- OCI CLI syntax and parameters (updates monthly)
- OCI API endpoints and request/response formats
- Vault service CLI operations (`oci vault secret`, `oci kms`)
- Secret encoding formats and retrieval patterns
- Latest Vault/KMS features and cross-region replication
**When OCI operations are needed:**
1. Use exact CLI commands from this skill's references
2. Do NOT guess OCI Vault CLI syntax
3. Do NOT assume AWS Secrets Manager patterns work in OCI
4. Load reference files for detailed Vault API documentation
**What you DO know:**
- General secrets management principles
- Encryption and key management concepts
- Secret rotation patterns
This skill bridges the gap by providing current OCI-specific Vault patterns and gotchas.
---
You are an OCI Vault expert. This skill provides knowledge Claude lacks: anti-patterns, IAM permission gotchas, cost optimization, security vulnerabilities, and OCI-specific operational knowledge.
## NEVER Do This
โ **NEVER log secret contents (even in debug/error messages)**
```python
# WRONG - secret ends up in log aggregation, retained for years
logger.debug(f"Retrieved secret: {secret_value}")
logger.error(f"Failed to parse secret: {secret_value}")
# RIGHT - log metadata only
logger.debug(f"Retrieved secret OCID: {secret_ocid[:20]}...")
logger.error(f"Failed to parse secret (type: {type(secret_value)})")
```
โ **NEVER set temp key file permissions AFTER writing content**
```python
# WRONG - world-readable during write (security window)
with open('/tmp/key.pem', 'w') as f:
f.write(private_key)
os.chmod('/tmp/key.pem', 0o600) # Too late!
# RIGHT - secure BEFORE writing
fd = os.open('/tmp/key.pem', os.O_CREAT | os.O_WRONLY, 0o600)
with os.fdopen(fd, 'w') as f:
f.write(private_key)
```
โ **NEVER use overly broad IAM policies**
```
BAD: "Allow any-user to read secret-family in tenancy"
BAD: "Allow group Developers to manage secret-family in tenancy"
GOOD: "Allow dynamic-group app-prod to read secret-family in compartment AppSecrets
where target.secret.name = 'db-*'"
```
โ **NEVER retrieve secrets without caching**
- **Cost**: $0.03 per 10,000 requests (first 10k/month free)
- **Without cache**: 1000 req/hr ร 24 ร 30 = 720k/month = **$2.16/month**
- **With 60min cache**: 1000 req/hr โ 24 calls/day = 720/month = **FREE**
- **Savings**: 98% cost reduction
โ **NEVER use PLAIN content type (deprecated)**
- Always use BASE64 encoding for secrets
- PLAIN is legacy and may not work in future
โ **NEVER hardcode Vault OCIDs in code**
```python
# WRONG - not portable, leaked in repos
VAULT_SECRET_OCID = "ocid1.vaultsecret.oc1.iad.xxxxx"
# RIGHT - configuration
VAULT_SECRET_OCID = os.environ['VAULT_SECRET_OCID']
```
## IAM Permission Gotcha (Critical)
Secret retrieval requires **BOTH** permissions:
```
"Allow dynamic-group X to read secret-family in compartment Y"
"Allow dynamic-group X to use keys in compartment Y"
```
**Why both needed:**
- `read secret-family` โ allows listing and reading secret metadata
- `use keys` โ allows decryption of secret content (secrets encrypted with master key)
**Without `use keys`**: Get confusing 403 error: "User not authorized to perform this operation"
**Common mistake**: Forgetting `use keys` permission, spending hours debugging "authorization failed"
## Vault Hierarchy (Often Confused)
```
Vault (container)
โโ Master Encryption Key (for encryption/decryption)
โโ Secret (encrypted data)
โโ Secret Versions (rotation over time)
```
**Commands use different services:**
- Vault operations: `oci kms management vault ...`
- Key operations: `oci kms management key ... --endpoint <vault-endpoint>`
- Secret operations: `oci vault secret ...` (NOT kms!)
**Common mistake**: `oci vault-secret create` (no such command) vs `oci vault secret create` (correct)
## Secret Retrieval Error Decision Tree
```
Secret retrieval fails?
โ
โโ 401 Unauthorized
โ โโ On OCI compute? โ Check dynamic group membership
โ โโ Local dev? โ Check ~/.oci/config, verify API key uploaded
โ โโ After rotation? โ Cache still has old credentials (wait for TTL)
โ
โโ 403 Forbidden
โ โโ Have "read secret-family" permission? โ Add if missing
โ โโ Have "use keys" permission? โ THIS IS USUALLY THE ISSUE
โ
โโ 404 Not Found
โ โโ Wrong secret OCID? โ Verify environment variable
โ โโ Wrong compartment? โ Secrets client must use secret's compartment
โ โโ Secret deleted? โ Check vault for secret status
โ
โโ 500 Internal Server Error
โโ Vault service issue โ Retry with exponential backoff (rate limit)
```
## Cost Optimization
**Vault API Pricing:** $0.03 per 10,000 requests (10k/month free)
### Calculation Examples:
**Without caching** (retrieve on every API call):
- 1000 API calls/hour
- 24 hours ร 30 days = 720,000 Vault requests/month
- (720,000 / 10,000) ร $0.03 = **$2.16/month**
**With 60-minute cache TTL**:
- 1000 API calls/hour โ 1 Vault request/hour
- 24 hours ร 30 days = 720 Vault requests/month
- Under 10k free tier = **$0/month (FREE)**
- **Savings: 98%**
**Cache TTL Selection:**
| Security Requirements | Cache TTL | Reasoning |
|----------------------|-----------|-----------|
| High (rotate daily) | 5-15 minutes | Frequent refresh, still 90%+ savings |
| Standard (rotate monthly) | 30-60 minutes | Balance security and cost |
| Dev/Test | No cache | Always fresh for development |
**Rule**: Cache TTL must be **less than** secret rotation window
## Secret Rotation (Zero-Downtime)
**WRONG** (causes downtime):
```bash
# Don't delete and recreate - breaks running apps
oci vault secret delete --secret-id <secret-ocid>
oci vault secret create ... # New OCID, apps break
```
**RIGHT** (zero-downtime):
```bash
# Create new VERSION of existing secret
oci vault secret update-base64 \
--secret-id <secret-ocid> \
--secret-content-content "$(echo -n 'new-value' | base64)"
# Secret OCID stays same, apps automatically get new version
# Old version kept as "previous" for rollback
```
**Key points:**
- Secret OCID doesn't change (apps continue working)
- Vault serves latest version by default
- Previous versions retained for rollback
- Applications pick up new version on next cache refresh (no restart needed)
## Instance Principal Authentication
**Production compute instances should use instance principals:**
```bash
# 1. Create dynamic group
oci iam dynamic-group create \
--name "app-instances" \
--matching-rule "instance.compartment.id = '<compartment-ocid>'"
# 2. Grant Vault access
# "Allow dynamic-group app-instances to read secret-family in compartment Secrets"
# "Allow dynamic-group app-instances to use keys in compartment Secrets"
# 3. Application code (no credentials needed)
signer = oci.auth.signers.InstancePrincipalsSecurityTokenSigner()
secrets_client = oci.secrets.SecretsClient(config={}, signer=signer)
```
**Benefits:**
- No credentials to manage or rotate
- No secrets stored on compute instances
- Automatic token refresh
- Audit trail shows which instance accessed what
## Audit Logging
**Enable Vault access logging:**
```bash
# Create log group
oci logging log-group create \
--compartment-id <ocid> \
--display-nameRelated in Security
mac-ops
IncludedComprehensive macOS workstation operations โ diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.