mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-08 22:19:51 +00:00
fix(security): reject 127-prefixed websocket origins (#1263)
* fix(security): reject 127-prefixed websocket origins * style: apply prettier formatting
This commit is contained in:
@@ -9,6 +9,7 @@ import session from 'express-session';
|
||||
import rateLimit from 'express-rate-limit';
|
||||
|
||||
import crypto from 'crypto';
|
||||
import * as net from 'net';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import {
|
||||
@@ -161,7 +162,7 @@ function isLoopbackHostname(value: string | undefined): boolean {
|
||||
return (
|
||||
normalized === 'localhost' ||
|
||||
normalized.endsWith('.localhost') ||
|
||||
isLoopbackRemoteAddress(normalized)
|
||||
(net.isIP(normalized) !== 0 && isLoopbackRemoteAddress(normalized))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user