Repository navigation
feat(custody): Fireblocks BYOK #2455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cutbow7
wants to merge
15
commits into
main
Choose a base branch
from
codex/fireblocks-byok-minimal
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+10,102
−789
Open
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
7ec9470
feat(custody): add Fireblocks BYOK and native SOL/USDC payments
cutbow7 8972e06
feat(custody): reduce Fireblocks BYOK to connection and read-only checks
cutbow7 0200f7a
fix(custody): gate Fireblocks BYOK to beta and validate settlements
cutbow7 00f11f0
fix(custody): align Fireblocks BYOK with current authorization and cl…
cutbow7 dfa9958
fix(custody): address Fireblocks setup and managed-wallet review find…
cutbow7 3d1b21e
fix(custody): harden minimal Fireblocks BYOK after review
cutbow7 43bab6b
fix(custody): resolve Fireblocks follow-up review findings
cutbow7 24bcfd0
fix(payments): require verified Fireblocks settlement before confirma…
cutbow7 bec5256
fix(custody): verify every Fireblocks vault before credential replace…
cutbow7 3054721
fix(db): avoid Fireblocks migration number collision after rebase
cutbow7 1962497
fix(payments): reconcile Fireblocks transfers after connection deacti…
cutbow7 070b997
fix(fireblocks): recheck custody before transfer submission
cutbow7 4e4d6d7
fix(web): preserve payment polling after ramp rebase
cutbow7 25a32a8
fix(fireblocks): use scoped RPC and align with latest main
cutbow7 80dda1c
fix(fireblocks): address route and schema review findings
cutbow7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
28 changes: 28 additions & 0 deletions
28
apps/sdp-api/src/db/migrations/postgres/0160_fireblocks_csr_requests.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| -- Private RSA material exists here only during CSR onboarding. Once copied | ||
| -- into the credential lifecycle's secret store it is erased from this row. | ||
| CREATE TABLE fireblocks_csr_requests ( | ||
| id TEXT PRIMARY KEY, | ||
| status TEXT NOT NULL DEFAULT 'active' CHECK (status IN ('active', 'archived')), | ||
| organization_id TEXT NOT NULL REFERENCES organizations(id) ON DELETE CASCADE, | ||
| project_id TEXT NOT NULL REFERENCES projects(id) ON DELETE CASCADE, | ||
| idempotency_key TEXT NOT NULL, | ||
| csr_pem TEXT NOT NULL, | ||
| encrypted_private_key TEXT, | ||
| claim_fingerprint TEXT, | ||
| created_by TEXT NOT NULL REFERENCES users(id), | ||
| created_at TEXT NOT NULL DEFAULT sdp_iso_now(), | ||
| expires_at TEXT NOT NULL, | ||
| consumed_at TEXT, | ||
| UNIQUE (organization_id, project_id, idempotency_key), | ||
| CHECK (consumed_at IS NULL OR encrypted_private_key IS NULL) | ||
| ); | ||
| CREATE INDEX idx_fireblocks_csr_pending | ||
| ON fireblocks_csr_requests (organization_id, project_id, created_at DESC) | ||
| WHERE encrypted_private_key IS NOT NULL; | ||
| CREATE INDEX idx_fireblocks_csr_expiry ON fireblocks_csr_requests (expires_at) | ||
| WHERE encrypted_private_key IS NOT NULL; | ||
| ALTER TABLE fireblocks_csr_requests ENABLE ROW LEVEL SECURITY; | ||
| ALTER TABLE fireblocks_csr_requests FORCE ROW LEVEL SECURITY; | ||
| CREATE POLICY sdp_tenant_isolation ON fireblocks_csr_requests | ||
| USING (sdp_tenant_isolation_allows(organization_id)) | ||
| WITH CHECK (sdp_tenant_isolation_allows(organization_id)); | ||
18 changes: 18 additions & 0 deletions
18
apps/sdp-api/src/db/migrations/postgres/0161_fireblocks_byok.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| -- Fireblocks uses the existing stored-credential lifecycle, including durable | ||
| -- GCP creation and container cleanup. Apply before deploying its BYOK runtime. | ||
| ALTER TABLE provider_credentials | ||
| DROP CONSTRAINT provider_credentials_creating_location_check, | ||
| ADD CONSTRAINT provider_credentials_creating_location_check CHECK ( | ||
| status <> 'creating' OR ( | ||
| provider IN ('privy', 'fireblocks') AND source = 'stored' | ||
| AND storage_backend = 'gcp_secret_manager' AND secret_ref IS NOT NULL | ||
| AND secret_version_ref IS NULL AND encrypted_secret_payload IS NULL | ||
| ) | ||
| ) NOT VALID, | ||
| DROP CONSTRAINT provider_credentials_scan_owner_check, | ||
| ADD CONSTRAINT provider_credentials_scan_owner_check CHECK ( | ||
| secret_next_scan_at IS NULL OR ( | ||
| provider IN ('privy', 'fireblocks') AND source = 'stored' | ||
| AND storage_backend = 'gcp_secret_manager' AND secret_ref IS NOT NULL | ||
| ) | ||
| ) NOT VALID; |
6 changes: 6 additions & 0 deletions
6
apps/sdp-api/src/db/migrations/postgres/0162_fireblocks_unfinished_index.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| -- sdp:migration-mode: non-transactional | ||
| -- Keep the Privy index for older revisions; build this without blocking wallet setup. | ||
| CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS idx_custody_connections_fireblocks_unfinished | ||
| ON custody_connections(organization_id, project_id, provider) | ||
| WHERE provider = 'fireblocks' AND project_id IS NOT NULL | ||
| AND status IN ('pending', 'checking'); |
2 changes: 2 additions & 0 deletions
2
apps/sdp-api/src/db/migrations/postgres/0163_fireblocks_credential_checks.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| ALTER TABLE provider_credentials VALIDATE CONSTRAINT provider_credentials_creating_location_check; | ||
| ALTER TABLE provider_credentials VALIDATE CONSTRAINT provider_credentials_scan_owner_check; |
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.