fix(db): use random per-encryption salt in crypto.ts (GRO-453) #223

Merged
groombook-engineer[bot] merged 2 commits from fix/gro-453-random-salt-crypto into main 2026-04-04 14:06:14 +00:00
groombook-engineer[bot] commented 2026-04-04 13:14:44 +00:00 (Migrated from github.com)

Summary

  • Replaced hardcoded scrypt salt "groombook-auth-provider-config" with a random 16-byte salt generated per encryptSecret() call
  • Output format changed from iv:ciphertext:authTagsalt:iv:ciphertext:authTag (4 base64 parts)
  • decryptSecret() handles both new (4 parts, random salt) and legacy (3 parts, fixed salt) formats for backward compatibility with existing encrypted rows

Test plan

  • All 239 API tests pass including 9 crypto tests
  • Existing auth flow (DB-backed OIDC config) still works via legacy decryption path
  • New encryptions use unique salts — same plaintext no longer produces identical ciphertext

cc @cpfarhood

🤖 Generated with Claude Code

## Summary - Replaced hardcoded scrypt salt `"groombook-auth-provider-config"` with a random 16-byte salt generated per `encryptSecret()` call - Output format changed from `iv:ciphertext:authTag` → `salt:iv:ciphertext:authTag` (4 base64 parts) - `decryptSecret()` handles both new (4 parts, random salt) and legacy (3 parts, fixed salt) formats for backward compatibility with existing encrypted rows ## Test plan - [x] All 239 API tests pass including 9 crypto tests - [x] Existing auth flow (DB-backed OIDC config) still works via legacy decryption path - [x] New encryptions use unique salts — same plaintext no longer produces identical ciphertext cc @cpfarhood 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-04-04 13:21:02 +00:00 (Migrated from github.com)

Deployed to groombook-dev

Images: pr-223
URL: https://dev.groombook.farh.net

Ready for UAT validation.

## Deployed to groombook-dev **Images:** `pr-223` **URL:** https://dev.groombook.farh.net Ready for UAT validation.
lint-roller-qa[bot] (Migrated from github.com) approved these changes 2026-04-04 13:57:48 +00:00
lint-roller-qa[bot] (Migrated from github.com) left a comment

LGTM. All CI checks pass. Implementation uses random per-encryption salt, maintains backward compatibility with legacy 3-part format, and tests are updated accordingly.

LGTM. All CI checks pass. Implementation uses random per-encryption salt, maintains backward compatibility with legacy 3-part format, and tests are updated accordingly.
the-dogfather-cto[bot] (Migrated from github.com) approved these changes 2026-04-04 14:00:06 +00:00
the-dogfather-cto[bot] (Migrated from github.com) left a comment

CTO Review — Approved

Clean, correct fix for the fixed-salt security finding (GRO-453):

  • Random 16-byte salt per encryptSecret() call — eliminates ciphertext pattern analysis
  • Backward-compatible decryptSecret() handles both 4-part (new) and 3-part (legacy) formats
  • Module-level LEGACY_PACKAGE_SALT constant keeps the legacy path efficient
  • Tests updated to match new format

All CI checks pass. QA approved. Merging after branch update CI completes.

**CTO Review — Approved** Clean, correct fix for the fixed-salt security finding (GRO-453): - Random 16-byte salt per `encryptSecret()` call — eliminates ciphertext pattern analysis - Backward-compatible `decryptSecret()` handles both 4-part (new) and 3-part (legacy) formats - Module-level `LEGACY_PACKAGE_SALT` constant keeps the legacy path efficient - Tests updated to match new format All CI checks pass. QA approved. Merging after branch update CI completes.
github-actions[bot] commented 2026-04-04 14:04:52 +00:00 (Migrated from github.com)

Deployed to groombook-dev

Images: pr-223
URL: https://dev.groombook.farh.net

Ready for UAT validation.

## Deployed to groombook-dev **Images:** `pr-223` **URL:** https://dev.groombook.farh.net Ready for UAT validation.
This repo is archived. You cannot comment on pull requests.