fix: 补强NapCat审计Windows路径拒绝
This commit is contained in:
parent
7619dd5928
commit
99408d3cec
@ -182,6 +182,18 @@ export async function runSelfTest(): Promise<void> {
|
|||||||
"\\\\server\\share\\packages\\napcat-core\\login\\runtime.ts",
|
"\\\\server\\share\\packages\\napcat-core\\login\\runtime.ts",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
forkPatchFiles: [],
|
||||||
|
name: "Windows rooted path",
|
||||||
|
upstreamChangedFiles: [
|
||||||
|
"\\packages\\napcat-core\\login\\runtime.ts",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
forkPatchFiles: [],
|
||||||
|
name: "Windows drive-relative path",
|
||||||
|
upstreamChangedFiles: ["C:packages/napcat-core/login/runtime.ts"],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
forkPatchFiles: [],
|
forkPatchFiles: [],
|
||||||
name: "parent segment path",
|
name: "parent segment path",
|
||||||
|
|||||||
@ -83,9 +83,9 @@ const hotZoneMatchers: Array<{ pattern: string; regex: RegExp }> = [
|
|||||||
function hasInvalidAuditPath(value: string): boolean {
|
function hasInvalidAuditPath(value: string): boolean {
|
||||||
const trimmed = value.trim();
|
const trimmed = value.trim();
|
||||||
if (!trimmed) return false;
|
if (!trimmed) return false;
|
||||||
if (/^[a-zA-Z]:[\\/]/.test(trimmed)) return true;
|
if (/^[a-zA-Z]:/.test(trimmed)) return true;
|
||||||
if (trimmed.startsWith('\\\\') || trimmed.startsWith('//')) return true;
|
if (trimmed.startsWith('\\\\') || trimmed.startsWith('//')) return true;
|
||||||
if (trimmed.startsWith('/')) return true;
|
if (trimmed.startsWith('\\') || trimmed.startsWith('/')) return true;
|
||||||
|
|
||||||
const normalized = trimmed
|
const normalized = trimmed
|
||||||
.replace(/\\/g, '/')
|
.replace(/\\/g, '/')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user