Repository navigation
Conversation
Two follow-ups from the #641 review. The WordPress mail relay accepts an optional FOXSCHEMA_MAIL_SECRET and then refuses /verify-email and /account-email without a matching X-Foxschema-Mail-Secret header, but the server never sent one, so defining it broke every verification, reset and invite email with 403. FOX_MAIL_SECRET now sends it, like SIGNUP_WEBHOOK_SECRET does for the signup webhook. Documented in DEPLOYMENT.md and .env.example. The troubleshoot "Fox blocked an unsafe operation" hint matched any "is not allowed" or "not authorized", so "Method is not allowed" or a database "user not authorized" pointed at the workflow sandbox. It now matches only the engine's own refusals: "HTTP request refused", the file-root message, and SQLite's authorizer "not authorized" as a whole message or the end of a "…: not authorized" one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: f22b1e36-91f9-4f31-904f-ff07b18f16e6) |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two follow-ups from the review of #641.
1. Mail-relay secret with no sender
packaging/wordpress/foxschema-mail.phpaccepts an optionaldefine('FOXSCHEMA_MAIL_SECRET', …). When it is set,/verify-emailand/account-emailrefuse requests that lack a matchingX-Foxschema-Mail-Secretheader. The Fox server never sent that header, so defining the secret made every verification, reset and invite email fail with403.packages/server/src/platform/identity/auth-mail.ts: newmailServiceHeaders(). WhenFOX_MAIL_SECRETis set, it addsX-Foxschema-Mail-Secretto both relay calls (verification codes, and reset/invite codes). This works the same way asSIGNUP_WEBHOOK_SECRET→X-Foxschema-Signup-Secret.SIGNUP_WEBHOOK_SECRETindocs/guides/DEPLOYMENT.md, with a paragraph in the "Fox mail service" section. Also added to.env.exampleand to the PHP file's header comment.A shared secret only helps self-hosted relays. Every public install talks to the foxschema.com relay, so that relay cannot require a secret: anyone running Fox would need it. Set
FOXSCHEMA_MAIL_SECRETonly on a relay you host yourself, and setFOX_MAIL_SECRETto the same value on your installs. The live foxschema.com relay runs as a Code Snippets copy and does not define it, so nothing changes in production.2. Over-broad troubleshoot hint
The
sandboxrule inapps/web/src/frontend/features/workflow/lib/troubleshoot.tsmatched anyis not allowedornot authorized. Ordinary errors like "Method is not allowed" or a database "user … is not authorized" therefore got "Fox blocked an unsafe operation". The rule now matches only the engine's own refusals:HTTP request refused(both the protocol and the private-address messages inhttp-target.ts)outside the workflow files(file-root)not authorized(checked on Node 24). It matches as the whole message or the end of a…: not authorizedone, never mid-sentence.disabled for security/Refusing to open/not allowed in workflowsTests
auth-mail.test.ts: the header goes out on verification, invite and reset sends whenFOX_MAIL_SECRETis set, and is absent by default.troubleshoot.test.ts: new positive cases (private-address refusal, bare and prefixednot authorized, ATTACH disabled), plus negative cases: "Method is not allowed", "Request failed with status 405: Method Not Allowed", a Postgresuser "fox" is not authorized…, "User not authorized to perform: dynamodb:Scan", and the origin-policy message.A/B: with the source changes reverted and the new tests kept, 6 tests fail (1 auth-mail, 5 troubleshoot). With the changes, all pass.
npm run verifypasses locally on Node 24, except gitleaks, which is not installed here.🤖 Generated with Claude Code
Note
Low Risk
Targeted auth-mail header wiring and UI hint-regex tightening; no change to default public relay behavior when
FOX_MAIL_SECRETis unset.Overview
Adds
FOX_MAIL_SECRETsupport so Fox can authenticate to a self-hosted mail relay. NewmailServiceHeaders()inauth-mail.tsattachesX-Foxschema-Mail-Secreton verification, reset, and invite calls when the env var is set—matchingFOXSCHEMA_MAIL_SECRETon the WordPress relay, which previously returned 403 because the server never sent the header..env.example,DEPLOYMENT.md, and the PHP snippet header document that the public foxschema.com relay must stay secretless.Narrows the workflow
sandboxtroubleshoot rule so routine errors (e.g. HTTP 405 “Method is not allowed”, Postgres/DynamoDB “not authorized”, origin-policy text) no longer surface “Fox blocked an unsafe operation”. The matcher now targets engine refusals such asHTTP request refused, file-outside-workflow paths, and SQLite authorizernot authorized(whole message or…: not authorizedsuffix), with expanded unit tests for positive and negative cases.Reviewed by Cursor Bugbot for commit fce3c89. Bugbot is set up for automated code reviews on this repo. Configure here.