Sign-in look: the logo check never follows a redirect; the review pictures stay out of the package
checkLogoFile asks only the address the upload has (redirect: 'manual'); a redirecting logo counts as unknown, so the server fetches nothing at an internal address. docs/dev/login-page/*.png is excluded in package.json files (npm pack --dry-run: none of them packed). Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
939ab679c7
commit
562bf5388d
@@ -225,6 +225,15 @@ describe('what the public sign-in page may show', () => {
|
||||
serve(PNG, { headers: { 'content-length': String(600 * 1024), 'content-type': 'image/png' } })
|
||||
expect((await brand()).logo).toBeNull()
|
||||
vi.restoreAllMocks()
|
||||
// a redirect is never followed by the server (it could point at an internal address): one request, to the
|
||||
// logo's own address, asked not to follow; the upload document is believed and nothing is inlined from it
|
||||
const redirected = serve(null, { headers: { location: 'http://169.254.169.254/latest/meta-data/' }, status: 302 })
|
||||
expect((await brand()).logo?.src).toBe(settings.logo.url)
|
||||
expect(redirected).toHaveBeenCalledTimes(1)
|
||||
expect(String(redirected.mock.calls[0][0])).toBe('https://site.test/api/media/file/logo.png')
|
||||
expect((redirected.mock.calls[0][1] as RequestInit).redirect).toBe('manual')
|
||||
expect(await checkLogoFile('https://site.test/l.png', null)).toBe('unknown')
|
||||
vi.restoreAllMocks()
|
||||
// nothing answers (the site cannot reach its own address): the upload document is believed
|
||||
vi.spyOn(globalThis, 'fetch').mockRejectedValue(new Error('ECONNREFUSED'))
|
||||
expect((await brand()).logo?.src).toBe(settings.logo.url)
|
||||
|
||||
Reference in New Issue
Block a user