Skip to content

feat: oauth flow audit#2433

Open
lwin-kyaw wants to merge 2 commits intomasterfrom
feat/oauth-login-tracking
Open

feat: oauth flow audit#2433
lwin-kyaw wants to merge 2 commits intomasterfrom
feat/oauth-login-tracking

Conversation

@lwin-kyaw
Copy link
Copy Markdown
Contributor

@lwin-kyaw lwin-kyaw commented Apr 1, 2026

Jira Link

https://consensyssoftware.atlassian.net/browse/EMBED-242?atlOrigin=eyJpIjoiNmZkYTgxMWNjZGUyNGY3M2E0YTU1ZWNiZjhkOWY1YTEiLCJwIjoiaiJ9

Description

  • The social OAuth flow in AuthConnector.connectWithSocialLogin() now adds audit metadata onto loginParams before login starts.
  • Each login attempt now gets:
    • recordId: generateRecordId()
    • loginSource: "web3auth-web"
  • A new helper method, auditOAuditProgress(...), was added to report OAuth progress to the audit endpoint.

New audit reporting behavior

  • An audit call is fired at the start of the social login flow to mark oauthInitiated: true.
  • An audit call is fired when the SecurePubSub subscription path errors to mark oauthFailed: true.
  • An audit call is fired when postLoginInitiatedMessage(...) rejects to mark oauthFailed: true.

How has this been tested?

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the code style of this project. (run lint)
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Note

Medium Risk
Touches login flow behavior by adding new network calls and identifiers during OAuth; failures are mostly swallowed, but misconfiguration or endpoint issues could affect login UX or add latency.

Overview
Adds OAuth flow auditing in @web3auth/no-modal by generating a recordId/loginSource for social logins and sending PUT updates to Citadel (/v1/auth/audit) on OAuth initiation and failure paths.

Updates the repo and demo app to consume @web3auth/auth 11.4.3 from a local tarball (and bumps related Torus deps), with corresponding lockfile churn and .gitignore updates (ignore .npmrc, normalize build/).

Written by Cursor Bugbot for commit 856390b. This will update automatically on new commits. Configure here.

@lwin-kyaw lwin-kyaw requested review from a team as code owners April 1, 2026 11:06
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web3auth-web Error Error Apr 1, 2026 11:06am

Request Review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

yalc.lock
types
build/ No newline at end of file
build/
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing gitignore exception for auth tgz file

High Severity

The .gitignore has *.tgz on line 66 with an exception only for !web3auth-ws-embed-*.tgz on line 67, but no exception for web3auth-auth-*.tgz. Since this PR adds file:web3auth-auth-11.4.3.tgz references across multiple package.json files (root, packages/modal, packages/no-modal, demo/vue-app-new), the referenced tgz file will be excluded from git. Other developers cloning the repo will fail on npm install.

Additional Locations (1)
Fix in Cursor Fix in Web

.catch((error: unknown) => {
// swallow the error, dont need to throw.
log.error("Error during login with social", error);
this.auditOAuditProgress(loginParams as LoginParams, "failed");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unhandled promise rejections on failed audit calls

Medium Severity

The auditOAuditProgress calls at these locations are fire-and-forget async calls without .catch(), unlike the initial call at line 541 which properly handles errors with .catch(). If the audit server is unreachable (likely during error scenarios), these will produce unhandled promise rejections.

Additional Locations (1)
Fix in Cursor Fix in Web

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to catch here error

oauthInitiated: true,
};
if (status === "failed") progressFlag.oauthFailed = true;
if (status === "completed") progressFlag.oauthCompleted = true;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Audit always sends oauthInitiated true even on failure

Medium Severity

The progressFlag object always initializes with oauthInitiated: true, so when status is "failed", the PUT request sends both oauthInitiated: true and oauthFailed: true. Since the initiation was already reported in a separate call, re-sending oauthInitiated: true alongside a failure report is likely unintended and could produce misleading audit data.

Fix in Cursor Fix in Web

"@toruslabs/base-controllers": "^9.4.1",
"@toruslabs/http-helpers": "^9.0.0",
"@web3auth/auth": "^11.4.2",
"@web3auth/auth": "file:../../web3auth-auth-11.4.3.tgz",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we would need to release auth sdk first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants