mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 00:11:37 -06:00
security: remediate dependency and code scanning alerts
Upgrade vulnerable transitive dependencies and harden filesystem, URL, HTML, cryptographic, and input-processing boundaries identified by security scans.
This commit is contained in:
@@ -142,10 +142,7 @@ function normalizeResolverOptions(options?: PathResolverOptions): Required<PathR
|
||||
}
|
||||
|
||||
export function sanitizePathSegment(value: string, replacementCharacter: "_" | "-" = "_"): string {
|
||||
let sanitized = value
|
||||
.replace(INVALID_SEGMENT_CHARS_REGEX, replacementCharacter)
|
||||
.trim()
|
||||
.replace(/[. ]+$/g, "");
|
||||
let sanitized = stripTrailingDotsAndSpaces(value.replace(INVALID_SEGMENT_CHARS_REGEX, replacementCharacter).trim());
|
||||
if (!sanitized || sanitized === "." || sanitized === "..") {
|
||||
sanitized = replacementCharacter;
|
||||
}
|
||||
@@ -158,6 +155,12 @@ export function sanitizePathSegment(value: string, replacementCharacter: "_" | "
|
||||
return sanitized;
|
||||
}
|
||||
|
||||
function stripTrailingDotsAndSpaces(value: string): string {
|
||||
let end = value.length;
|
||||
while (end > 0 && (value[end - 1] === "." || value[end - 1] === " ")) end -= 1;
|
||||
return end === value.length ? value : value.slice(0, end);
|
||||
}
|
||||
|
||||
function sanitizeResolutionValues(values: Record<string, string>, options: Required<PathResolverOptions>): Record<string, string> {
|
||||
if (!options.sanitizeForCrossPlatform) return values;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user