rotate: 4 SaaS-token/app-signing drivers + data-separated proof tracking
Add gitlab, cloudflare, ghactions (MOCK-ONLY) and appsecret (LIVE-VM) one-file Rotators, each with a table-driven cutover-proof + leak-check test. gitlab/ cloudflare/ghactions are in-place SaaS-token rolls (self/rotate, value-roll, sealed-secret overwrite) so RevokeOld is a no-op; ghactions seals via nacl/box.SealAnonymous (no new go.mod dep). appsecret regenerates a local app signing secret and rewrites it in place across every target file (atomic, mode- preserving, redacted errors), discoverable via exact-match app-signing key names in env.go. Keep real-rotation code distinct from mock code: how each driver's cutover was validated lives as DATA in internal/rotate/proofs.go (single source of truth) + docs/ROTATION-PROOFS.md, surfaced as a PROOF column in `incredigo rotate` so a MOCK-ONLY driver can never be mistaken for a LIVE-VM one. appsecret proven LIVE-VM against real local files in the sandbox VM. 82 tests green, -race clean on rotate/sink/vault. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -59,8 +59,18 @@ func (e *envScanner) Scan(ctx context.Context, v *vault.Vault) ([]Credential, er
|
||||
// regardless of the secret-ish heuristic: a weak/empty DB password is
|
||||
// exactly the kind of leak we must not miss.
|
||||
source, kind := e.Name(), Kind(KindToken)
|
||||
secretBlob := val
|
||||
if dbSrc := dbSourceForURL(val); dbSrc != "" {
|
||||
source, kind = dbSrc, KindPassword
|
||||
} else if appSigningKey(k) && len(val) >= 12 {
|
||||
// An app SIGNING secret (Django SECRET_KEY, Rails secret_key_base, a
|
||||
// JWT signing secret, …) lives in this very file; tag it Source=
|
||||
// "appsecret" with a self-contained blob carrying the value AND its
|
||||
// file path so the local in-place rotator is driver-ready.
|
||||
source = "appsecret"
|
||||
secretBlob = "appsecret://local/?" + url.Values{
|
||||
"key": {k}, "val": {val}, "path": {p},
|
||||
}.Encode()
|
||||
} else if !looksSecret(k, val) {
|
||||
continue
|
||||
}
|
||||
@@ -70,7 +80,7 @@ func (e *envScanner) Scan(ctx context.Context, v *vault.Vault) ([]Credential, er
|
||||
Identity: filepath.Base(p) + " / " + k,
|
||||
Location: p,
|
||||
Modified: fi.ModTime(),
|
||||
Secret: v.Store([]byte(val)),
|
||||
Secret: v.Store([]byte(secretBlob)),
|
||||
})
|
||||
}
|
||||
f.Close()
|
||||
@@ -104,6 +114,24 @@ func dbSourceForURL(val string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// appSigningKeys are the env-var names that denote a local application SIGNING secret
|
||||
// — the kind the appsecret rotator can regenerate in place. Matched case-insensitively
|
||||
// and exactly (so STRIPE_API_KEY / DB_PASSWORD stay generic env secrets, not appsecrets).
|
||||
var appSigningKeys = map[string]bool{
|
||||
"secret_key": true, // Django / Flask
|
||||
"secret_key_base": true, // Rails
|
||||
"django_secret_key": true,
|
||||
"flask_secret_key": true,
|
||||
"app_key": true, // Laravel
|
||||
"app_secret": true,
|
||||
"jwt_secret": true,
|
||||
"session_secret": true,
|
||||
"nextauth_secret": true,
|
||||
"rails_secret": true,
|
||||
}
|
||||
|
||||
func appSigningKey(key string) bool { return appSigningKeys[strings.ToLower(key)] }
|
||||
|
||||
func looksSecret(key, val string) bool {
|
||||
lk := strings.ToLower(key)
|
||||
for _, h := range sensitiveHints {
|
||||
|
||||
Reference in New Issue
Block a user