Skip to content

Make the @site endpoint public#2022

Open
reebalazs wants to merge 2 commits into
mainfrom
site-endpoint-public-permission
Open

Make the @site endpoint public#2022
reebalazs wants to merge 2 commits into
mainfrom
site-endpoint-public-permission

Conversation

@reebalazs

@reebalazs reebalazs commented Jun 11, 2026

Copy link
Copy Markdown
Member

Problem

The @site endpoint provides the public bootstrap data a frontend needs before it can render anything: site title, logo, available/default languages, portal timezone, the features dict, and whatever ISiteEndpointExpander adapters contribute.

It is currently registered with permission="zope2.View", checked against the site root. On sites that restrict the View permission on the site root to authenticated users — e.g. intranets such as the ones built with kitconcept.intranet, where a restricted workflow grants View on published content only to Authenticated — anonymous requests to /@site return 401.

This breaks frontend bootstrapping: Volto fetches /@site once at SSR time, typically while the user is still anonymous, and add-ons relying on expander data (e.g. @kitconcept/volto-solr reading collective.solr.active to decide which search UI to render) silently misbehave for the entire session, since the post-login redirect is a client-side route transition that never re-runs SSR.

Real-world manifestation: https://gitlab.kitconcept.io/kitconcept/kitconcept-intranet/-/work_items/127 (after Google login, the old search page shows instead of the Solr one).

Fix

Register the @site service with permission="zope.Public", matching its design contract: it serves only data that is needed before authentication and safe to disclose publicly.

  • New test: anonymous GET /@site returns 200 even when View is revoked from Anonymous on the site root (fails with 401 before the change).
  • Docs updated: removed the zope2.View mention, added a warning to the expander section that expander data is publicly visible.

Pinging @davisagli as the author of the ISiteEndpointExpander mechanism (#1921).


📚 Documentation preview 📚: https://plonerestapi--2022.org.readthedocs.build/

The @site endpoint provides the public bootstrap data a frontend needs
before rendering anything (site title, logo, languages, timezone,
feature flags). With permission zope2.View it returns 401 for anonymous
requests on sites that restrict View on the site root to authenticated
users (e.g. intranets), which breaks frontend bootstrapping before
login. Register it with zope.Public instead.
@mister-roboto

Copy link
Copy Markdown

@reebalazs thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

@read-the-docs-community

read-the-docs-community Bot commented Jun 11, 2026

Copy link
Copy Markdown

Documentation build overview

📚 plone.restapi | 🛠️ Build #33090917 | 📁 Comparing 8a00a72 against latest (0a96a45)

  🔍 Preview build  

1 file changed
± endpoints/site.html

@reebalazs reebalazs requested a review from davisagli June 11, 2026 09:52
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