Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
}
private isValidProtocolBasicAuth (req: IncomingMessage, next: (err?: Error) => void): boolean {
- const authorizationProtocol = req.headers['sec-websocket-protocol']?.split(',').pop()?.trim()
+ const authorizationProtocol = req.headers['sec-websocket-protocol']?.split(/,\s+/).pop()
const [username, password] = this.getUsernameAndPasswordFromAuthorizationToken(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
`${authorizationProtocol}${Array(((4 - (authorizationProtocol!.length % 4)) % 4) + 1).join('=')}`
) {
throw new BaseError('Protocol basic authentication is not supported for HTTP UI server')
}
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- if (!UIServerUtils.isLoopback(uiServerConfiguration.options!.host!)) {
+ if (
+ uiServerConfiguration.authentication?.enabled !== true &&
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ !UIServerUtils.isLoopback(uiServerConfiguration.options!.host!)
+ ) {
console.warn(
chalk.yellow(
- 'Loopback address not detected in UI server configuration. This is not recommended'
+ 'Non loopback address in UI server configuration without authentication enabled. This is not recommended'
)
)
}