Skip to content

feat(labs): The Farm experiment - #72

Closed
tacticalnoot wants to merge 1 commit into
kalepail:mainfrom
tacticalnoot:pr-the-farm
Closed

feat(labs): The Farm experiment#72
tacticalnoot wants to merge 1 commit into
kalepail:mainfrom
tacticalnoot:pr-the-farm

Conversation

@tacticalnoot

Copy link
Copy Markdown

Adds The Farm experiment and all fork additions to Smol Labs.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2dc9315a67

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +61 to +64
const session = await getSession(request, db);
if (!session) return new Response('Unauthorized', { status: 401 });

const roomId = params.id;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Enforce room access checks before message writes

This endpoint accepts any valid session token and immediately allows writes to whatever roomId is in the URL, but it never verifies that the caller is actually authorized for that room (the same omission exists in the GET handler). As a result, any authenticated user can post/read messages in locked rooms by calling this route directly, bypassing the gating logic exposed by /api/chat/rooms.

Useful? React with 👍 / 👎.

Comment on lines +25 to +27
const envSecret = import.meta.env.VIP_SERVER_SECRET as string | undefined;
if (envSecret) {
return Keypair.fromSecret(envSecret);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Read VIP server secret from runtime bindings

The VIP auth keypair is sourced only from import.meta.env, but in the Cloudflare runtime secrets are provided through runtime env bindings (as used elsewhere in this repo) rather than build-time import.meta.env. In production deployments where VIP_SERVER_SECRET is configured as a Worker secret, this code will still throw "VIP server secret is not configured," breaking challenge generation and verification.

Useful? React with 👍 / 👎.

const primaryRpId = getSafeRpId(hostname);

// Clear any stale credentials before logging in
clearUserAuth();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Await auth reset before starting a new login flow

clearUserAuth is now asynchronous and resets the PasskeyKit singleton after a dynamic import, but this call is not awaited here. That introduces a race where login can grab/connect a kit instance and then clearUserAuth finishes later and nulls the singleton, leaving auth state marked connected while subsequent transaction flows see a disconnected/new instance.

Useful? React with 👍 / 👎.

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