Ghost/ghost/core
Kevin Ansfield ef143978e7
🎨 Reduced requests and 403 responses for comments auth check (#19840)
closes https://linear.app/tryghost/issue/ENG-721
ref https://linear.app/tryghost/issue/ENG-708

Comments-UI loads `/ghost/admin-frame/` in an iframe to check if a Staff User is authenticated in order to  show moderation options. That iframe request loads a HTML page which in turn contains a script that fires off an API request that attempts to fetch the logged-in user details, resulting in a 403 "error" showing up when not authenticated. In the vast majority of cases there will be no staff user authenticated so lots of extra requests and "errors" are seen unnecessarily.

- adjusted the `/ghost/auth-frame/` endpoint to check if the request contains an Admin session cookie
  - if it does, continue as before with rendering the HTML page so the script is loaded
  - if it doesn't, return an empty 204 response avoiding the script request and subsequent 403-generating API request
- eliminates the 403 error being generated for all typical visitor traffic, the error should only be seen when an Admin was previously logged in but their cookie is no longer valid (either from logging out, or going past the 6month validity period)
2024-03-12 12:27:18 +00:00
..
content 🎨 Updated Source to v1.2.0 2024-03-08 16:04:08 +00:00
core 🎨 Reduced requests and 403 responses for comments auth check (#19840) 2024-03-12 12:27:18 +00:00
test 🎨 Reduced requests and 403 responses for comments auth check (#19840) 2024-03-12 12:27:18 +00:00
.c8rc.e2e.json
.c8rc.json
.eslintignore
.eslintrc.js
.npmignore
config.development.json
ghost.js
index.js
jsconfig.json
loggingrc.js
MigratorConfig.js
monobundle.js
newrelic.js
package.json Updated @tryghost/errors dependency 2024-03-11 17:33:51 +01:00
playwright.config.js Updated browser tests to be less flaky (#19701) 2024-02-21 17:47:44 +00:00