feat(migration): encrypted credential vault for source-PMS tokens (TEL-70) - #296
Merged
Merged
Conversation
…L-70) Add AES-256-GCM app-level encryption for per-property source-PMS migration credentials with key-rotation support via encryption_key_id. - migration_source_credentials table (property-scoped, unique per source PMS) - MigrationSourceCredentialsService with encrypt/decrypt/upsert/delete APIs - HTTP endpoints return metadata only; decryptForRunner is server-side only - Audit logs and API responses never include plaintext secrets or ciphertext - Tests cover round-trip, wrong-key failure, and GCM tamper detection Co-authored-by: telivity-otaip <telivity-otaip@users.noreply.github.com>
telivity-otaip
marked this pull request as ready for review
August 11, 2026 00:55
Co-authored-by: telivity-otaip <telivity-otaip@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements an encrypted at-rest credential vault for tier-1 source-PMS migration connectors (Mews, Cloudbeds, Apaleo, OHIP). Unlike
channel_connections.config, credentials are AES-256-GCM encrypted before persistence.Changes
apps/api/src/common/crypto/credential-encryption.ts): AES-256-GCM encrypt/decrypt keyed byMIGRATION_CREDENTIAL_ENCRYPTION_KEY, with rotation seam viaencryption_key_idand optionalMIGRATION_CREDENTIAL_ENCRYPTION_KEYSJSON mapmigration_source_credentialstable —property_id,source_pms,ciphertext,encryption_key_id, audit timestamps; unique per property + source PMSMigrationSourceCredentialsService):upsert,listMetadata,decryptForRunner(server-side only),delete(per-source or all-for-property)/api/v1/migration/credentials): metadata-only responses; no endpoint returns decrypted secretsDELETE /migration/credentials/:sourcePmsandDELETE /migration/credentialsfor migration completion / GDPR erasureAcceptance criteria
Env vars (
.env.example)Testing
pnpm build DATABASE_URL=postgresql://haip:haip@localhost:5432/haip_test pnpm db:migrate pnpm --filter @telivityhaip/api test -- migration pnpm --filter @telivityhaip/api vitest run src/common/crypto/credential-encryption.spec.tsCloses TEL-70
Linear Issue: TEL-70