feat(hostWhitelist): allow comfy.org hosts to authenticate (#5952)

## Summary

Add `comfy.org` host names to the list of hosts that can authenticate
via SSO.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-5952-feat-hostWhitelist-allow-comfy-org-hosts-to-authenticate-2846d73d36508152a41af92ada2a698b)
by [Unito](https://www.unito.io)
This commit is contained in:
Arjan Singh
2025-10-06 17:30:18 -07:00
committed by GitHub
parent 9a452fc31a
commit 338cbd4eed
2 changed files with 29 additions and 0 deletions

View File

@@ -42,6 +42,7 @@ export function isHostWhitelisted(rawHost: string): boolean {
if (isLocalhostLabel(host)) return true
if (isIPv4Loopback(host)) return true
if (isIPv6Loopback(host)) return true
if (isComfyOrgHost(host)) return true
const normalizedList = HOST_WHITELIST.map(normalizeHost)
return normalizedList.includes(host)
}
@@ -89,3 +90,9 @@ function isIPv6Loopback(h: string): boolean {
// Require that at least one group was actually compressed: i.e., leftCount + rightCount ≤ 6.
return leftCount + rightCount <= 6
}
const COMFY_ORG_HOST = /\.comfy\.org$/
function isComfyOrgHost(h: string): boolean {
return COMFY_ORG_HOST.test(h)
}

View File

@@ -119,5 +119,27 @@ describe('hostWhitelist utils', () => {
expect(isHostWhitelisted(' ')).toBe(false)
})
})
describe('comfy.org hosts', () => {
it.each([
'staging.comfy.org',
'stagingcloud.comfy.org',
'pr-123.testingcloud.comfy.org',
'api.v2.staging.comfy.org'
])('should allow %o', (input) => {
expect(isHostWhitelisted(input)).toBe(true)
})
it.each([
'comfy.org.evil.com',
'evil-comfy.org',
'comfy.organization',
'notcomfy.org',
'comfy.org.hacker.net',
'mycomfy.org.example.com'
])('should NOT allow %o', (input) => {
expect(isHostWhitelisted(input)).toBe(false)
})
})
})
})