Added GitHub OAuth identity verification flow#549
Conversation
WalkthroughMigrates GitHub proof verification from gist-based parsing to an OAuth-based flow: removes the GithubProofParser and Changes
Sequence Diagram(s)sequenceDiagram
actor Client
participant Backend
participant "GitHub API" as GitHub
Client->>Backend: POST /exchangeGitHubOAuthCode { code }
activate Backend
Backend->>Backend: validate env vars (CLIENT_ID/SECRET)
rect rgb(200,220,255)
Note over Backend,GitHub: Token exchange
Backend->>GitHub: POST /login/oauth/access_token (code)
GitHub-->>Backend: { access_token }
end
rect rgb(220,255,220)
Note over Backend,GitHub: User fetch & attestation
Backend->>GitHub: GET /user (with token)
GitHub-->>Backend: { id, login, ... }
Backend->>Backend: create + sign GitHubOAuthAttestation
end
deactivate Backend
Backend-->>Client: { success: true, userId, username, signedAttestation } | { success: false, error }
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ⓘ Your approaching your monthly quota for Qodo. Upgrade your plan PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
ⓘ Your approaching your monthly quota for Qodo. Upgrade your plan PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
src/libs/identity/oauth/github.ts (1)
92-99: Add response structure validation.The code accesses
userData.idanduserData.loginwithout verifying these fields exist in the response. While GitHub's API is reliable, defensive programming suggests validating the response structure.🔎 Suggested validation before accessing properties
const userData: GitHubUser = await userResponse.json() + + // Validate required fields + if (!userData.id || !userData.login) { + log.error("[GitHub OAuth] Invalid user data received from GitHub") + return { + success: false, + error: "Invalid user data received from GitHub", + } + } log.info(`[GitHub OAuth] Successfully authenticated user: ${userData.login} (ID: ${userData.id})`)
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (7)
.env.examplepackage.jsonsrc/libs/abstraction/index.tssrc/libs/abstraction/web2/github.tssrc/libs/abstraction/web2/parsers.tssrc/libs/identity/oauth/github.tssrc/libs/network/manageNodeCall.ts
💤 Files with no reviewable changes (3)
- src/libs/abstraction/web2/parsers.ts
- src/libs/abstraction/web2/github.ts
- package.json
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-10T12:30:35.789Z
Learnt from: tcsenpai
Repo: kynesyslabs/node PR: 475
File: src/features/incentive/PointSystem.ts:711-727
Timestamp: 2025-10-10T12:30:35.789Z
Learning: In the TelegramSignedAttestation from kynesyslabs/demosdk (v2.4.18+), the `group_membership` field in the payload is a boolean, not an object. Check it as: `attestation?.payload?.group_membership === true`
Applied to files:
src/libs/abstraction/index.ts
🧬 Code graph analysis (2)
src/libs/identity/oauth/github.ts (2)
src/utilities/tui/CategorizedLogger.ts (1)
log(340-371)src/libs/peer/Peer.ts (1)
fetch(329-341)
src/libs/network/manageNodeCall.ts (1)
src/libs/identity/oauth/github.ts (1)
exchangeGitHubCode(29-108)
🔇 Additional comments (5)
.env.example (1)
10-11: LGTM! Environment variables properly added for GitHub OAuth.The addition of
GITHUB_CLIENT_IDandGITHUB_CLIENT_SECRETis necessary for the new OAuth flow and follows the existing configuration pattern.src/libs/network/manageNodeCall.ts (1)
28-28: LGTM! OAuth integration properly imported.The import of
exchangeGitHubCodeintegrates the new OAuth functionality into the node call handler.src/libs/abstraction/index.ts (1)
28-34: LGTM! Bot authorization check properly implemented.The
checkBotAuthorizationfunction correctly verifies bot addresses against genesis identities, ensuring only authorized bots can sign attestations.src/libs/identity/oauth/github.ts (2)
29-40: LGTM! Environment variable validation properly implemented.The function correctly checks for required OAuth credentials and returns an appropriate error if they're missing, preventing runtime failures.
101-107: Good error handling with proper logging.The catch block appropriately logs errors and returns a structured error response, making debugging easier while keeping the API contract consistent.
|
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
src/libs/abstraction/index.tssrc/libs/identity/oauth/github.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-10T12:30:35.789Z
Learnt from: tcsenpai
Repo: kynesyslabs/node PR: 475
File: src/features/incentive/PointSystem.ts:711-727
Timestamp: 2025-10-10T12:30:35.789Z
Learning: In the TelegramSignedAttestation from kynesyslabs/demosdk (v2.4.18+), the `group_membership` field in the payload is a boolean, not an object. Check it as: `attestation?.payload?.group_membership === true`
Applied to files:
src/libs/abstraction/index.ts
🧬 Code graph analysis (2)
src/libs/abstraction/index.ts (4)
src/libs/identity/oauth/github.ts (1)
SignedGitHubOAuthAttestation(29-33)src/libs/blockchain/transaction.ts (1)
hash(98-106)src/libs/crypto/hashing.ts (1)
Hashing(15-26)src/utilities/sharedState.ts (1)
getSharedState(266-268)
src/libs/identity/oauth/github.ts (3)
src/libs/blockchain/transaction.ts (1)
hash(98-106)src/libs/crypto/hashing.ts (1)
Hashing(15-26)src/utilities/sharedState.ts (1)
getSharedState(266-268)
🔇 Additional comments (1)
src/libs/abstraction/index.ts (1)
176-282: GitHub OAuth verification logic is sound.The attestation parsing and verification flow correctly:
- Handles both string and object proof formats
- Validates structure, provider, userId, and username
- Enforces attestation age limits (5 minutes)
- Verifies cryptographic signature
- Checks node authorization against genesis identities
Note: The JSON.stringify determinism issue applies here as well (line 233), but is already flagged in
src/libs/identity/oauth/github.ts.
Note on past review comment: The previous comment about OAuth proof parsing with
split(":")does not apply to this GitHub OAuth implementation, which uses structuredSignedGitHubOAuthAttestationobjects rather than colon-separated strings.



User description
Implemented OAuth-based GitHub identity linking to replace gist-based proofs:
The new flow:
Requires GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET in .env
PR Type
Enhancement
Description
Replaced gist-based GitHub proof verification with OAuth flow
Added exchangeGitHubCode() function for token exchange
Added exchangeGitHubOAuthCode endpoint in manageNodeCall
Removed GithubProofParser class and @octokit/core dependency
Updated verifyWeb2Proof to handle oauth:provider:userId format
Diagram Walkthrough
File Walkthrough
index.ts
Clean up imports and remove GitHub parsersrc/libs/abstraction/index.ts
toInteger, Chain, fs)
parsers.ts
Remove GitHub gist URL formatssrc/libs/abstraction/web2/parsers.ts
github.ts
Remove gist-based GitHub proof parsersrc/libs/abstraction/web2/github.ts
readData methods
github.ts
Add GitHub OAuth token exchange implementationsrc/libs/identity/oauth/github.ts
access token
manageNodeCall.ts
Add exchangeGitHubOAuthCode endpoint handlersrc/libs/network/manageNodeCall.ts
responses
codes
index.ts
Add OAuth proof verification logicsrc/libs/abstraction/index.ts
oauth:provider:userId)
.env.example
Add GitHub OAuth configuration variables.env.example
package.json
Remove @octokit/core dependencypackage.json
Summary by CodeRabbit
New Features
Refactor
Chores
✏️ Tip: You can customize this high-level summary in your review settings.