feat(db): add user_github_app_tokens schema and migration#3168
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge ✅ All issues resolved
Files Reviewed (14 files)
Reviewed by claude-sonnet-4.6 · 270,128 tokens |
|
Refinery code review: changes requested The schema and migration look correct, and the token redaction is a good addition. However, there's a required GDPR compliance issue that must be addressed before this can land. IssueThe new table stores PII (, , ). Per the project's GDPR rules (see ), any new table or column containing PII must be handled in the flow. anonymizes the row rather than deleting it, so the FK on will not fire. The token row (including login, email, and user ID) would remain in the database after a user requests deletion. Required changes
|
|
Refinery code review: changes requested The schema and migration look correct, and the token redaction is a good addition. However, there's a required GDPR compliance issue that must be addressed before this can land. IssueThe new
Required changes
|
6f1c9d6
into
convoy/mvp-commit-as-user-via-github-app-user-t/db234b74/head
* feat(db): add user_github_app_tokens table with enums and migration * chore(env): plumb USER_GH_APP_TOKEN_ENCRYPTION_KEY across web and git-token-service * feat(worker-utils): add redactGitHubTokens for ghu_/ghr_ patterns * fix: address PR review - GDPR soft-delete gap and encryption key in vars * fix: use correct column name github_app_type in test --------- Co-authored-by: Toast (gastown) <Toast@gastown.local>
* feat(db): add user_github_app_tokens table with enums and migration * chore(env): plumb USER_GH_APP_TOKEN_ENCRYPTION_KEY across web and git-token-service * feat(worker-utils): add redactGitHubTokens for ghu_/ghr_ patterns * fix: address PR review - GDPR soft-delete gap and encryption key in vars * fix: use correct column name github_app_type in test --------- Co-authored-by: Toast (gastown) <Toast@gastown.local>
* feat(db): add user_github_app_tokens table with enums and migration * chore(env): plumb USER_GH_APP_TOKEN_ENCRYPTION_KEY across web and git-token-service * feat(worker-utils): add redactGitHubTokens for ghu_/ghr_ patterns * fix: address PR review - GDPR soft-delete gap and encryption key in vars * fix: use correct column name github_app_type in test --------- Co-authored-by: Toast (gastown) <Toast@gastown.local>
* feat(db): add user_github_app_tokens table with enums and migration * chore(env): plumb USER_GH_APP_TOKEN_ENCRYPTION_KEY across web and git-token-service * feat(worker-utils): add redactGitHubTokens for ghu_/ghr_ patterns * fix: address PR review - GDPR soft-delete gap and encryption key in vars * fix: use correct column name github_app_type in test --------- Co-authored-by: Toast (gastown) <Toast@gastown.local>
* feat(db): add user_github_app_tokens table with enums and migration * chore(env): plumb USER_GH_APP_TOKEN_ENCRYPTION_KEY across web and git-token-service * feat(worker-utils): add redactGitHubTokens for ghu_/ghr_ patterns * fix: address PR review - GDPR soft-delete gap and encryption key in vars * fix: use correct column name github_app_type in test --------- Co-authored-by: Toast (gastown) <Toast@gastown.local>
* feat(db): add user_github_app_tokens table with enums and migration * chore(env): plumb USER_GH_APP_TOKEN_ENCRYPTION_KEY across web and git-token-service * feat(worker-utils): add redactGitHubTokens for ghu_/ghr_ patterns * fix: address PR review - GDPR soft-delete gap and encryption key in vars * fix: use correct column name github_app_type in test --------- Co-authored-by: Toast (gastown) <Toast@gastown.local>
* feat(db): add user_github_app_tokens table with enums and migration * chore(env): plumb USER_GH_APP_TOKEN_ENCRYPTION_KEY across web and git-token-service * feat(worker-utils): add redactGitHubTokens for ghu_/ghr_ patterns * fix: address PR review - GDPR soft-delete gap and encryption key in vars * fix: use correct column name github_app_type in test --------- Co-authored-by: Toast (gastown) <Toast@gastown.local>
Summary
Add the
user_github_app_tokenstable to support GitHub App user-to-server tokens for commit attribution (MVP-1). This is the schema-only bead; refresh logic and GDPR extensions are explicitly deferred to v2.What changed:
user_github_app_tokenstable inpackages/db/src/schema.tswith:pgEnumtypes:github_app_type(standard|lite) andrevocation_reason(user_revoked|refresh_failed|admin)(kilo_user_id, github_app_type)with a unique indexgithub_user_id,github_login,github_email), encrypted access token, expiry, revocation state, and timestampskilocode_users.idwithonDelete: cascadegithub_user_idpnpm drizzle generate(0124_past_domino.sql)USER_GH_APP_TOKEN_ENCRYPTION_KEYplumbed into:apps/webserver config and.env.development.local.exampleservices/git-token-servicewrangler.jsoncvars and.dev.vars.exampleghu_andghr_tokens added to@kilocode/worker-utils/redact-headerswith unit testsVerification
pnpm drizzle generateproduced a clean migration with no checksum errors@kilocode/worker-utilsunit tests pass (119 tests, including newredactGitHubTokenscoverage)Visual Changes
N/A
Reviewer Notes
Explicitly deferred to v2 (known gaps documented per plan)
refresh_token_encrypted,refresh_token_expires_at) and refresh logicsoftDeleteUserGDPR extension foruser_github_app_tokensrowsENABLE_GITHUB_USER_TOKENS, MVP-3) will be set tofalseuntil GDPR work lands.github_app_authorizationrevocation eventsOther notes
USER_DEPLOYMENTS_GIT_TOKEN_ENCRYPTION_KEY; a dedicated key is required per the encryption boundary spec