Skip to content

Commit 7c6c999

Browse files
committed
fix(plugin-auth)!: pin the email key under off with nothing else in force, door path check, docs 302
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jSSVaNcDs8HPSoGV6V
1 parent 10180db commit 7c6c999

4 files changed

Lines changed: 45 additions & 6 deletions

File tree

‎.changeset/33358-sign-in-floor-local-off-and-blocked-door.md‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@
55
'@object-ui/auth': patch
66
---
77

8-
fix(plugin-auth): the auth settings save keeps a way to sign in under the local sign-in path off, and a client the IP allow-list refuses at the direct sign-in door lands on the sign-in page
8+
fix(plugin-auth)!: under the local sign-in path `off`, the auth settings save keeps a way to sign in, and a client the IP allow-list refuses at the direct sign-in door lands on the sign-in page
99

10-
Clause-②: yes (widening)
10+
Clause-②: yes (narrowing) — narrowed: with direct sign-in on and its local sign-in path `off` (`directSignIn.localSignIn: 'off'`, or `OS_AUTH_DIRECT_SIGN_IN_LOCAL_PATH=off`), an auth settings save (`PUT /api/settings/auth`) that turns Google off, or clears a Google client credential no environment variable backs, while Google is the last way in the sign-in page offers answers `400 SETTINGS_VALIDATION` with the new copy `googleLocalOff` and saves nothing, where it saved, even with email and password (or phone sign-in) switched on; and a `GET /api/v1/auth/sign-in/direct` from a client the IP allow-list refuses answers `302` to the Console's `/login?error=IP_NOT_ALLOWED` (keeping a same-origin `?redirect=`), where it answered the `403 IP_NOT_ALLOWED` JSON body. Widened: module exports (not on the package entry) `DIRECT_SIGN_IN_NETWORK_REFUSED`, `isDirectSignInDoorNavigation` and `directSignInNetworkRefusal`; a `googleLocalOff` key on the sign-in floor copy, in all 11 locales; the `@object-ui/i18n` key `auth.login.errors.networkNotAllowed`, in all 11 shipped locales (no key renamed or removed); the Console sign-in page explains `?error=IP_NOT_ALLOWED`; `markSignOutRoundTrip` in `@object-ui/auth` takes the sign-in page path it records.
1111
Metadata-protocol: none
12+
Skills-docs: none — no skill under `skills/**` teaches direct sign-in, the auth settings save, the IP allow-list or the sign-out note; `content/docs/permissions/sso.mdx` gains the rules in this change.
1213

13-
Three fixes next to direct sign-in.
14+
<!-- adr-0087: not-required (no-migration-prescription) No schema key, accepted value or metadata type is added, removed, renamed or re-shaped. The moved answers are a runtime refusal of one settings save under a deployment switch and the status of one refused auth navigation, so there is nothing stored for a migration to rewrite and no tombstone. -->
1415

15-
- **The auth settings save under `OS_AUTH_DIRECT_SIGN_IN_LOCAL_PATH=off`.** With the local sign-in path behind direct sign-in `off`, the sign-in page offers no email and password and no phone sign-in, but saving the auth settings still counted them as a way in. So with Google as the last provider, saving Google off (or clearing a client credential no environment variable backs) went through, and the page then showed "No sign-in method is available". The save now judges by what the page offers, as the provider delete and the boot report already do: that change is refused `400 SETTINGS_VALIDATION` with its own sentence in all eleven languages (keep Google, set up another sign-in method, or set the local sign-in path back to `hidden` with email and password on), and turning email and password on in the same save does not help. The `email_password_enabled` switch itself is never refused under `off`, because the page draws it neither way. Another identity provider, a social or OIDC provider with a client ID and secret, or a host sign-in handoff still counts. The `503` sentence for a provider delete whose provider list could not be read now says the sign-in page offers no email and password, which is true under both reasons the check runs.
16-
- **A client the IP allow-list refuses at `GET /api/v1/auth/sign-in/direct`.** A blocked browser that navigated to the direct sign-in door got the raw `403 IP_NOT_ALLOWED` JSON. It now gets `302` to the Console's `/login?error=IP_NOT_ALLOWED`, with the page's `?redirect=` kept, and the page says the system does not allow sign-in from this network. The door is not exempt from the allow-list: nothing is started and no provider is read, every other auth request from that client is refused `403` as before, and the refusal is still audited and logged. The `@object-ui/i18n` locale packs gain one key, `auth.login.errors.networkNotAllowed`, in all eleven shipped locales; no key is renamed or removed.
17-
- **The sign-out note after a provider logout.** The note a provider-logout sign-out leaves in the tab now records the sign-in page the provider returns to, and only a load of that page reads it. A provider that never sends the browser back no longer makes the next deep link opened in that tab drop its `?redirect=`.
16+
**BREAKING** for a deployment running direct sign-in with the local sign-in path `off`: saving the auth settings with Google off (or with an unbacked Google client credential cleared) while Google is the last way in the sign-in page offers is refused `400 SETTINGS_VALIDATION` and nothing is saved, unless another way in the page offers remains (another identity provider row, a social or OIDC provider with a client ID and secret, or a host sign-in handoff). Email and password and phone sign-in do not count there, because the page does not offer them; turning email and password on in the same save does not help. Before, the save went through and the sign-in page then showed "No sign-in method is available". Also **BREAKING** for anything that reads the status of `GET /api/v1/auth/sign-in/direct` from a client outside the IP allow-list: it is now `302` to `/login?error=IP_NOT_ALLOWED` with no cookie set, instead of the `403` JSON body.
17+
18+
Unchanged: the local sign-in path `hidden` (the default) and direct sign-in off, where email and password and phone sign-in count as before; the `email_password_enabled` switch, which is never refused under `off` because the page draws it neither way; the IP allow-list itself, which does not exempt the door: nothing is started and no provider is read for a refused client, every other auth request from it (including a `POST` to the door and the door path with a trailing slash) is still refused `403 IP_NOT_ALLOWED`, and the refusal is still audited and logged.
19+
20+
What to do: nothing, unless you turn Google off as the last way in under `off`. Register another identity provider first, or set `OS_AUTH_DIRECT_SIGN_IN_LOCAL_PATH=hidden` (with email and password sign-in on) and restart. A client that checked the door's `403` status should check for the `302` to `/login?error=IP_NOT_ALLOWED` instead.
21+
22+
Also fixed: the `503` sentence for a provider delete whose provider list could not be read now says the sign-in page offers no email and password, which is true under both reasons the check runs; and the note a provider-logout sign-out leaves in the tab now records the sign-in page the provider returns to, and only a load of that page reads it, so a provider that never sends the browser back no longer makes the next deep link opened in that tab drop its `?redirect=`.

‎content/docs/permissions/sso.mdx‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,13 @@ button (and the reason, where there is one), instead of starting again when:
826826
starts from one address in a few seconds). It redirects to
827827
`/login?error=direct_sign_in_rate_limited`, the page asks the visitor to
828828
wait a few seconds and try again, and the `warn` line names `rate_limited`;
829+
- the [IP allow-list](/docs/permissions/authentication) refuses the
830+
visitor's network. The door is not exempt from the allow-list: a browser
831+
`GET` of the door from a refused address starts nothing and is redirected
832+
to `/login?error=IP_NOT_ALLOWED` (keeping a same-origin `?redirect=`)
833+
instead of the `403` body, the page says sign-in is not allowed from this
834+
network, and every other auth request from that address is still refused
835+
`403 IP_NOT_ALLOWED`;
829836
- the person just signed out in that tab. Often the identity provider's
830837
session outlives the platform's, so starting again would sign them straight
831838
back in. When the provider ends its own session too (an OIDC provider whose

‎packages/plugins/plugin-auth/src/direct-sign-in.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,8 @@ describe('a client the IP allow-list refuses lands on the sign-in page, and the
492492
['/api/v1/auth/get-session', {}],
493493
['/api/v1/auth/sign-in/social', { method: 'POST', headers: { 'content-type': 'application/json', origin: ORIGIN }, body: JSON.stringify({ provider: PLATFORM_IDP }) }],
494494
[DOOR, { method: 'POST' }],
495+
// Only the door's exact path is the navigation that lands on the page: a trailing slash is not it.
496+
[`${DOOR}/${RETURN}`, {}],
495497
] as const) {
496498
const res = await fromPeer(app, path, OUTSIDE, init as RequestInit);
497499
expect(res.status, path).toBe(403);

‎packages/plugins/plugin-auth/src/sign-in-method-floor.test.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,18 @@ describe('the auth settings save keeps a way to sign in', () => {
490490
expect(googleOn(manager)).toBe(true);
491491
});
492492

493+
it('under the local sign-in path off, the email and password key is never refused, even with no other way in configured', async () => {
494+
// Nothing else is in force: no Google, no identity provider, no social or OIDC provider, no handoff.
495+
const { settings, manager } = await boot({ pluginOptions: { directSignIn: { localSignIn: 'off' } } });
496+
expect(manager.getPublicConfig().features.localSignIn).toBe('off');
497+
expect(googleOn(manager)).toBe(false);
498+
expect(passwordOn(manager)).toBe(true);
499+
await settings.setMany('auth', { email_password_enabled: false });
500+
await vi.waitFor(() => expect(passwordOn(manager)).toBe(false));
501+
await settings.setMany('auth', { email_password_enabled: true });
502+
await vi.waitFor(() => expect(passwordOn(manager)).toBe(true));
503+
});
504+
493505
it('CONTROL: with the local sign-in path hidden, the same Google change goes through while email and password is on', async () => {
494506
const { settings, manager } = await boot({ pluginOptions: { directSignIn: { localSignIn: 'hidden' } } });
495507
expect(manager.getPublicConfig().features.localSignIn).toBe('hidden');
@@ -942,6 +954,19 @@ describe('the floor judges a provider delete and a boot by what it can read (#30
942954
});
943955
// The email and password key is never refused under off, on or off.
944956
await expect(save(deps({ config: GOOGLE_ONLY_OFF }), { email_password_enabled: false })).resolves.toBeUndefined();
957+
// ...also with nothing else in force (no Google, no row, no social or OIDC provider, no handoff).
958+
const NOTHING_ELSE_OFF: SignInMethodConfigView = {
959+
emailPassword: { enabled: true },
960+
socialProviders: [],
961+
features: { sso: false, phoneNumber: true, localSignIn: 'off' },
962+
};
963+
await expect(save(deps({ config: NOTHING_ELSE_OFF }), { email_password_enabled: false })).resolves.toBeUndefined();
964+
// CONTROL: with the path hidden (and phone off), the same save is refused in the email copy.
965+
await expect(
966+
save(deps({ config: { ...NOTHING_ELSE_OFF, features: { sso: false, phoneNumber: false, localSignIn: 'hidden' } } }), {
967+
email_password_enabled: false,
968+
}),
969+
).resolves.toMatchObject({ constraint: { lastSignInMethod: 'email_password' } });
945970
// The exits under off.
946971
for (const d of [
947972
deps({ config: { ...GOOGLE_ONLY_OFF, socialProviders: [...GOOGLE_ONLY_OFF.socialProviders!, { id: 'github', type: 'social' }] } }),

0 commit comments

Comments
 (0)