Skip to content

Commit 6df86b3

Browse files
authored
Merge branch 'main' into select-node-after-drag
2 parents 043a34b + 338cbd4 commit 6df86b3

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/utils/hostWhitelist.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export function isHostWhitelisted(rawHost: string): boolean {
4242
if (isLocalhostLabel(host)) return true
4343
if (isIPv4Loopback(host)) return true
4444
if (isIPv6Loopback(host)) return true
45+
if (isComfyOrgHost(host)) return true
4546
const normalizedList = HOST_WHITELIST.map(normalizeHost)
4647
return normalizedList.includes(host)
4748
}
@@ -89,3 +90,9 @@ function isIPv6Loopback(h: string): boolean {
8990
// Require that at least one group was actually compressed: i.e., leftCount + rightCount ≤ 6.
9091
return leftCount + rightCount <= 6
9192
}
93+
94+
const COMFY_ORG_HOST = /\.comfy\.org$/
95+
96+
function isComfyOrgHost(h: string): boolean {
97+
return COMFY_ORG_HOST.test(h)
98+
}

tests-ui/tests/utils/hostWhitelist.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,27 @@ describe('hostWhitelist utils', () => {
119119
expect(isHostWhitelisted(' ')).toBe(false)
120120
})
121121
})
122+
123+
describe('comfy.org hosts', () => {
124+
it.each([
125+
'staging.comfy.org',
126+
'stagingcloud.comfy.org',
127+
'pr-123.testingcloud.comfy.org',
128+
'api.v2.staging.comfy.org'
129+
])('should allow %o', (input) => {
130+
expect(isHostWhitelisted(input)).toBe(true)
131+
})
132+
133+
it.each([
134+
'comfy.org.evil.com',
135+
'evil-comfy.org',
136+
'comfy.organization',
137+
'notcomfy.org',
138+
'comfy.org.hacker.net',
139+
'mycomfy.org.example.com'
140+
])('should NOT allow %o', (input) => {
141+
expect(isHostWhitelisted(input)).toBe(false)
142+
})
143+
})
122144
})
123145
})

0 commit comments

Comments
 (0)