Repository navigation
Conversation
The trading role held every privilege on every operations table, operator credentials and sessions included. Grant only the outbox, receipt and audit-append access its worker SQL executes.
Open
4 tasks done
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.
Related: Idea2Strategy/Idea2Strategy-trading-engine#161 vendors the generated grants and runs the worker e2e tests under this role.
What and why
DatabaseAccessPolicy.allowsTradinggaveidea2strategy_tradingSELECT, INSERT, UPDATE and DELETE on everyoperationstable, operator credentials, sessions, RBAC and cases included.operationslives inapps/trading-workerand touches three tables. The role now gets exactly that: SELECT and INSERT onoutbox_messages, SELECT, INSERT and UPDATE onoutbox_consumer_receipts, and INSERT onaudit_events. Nothing deletes a receipt or rewrites an outbox row.on conflict (idempotency_key) do nothing, and PostgreSQL requires SELECT on the arbiter column. A new column-level grant gives SELECT onaudit_events.idempotency_keyonly, instead of the whole audit trail. The existing table-level REVOKE still resets it on every run.Verified
./gradlew :db-migration:test --rerun --no-daemon --no-build-cachewith Docker (colima): 41 tests, 0 skipped or failed.CentralFlywayIntegrationTestruns the worker's statement shapes asidea2strategy_tradingand asserts that nine others, such as readingoperator_login_credentialsor deleting a receipt, fail with 42501../gradlew check --rerun-tasks --no-daemon --no-build-cache, thencheck --continue: 1056 tests, 1 skipped, 2 failed. Both failures are inAccountClosurePersistenceIntegrationTest(account_legal_hold_release_after_apply), which depends on the current date and is fixed by test(account): pin legal hold applied_at #294; with test(account): pin legal hold applied_at #294's test file applied, all 17 tests in that class pass on this branch.:db-migration:run. Against trading-engine feat: filter sanctioned leaderboard owners #160, everyV*.sqlfile is byte-identical andR__database_runtime_grants.sqldiffers only in the tradingoperationsgrants.Checklist
operationsDatabaseAccessPolicyTestdb/flyway-ci-bundlerefresh is listed as a follow-up after merge