Skip to content

Joaom/improve auth - #79

Merged
jmoraispk merged 18 commits into
mainfrom
joaom/improve_auth
Mar 7, 2026
Merged

Joaom/improve auth#79
jmoraispk merged 18 commits into
mainfrom
joaom/improve_auth

Conversation

@jmoraispk

@jmoraispk jmoraispk commented Mar 7, 2026

Copy link
Copy Markdown
Owner

Note

High Risk
Touches security- and availability-critical paths (phone verification, allow-list enforcement, and live mutation of openclaw.json) and introduces background cleanup + message interception logic that could incorrectly allow/deny messaging if buggy.

Overview
Updates the LogLife plugin onboarding model to generate an LF-XXXX link code during /loglife/register, persist pending links to disk, intercept WhatsApp inbound messages to complete verification, and expose a new /loglife/verify/status poll endpoint for the website.

Adds user lifecycle management endpoints: POST /loglife/unregister (including all:true) and GET /loglife/users, and changes runtime config application to write merged generated config directly into openclaw.json (including cleanup of stale channel allow-list fields) instead of touching the file timestamp.

Updates the website to use the new flow (register → send WhatsApp message → poll status), adds /api/verify/status and /api/unregister proxy routes, and disconnect now also unregisters the phone from the gateway. Docs/navigation are refreshed (new AI rules page, API reference for new endpoints, revised onboarding/security model), DM policies default to allowlist, and new helper scripts are added for local gateway restart and user monitoring/unregistering.

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

…utdated related guides for improved clarity and user experience.
Add /loglife/unregister and /loglife/users routes, plus tests and a helper script for removing users during onboarding tests. Update API/development docs to reflect V1 register-first flow and provide clear monitoring/removal steps.

Made-with: Cursor
Add a reusable script to restart local OpenClaw after plugin code changes and document it in the development workflow.

Made-with: Cursor
Add auto-linking with LF-#### codes, dashboard polling via /api/verify/status, and hook-based verification in the plugin. Improve local ops with restart/list/unregister scripts, including unregister --all and phone input normalization without requiring a plus sign.

Made-with: Cursor
Simplify step-two WhatsApp verification UI to a clear three-element flow (instruction, send button, waiting status). Add a background expiry sweep for pending links so unlinked numbers are automatically removed after timeout even if the user abandons the page.

Made-with: Cursor
Simplifies the link step into a single registered/code message plus one clear WhatsApp CTA, and adds a change-number action while waiting so users can quickly correct wrong numbers.
Persists pending-link state across restarts, strengthens code-message suppression, and runs cleanup during status/user checks so stale provisional registrations are removed reliably. Also adds a visible verification countdown so users can see exactly when a link expires.
Removes backend registration immediately on dashboard/account number changes, refines waiting-state UI text, and strengthens plugin reply suppression so code-linking only sends the intended welcome message.
Treats LF-#### as a control token so linking codes never trigger user-facing assistant replies, including web auto-reply paths. Also adds a minimal copy affordance for the generated linking code in the dashboard.
Removes brittle prompt/suppression logic from the plugin and relies on a single deterministic plugin-sent welcome when a pending LF code is verified, with updated onboarding wording for the first WhatsApp message.
@vercel

vercel Bot commented Mar 7, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
loglife Ready Ready Preview, Comment Mar 7, 2026 11:07pm

@jmoraispk
jmoraispk merged commit 21d56e1 into main Mar 7, 2026
6 checks passed
@jmoraispk
jmoraispk deleted the joaom/improve_auth branch March 7, 2026 23:09

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 2 potential issues.

Bugbot Free Tier Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

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

Comment thread plugin/index.ts

if (verified) {
verifiedPhones.delete(phone);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verified state permanently lost if Clerk update fails

High Severity

The /loglife/verify/status plugin endpoint deletes the phone from verifiedPhones immediately after reading its value. The server-side route in verify/status/route.ts then attempts a Clerk metadata update after the plugin has already consumed the one-shot state. If the Clerk updateUser call fails (network blip, rate limit, etc.), the catch block returns a 502 to the client, but the plugin has already deleted the verified state. Subsequent polls return verified: false, permanently losing the verification. The user must restart the entire linking flow.

Additional Locations (1)

Fix in Cursor Fix in Web


const whatsappPhone = (user?.unsafeMetadata as Record<string, string> | undefined)?.whatsappPhone || "";
const waTarget = normalizeWaMeTarget(process.env.NEXT_PUBLIC_LOGLIFE_WHATSAPP_NUMBER);
const fullPhone = `${countryCode}${phoneLocal}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Register button enabled without entering phone number

Low Severity

fullPhone is computed as `${countryCode}${phoneLocal}` where countryCode defaults to "1" and phoneLocal defaults to "". So fullPhone is "1" on mount. The submit button's disabled check (!fullPhone.trim()) passes because "1" is truthy, allowing the user to submit with only a country code and no actual phone number. The plugin rejects it with a 400 (phone too short), but the button shouldn't be clickable in this state.

Additional Locations (1)

Fix in Cursor Fix in Web

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.

1 participant