Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,9 @@ describe('isValidHost', () => {
expect(isValidHost('127.0.0.1:6006', options)).toBe(true);
});

// TODO: Change default to [] in SB11
it('when allowedHosts is undefined (default true), allows any host', () => {
expect(isValidHost('malicious-site.com', options)).toBe(true);
expect(isValidHost('any-origin.example.com', options)).toBe(true);
it('when allowedHosts is undefined (default []), rejects foreign hosts', () => {
expect(isValidHost('malicious-site.com', options)).toBe(false);
expect(isValidHost('any-origin.example.com', options)).toBe(false);
});

it('when allowedHosts is true, allows any host', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { isHostAllowed } from 'host-validation-middleware';

import type { Middleware } from '../../types';

// TODO: Change to `[]` in SB11 to change from opt-in to opt-out
export const DEFAULT_ALLOWED_HOSTS: string[] | true = true;
export const DEFAULT_ALLOWED_HOSTS: string[] | true = [];

export type HostValidationOptions = {
host?: string;
Expand Down
Loading