Skip to content

Commit 726a69b

Browse files
waleedlatif1claude
andcommitted
chore(auth): rename disposable list script to generate:, read SSO callback paths from the plugin
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 1a9ce1b commit 726a69b

4 files changed

Lines changed: 18 additions & 11 deletions

File tree

‎apps/sim/lib/auth/disposable-email-gate.test.ts‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { admin } from 'better-auth/plugins'
44
import { describe, expect, it } from 'vitest'
55
import { DISPOSABLE_EMAIL_ERROR_CODE } from '@/lib/auth/constants'
66
import { refuseDisposableAccountEmail } from '@/lib/auth/disposable-email-gate'
7+
import { configuredSsoPlugin } from '@/lib/auth/sso/plugin'
78

89
/**
910
* A real Better Auth instance wired the way `auth.ts` wires the gate, so the endpoint path each
@@ -56,14 +57,20 @@ describe('refuseDisposableAccountEmail', () => {
5657
expect(result.user.email).toBe('jane@mailinator.com')
5758
})
5859

59-
it.each([
60-
'/sso/callback/:providerId',
61-
'/sso/callback',
62-
'/sso/saml2/callback/:providerId',
63-
'/sso/saml2/sp/acs/:providerId',
64-
])('admits an SSO just-in-time account created at %s', async (path) => {
65-
await expect(refuseDisposableAccountEmail('jane@mailinator.com', path)).resolves.toBeUndefined()
66-
})
60+
/**
61+
* Better Auth dispatches with an endpoint's declared path, so the SSO plugin's own callback
62+
* endpoints name the paths a just-in-time creation reports. No IdP is driven here.
63+
*/
64+
const { callbackSSO, callbackSSOShared, callbackSSOSAML, acsEndpoint } =
65+
configuredSsoPlugin.endpoints
66+
it.each([callbackSSO.path, callbackSSOShared.path, callbackSSOSAML.path, acsEndpoint.path])(
67+
'admits any domain at the SSO plugin callback path %s',
68+
async (path) => {
69+
await expect(
70+
refuseDisposableAccountEmail('jane@mailinator.com', path)
71+
).resolves.toBeUndefined()
72+
}
73+
)
6774

6875
it.each([undefined, '/sign-up/email', '/callback/:id', '/oauth2/callback/:providerId'])(
6976
'refuses a disposable domain created at %s',

‎apps/sim/lib/messaging/email/disposable.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function emailDomain(email: string): string {
4040
* Fails open: if the list cannot load, the check logs and allows the signup, because refusing
4141
* every legitimate signup is worse than admitting a few throwaway ones.
4242
*
43-
* `disposable-email-domains.json` is generated by `scripts/vendor-disposable-email-domains.ts`
43+
* `disposable-email-domains.json` is generated by `scripts/generate-disposable-email-domains.ts`
4444
* from the curated CC0 blocklist at
4545
* https://github.com/disposable-email-domains/disposable-email-domains (the list PyPI uses), minus
4646
* every public suffix and the script's reviewed exemptions (forwarding relays, real providers).

‎apps/sim/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"format": "biome format --write .",
4343
"format:check": "biome format .",
4444
"generate:pi-model-catalog": "bun run scripts/generate-pi-model-catalog.ts",
45-
"vendor:disposable-email-domains": "bun run scripts/vendor-disposable-email-domains.ts",
45+
"generate:disposable-email-domains": "bun run scripts/generate-disposable-email-domains.ts",
4646
"generate-docs": "bun run ../../scripts/generate-docs.ts",
4747
"org:consolidate-users": "bun run scripts/consolidate-users-into-organization.ts",
4848
"verify:oracledb": "node scripts/oracledb-patch-self-test.cjs --worker lib/internal/oracledb/oracle-worker.cjs",

apps/sim/scripts/vendor-disposable-email-domains.ts renamed to apps/sim/scripts/generate-disposable-email-domains.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* - forwarding relays, whose aliases deliver to a real, permanent inbox;
1515
* - the reviewed real providers in `LEGITIMATE_DOMAINS`.
1616
*
17-
* Usage, from apps/sim: `bun run vendor:disposable-email-domains [path-to-blocklist.conf]`. With
17+
* Usage, from apps/sim: `bun run generate:disposable-email-domains [path-to-blocklist.conf]`. With
1818
* no path it downloads the pinned commit. To refresh, bump `UPSTREAM_COMMIT`, run it, and review
1919
* the diff against the Tranco top list for mainstream providers and companies.
2020
*/

0 commit comments

Comments
 (0)