Jelajahi Sumber

docs: describe what authRequireGuestsToLogin blocks, with an upgrade note

Supports GHSA-9q82-wjpr-32jm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jamesread 2 hari lalu
induk
melakukan
f77dbf2e4f

+ 1 - 1
docs/modules/ROOT/pages/config.adoc

@@ -94,7 +94,7 @@ All configuration options are covered in the solution sections
 | `authHttpHeaderUserGroup` | The HTTP header to use for the usergroup. | `` | Requires restart | xref:security/trusted_header.adoc[Trusted Headers]
 | `authLocalUsers` | The list of local users. | `[]` | Requires restart | xref:security/local.adoc[Local Users]
 | `authLoginUrl` | The URL to redirect to for login. | `` | Requires restart | xref:security/local.adoc[Login URL]
-| `authRequireGuestsToLogin` | Basically disables all functionality for guests. It sets all default permissions to false. | `false` | Requires restart | xref:security/acl.adoc[Access Control Lists]
+| `authRequireGuestsToLogin` | Makes guests log in before they can do anything. Guests can only call the API to log in, and get no permissions: all default permissions are set to false, and ACLs never apply to guests. See xref:security/example_login_required.adoc[Login required]. | `false` | Requires restart | xref:security/acl.adoc[Access Control Lists]
 | `defaultPermissions` | The default permissions to use. | `[]` | Requires restart | xref:security/acl.adoc[Access Control Lists]
 | `accessControlLists` | The list of access control lists. | `[]` | Requires restart | xref:security/acl.adoc[Access Control Lists]
 | `security.headerContentSecurityPolicy` | Whether to send a `Content-Security-Policy` header from the single HTTP frontend. | `true` | Live reloadable | xref:security/content_security_policy.adoc[Content Security Policy headers]

+ 5 - 2
docs/modules/ROOT/pages/security/example_login_required.adoc

@@ -42,9 +42,12 @@ Note, to use this configuration, you will need to replace `-- your password hash
 
 == Important configuration option: `authRequireGuestsToLogin`
 
-The `authRequireGuestsToLogin` option is a helpful shortcut that sets all `defaultPermissions` to false, and makes it so that all guests are prompted to login before they can do anything with OliveTin.
+The `authRequireGuestsToLogin` option makes all guests log in before they can do anything with OliveTin. When it is enabled:
 
-Technically, you could achieve the same effect by setting `defaultPermissions` to `false` and setting up an ACL that allows access to the login page, but `authRequireGuestsToLogin` is a more convenient way to achieve the same effect.
+* Guests (visitors who are not logged in) can only use the API to log in, log out, check that OliveTin is ready, and generate a password hash. Every other API call is refused, including starting, restarting and killing actions, and the diagnostic API calls enabled by the `insecureAllow*` options.
+* Guests get no permissions at all. All `defaultPermissions` are set to `false`, and ACLs never apply to guests, even an ACL that matches the `guest` username or usergroup. Such an ACL still applies to logged-in users who are in the `guest` usergroup, for example OAuth2 users given that group by `addToUsergroup`.
+
+This is stronger than setting `defaultPermissions` to `false` yourself, because with that alone an ACL that matches guests would still give them access. See the xref:upgrade/upgrade_notes.adoc#require-guests-to-login-all-api-calls[Upgrade Notes].
 
 == Per-action ACLs, vs `addToEveryAction`
 

+ 2 - 0
docs/modules/ROOT/pages/security/oauth2.adoc

@@ -58,6 +58,8 @@ authOAuth2Providers:
 
 Then ensure an ACL matches that group, for example `matchUsergroups: ["guest"]`, so those users get the intended access.
 
+NOTE: Visitors who are not logged in are also called `guest`. If `authRequireGuestsToLogin` is `true`, an ACL that matches the `guest` usergroup applies only to logged-in users, never to visitors who are not logged in. If it is `false`, the ACL applies to both, so consider using a different group name, such as `oauth-users`.
+
 === All users from a provider in one group
 
 Give every user who logs in via GitHub the group `github` so you can target them in ACLs:

+ 7 - 0
docs/modules/ROOT/pages/upgrade/upgrade_notes.adoc

@@ -5,6 +5,13 @@ OliveTin releases are published to GitHub, and the release notes are contained t
 
 == Next release (unreleased)
 
+[#require-guests-to-login-all-api-calls]
+=== `authRequireGuestsToLogin` now applies to every API call and ACL
+
+When `authRequireGuestsToLogin` is `true`, guests (visitors who are not logged in) can now only call the API to log in, log out, check that OliveTin is ready, and generate a password hash. Previously some API calls, including the ones that start, restart and kill actions, did not check this option, so guests could still use them if an ACL gave them permission. ACLs also no longer apply to guests when this option is enabled, even an ACL that matches the `guest` username or usergroup.
+
+This affects you if `authRequireGuestsToLogin` is `true` and a script or integration calls the OliveTin API without logging in, for example with `curl` and no API key or session. Those calls now fail with "permission denied". Give the integration an API key or a user account, and an ACL that matches that user. ACLs for logged-in users, including OAuth2 users in the `guest` usergroup, are not affected. See xref:security/example_login_required.adoc[Login required].
+
 [#webhook-auth-type-required]
 === Webhooks need an `authType`, and `authType: none` must be set for open webhooks
 

+ 48 - 0
specs/require-guests-to-login.md

@@ -0,0 +1,48 @@
+# Spec: Requiring guests to log in
+
+This spec describes what visitors who are not logged in ("guests") may do when the installation requires guests to log in.
+
+---
+
+## 1. Scope
+
+The rules apply only when the installation is configured to require guests to log in. When it is not, guests get the default permissions and any access-control entries that match them, as usual.
+
+A guest is a visitor whose request carries no valid credentials of any kind. A logged-in user is never a guest, even if their username or usergroup is "guest".
+
+---
+
+## 2. API calls guests may make
+
+Guests may only make the API calls needed to log in and to check that the server is running:
+
+- the initial client bootstrap, which tells the client that login is required;
+- the readiness check;
+- local user login;
+- logout;
+- generating a password hash.
+
+Every other API call made by a guest is refused with "permission denied". This includes streaming calls, the calls that start, restart and kill actions, and the diagnostic calls that the installation enables with its insecure options.
+
+The refusal happens before the request is looked at. A guest gets the same answer for an action, execution or entity that exists as for one that does not, so guests cannot find out which ones exist.
+
+The list of calls guests may make is closed. Any API call added in future requires login unless it is added to this list on purpose.
+
+---
+
+## 3. Permissions
+
+Guests have no permissions at all:
+
+- all default permissions are off;
+- no access-control entry applies to a guest, even one that matches the "guest" username or usergroup.
+
+Access-control entries that match the "guest" usergroup still apply to logged-in users in that usergroup, for example users from an identity provider that gives them that group.
+
+This is enforced separately from the API call rule in section 2, so that a guest cannot start, view, or kill an action even through a path that does not go through the API.
+
+---
+
+## 4. Logging
+
+When an action is requested, the log records the username and the authentication provider of the user who requested it, at the default log level, so that actions requested by guests can be told apart from actions requested by logged-in users.