Skip to content

Fix static fast path and public trial preflight - #159

Merged
matveynator merged 3 commits into
mainfrom
fix/guest-static-fast-path-and-trial-preflight
Sep 27, 2026
Merged

matveynator merged 3 commits into
mainfrom
fix/guest-static-fast-path-and-trial-preflight

Conversation

@matveynator

Copy link
Copy Markdown
Owner

Summary

  • Skip database-backed alias and stealth lookups for guest static requests so published pages stay on the database-free fast path.
  • Let public trial endpoints reach their CORS preflight handler without the admin stealth check.

Validation

  • CGO_ENABLED=0 GOCACHE=/private/tmp/sitebrush-gocache go test . -run '^(TestPublicTrialEndpointsAllowCredentialFreeCrossOriginEmbedding|TestGuestStaticRouteServesPublishedFileWithoutDatabase|TestGuestStaticAnalyticsAvoidsDatabaseAndEnqueuesEvent)$' -count=1
  • git diff --check

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@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: 7013468f65

ℹ️ 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 thread sitebrush.go Outdated
}
if a.serveStealthStaticForBlockedAdminIP(w, r, requestDomain, pagePath) {
publicTrialEndpoint := publicTrialEndpointFromRequest(r)
if !guestStaticRequest && publicTrialEndpoint == publicTrialEndpointNone && a.serveStealthStaticForBlockedAdminIP(w, r, requestDomain, pagePath) {

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 Keep stealth filtering on guest static requests

When stealth mode is enabled and an unallowlisted address performs an ordinary GET/HEAD without a session or query string, this condition now skips serveStealthStaticForBlockedAdminIP. The subsequent static fast path calls servePublishedStaticFileFromDisk(..., true), injecting the SiteBrush login/context-menu UI that stealth mode explicitly removes; TestBlockedAdminIPSeesStaticSiteAndNoSiteBrushRoutes now fails on this behavior. It also lets a request such as /_sitebrush/analytics reach the internal handler instead of appearing as a missing static path.

Useful? React with 👍 / 👎.

Comment thread sitebrush.go Outdated
Comment on lines +9435 to +9436
if !guestStaticRequest {
requestDomain = a.siteDomain(r.Context(), r)

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 Resolve aliases before handling crawler discovery files

For a guest request through a verified alias, this leaves requestDomain set to the alias rather than its primary domain. serveDefaultCrawlerIndex then looks for static files and queries published_pages and page_password_rules using that alias and returns before the later siteDomain resolution, so /robots.txt and /sitemap.xml can be replaced by generated output with missing protected-path directives or an empty page list instead of the primary site's published discovery files.

Useful? React with 👍 / 👎.

@matveynator
matveynator force-pushed the fix/guest-static-fast-path-and-trial-preflight branch from 7013468 to 5acf2bc Compare September 27, 2026 09:09
@matveynator
matveynator merged commit 24a1e92 into main Sep 27, 2026
7 checks passed
@matveynator
matveynator deleted the fix/guest-static-fast-path-and-trial-preflight branch September 27, 2026 09:37
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