This commit is contained in:
1 parent
339df89fcf
commit
651c36367f
33 files changed
+1420
-40
No files matched your search
@@ -4,12 +4,14 @@ function e(e) {
|
||||
typeof e != `string` ||
|
||||
!e.startsWith(`/`) ||
|
||||
e.startsWith(`//`) ||
|
||||
// eslint-disable-next-line no-control-regex -- 安全边界:拒绝跳转路径中的控制字符。
|
||||
/[\\\u0000-\u0020\u007f]/.test(e)
|
||||
)
|
||||
return `/`;
|
||||
try {
|
||||
// 路径解码后再次检查,避免编码后的双斜杠或反斜杠绕过站内限制。
|
||||
let t = decodeURIComponent(e.split(/[?#]/, 1)[0] || ``);
|
||||
// eslint-disable-next-line no-control-regex -- 安全边界:解码后仍须拒绝控制字符绕过。
|
||||
if (t.startsWith(`//`) || /[\\\u0000-\u0020\u007f]/.test(t)) return `/`;
|
||||
} catch {
|
||||
return `/`;
|
||||
|
||||
@@ -270,6 +270,7 @@ function d(e) {
|
||||
if (
|
||||
typeof e != `string` ||
|
||||
!/^https?:\/\//i.test(e) ||
|
||||
// eslint-disable-next-line no-control-regex -- 安全边界:拒绝菜单 URL 内的控制字符。
|
||||
/[\u0000-\u0020\\]/.test(e)
|
||||
)
|
||||
return ``;
|
||||
|
||||
@@ -104,10 +104,10 @@ function o(t, r, i) {
|
||||
[`available`, `none`, `not_applicable`].includes(
|
||||
String(s.quota_status ?? ``),
|
||||
),
|
||||
x = null,
|
||||
S = null,
|
||||
x,
|
||||
S,
|
||||
C = null,
|
||||
w = ``,
|
||||
w,
|
||||
T = !1,
|
||||
E = t === `kky_ecs` && !!s.start_time && !!s.end_time,
|
||||
D = E ? a(s.incoming) : null;
|
||||
|
||||
@@ -21,6 +21,7 @@ var e = {
|
||||
/** 优先采用合法站内/HTTP(S)图片地址;否则从 e/n 的系统描述推断本地图标。 */
|
||||
function t(e, t, n) {
|
||||
let r = String(e ?? ``).trim();
|
||||
// eslint-disable-next-line no-control-regex -- 安全边界:拒绝模块 URL 内的控制字符。
|
||||
if (r && !/[\u0000-\u0020\u007f\\]/.test(r)) {
|
||||
if (/^\/(?!\/)/.test(r)) return r;
|
||||
try {
|
||||
|
||||
+3
-1
@@ -13,6 +13,7 @@ function t(t) {
|
||||
return [];
|
||||
let n = typeof t.img == `string` ? t.img : ``,
|
||||
r =
|
||||
// eslint-disable-next-line no-control-regex -- 安全边界:拒绝登录图标路径中的控制字符。
|
||||
/^\/(?!\/)/.test(n) && !/[\\\u0000-\u0020]/.test(n)
|
||||
? n
|
||||
: backend_menu_o(n);
|
||||
@@ -29,7 +30,8 @@ function t(t) {
|
||||
}
|
||||
function n(t, n) {
|
||||
return typeof t == `string`
|
||||
? /^\/(?!\/)/.test(t) && !/[\\\u0000-\u0020]/.test(t)
|
||||
? // eslint-disable-next-line no-control-regex -- 安全边界:拒绝登录跳转地址中的控制字符。
|
||||
/^\/(?!\/)/.test(t) && !/[\\\u0000-\u0020]/.test(t)
|
||||
? new URL(t, n).href
|
||||
: backend_menu_o(t)
|
||||
: ``;
|
||||
|
||||
@@ -16,6 +16,7 @@ function n(e) {
|
||||
return (
|
||||
t.startsWith(`/`) &&
|
||||
!t.startsWith(`//`) &&
|
||||
// eslint-disable-next-line no-control-regex -- 安全边界:拒绝订单续接路径中的控制字符。
|
||||
!/[\\\u0000-\u0020\u007f]/.test(t)
|
||||
);
|
||||
}
|
||||
@@ -24,6 +25,7 @@ function r(e, r) {
|
||||
try {
|
||||
if (
|
||||
typeof e != `string` ||
|
||||
// eslint-disable-next-line no-control-regex -- 安全边界:解码后仍须拒绝控制字符绕过。
|
||||
/[\\\u0000-\u0020\u007f]/.test(e) ||
|
||||
!n(e.split(/[?#]/, 1)[0] || ``)
|
||||
)
|
||||
|
||||
+2
-2
@@ -44,7 +44,7 @@ function n(n) {
|
||||
a = !1,
|
||||
o = [e[r[0].replace(/[ _-]+/g, ` `).toLowerCase()]],
|
||||
s =
|
||||
/^[\s_-]*(x86[_-]64|64[ _-]?(?:bits?|位)|32[ _-]?(?:bits?|位)|\d+(?:\.\d+)*(?:R2)?|Server|Stream|Datacenter|Standard|Enterprise|Professional|Essentials|Education|Desktop|Minimal|Core|Pro|Home|R2|LTS|SP\d+|UEFI|BIOS|GPT|BT|ARM64|aarch64|x64|amd64|x86|x32|i386|i686|ARM|cn|en|zh(?:[ _-](?:CN|TW))?|专业版|标准版|数据中心版|企业版|家庭版|教育版|中文版|英文版)(?=$|[\s_()()\[\]【】-])/i;
|
||||
/^[\s_-]*(x86[_-]64|64[ _-]?(?:bits?|位)|32[ _-]?(?:bits?|位)|\d+(?:\.\d+)*(?:R2)?|Server|Stream|Datacenter|Standard|Enterprise|Professional|Essentials|Education|Desktop|Minimal|Core|Pro|Home|R2|LTS|SP\d+|UEFI|BIOS|GPT|BT|ARM64|aarch64|x64|amd64|x86|x32|i386|i686|ARM|cn|en|zh(?:[ _-](?:CN|TW))?|专业版|标准版|数据中心版|企业版|家庭版|教育版|中文版|英文版)(?=$|[\s_()()[\]【】-])/i;
|
||||
for (let e = i.match(s); e; e = i.match(s)) {
|
||||
let n = t[e[1].toLowerCase()] ?? e[1];
|
||||
(/^\d+(?:\.\d+)*(?:R2)?$/i.test(n) &&
|
||||
@@ -67,7 +67,7 @@ function r(e) {
|
||||
return (
|
||||
n(t.replace(/\.(?:iso|qcow2?|img|raw|vhdx?|vmdk)$/i, ``))
|
||||
.replace(
|
||||
/[\s_-]*(?:[((【\[]\s*)?纯净优化版(?:\s*[))】\]])?(?=$|[\s_-])/g,
|
||||
/[\s_-]*(?:[((【[]\s*)?纯净优化版(?:\s*[))】\]])?(?=$|[\s_-])/g,
|
||||
``,
|
||||
)
|
||||
.replace(RegExp(`[((\\[【]\\s*${r}\\s*[))\\]】]`, `gi`), ` `)
|
||||
|
||||
@@ -36,6 +36,7 @@ var e = new Set(
|
||||
]);
|
||||
// 图片额外允许有限位图类型的 base64 data URL;普通链接可用 mailto/tel,不允许脚本协议。
|
||||
function n(e, t = !1) {
|
||||
// eslint-disable-next-line no-control-regex -- 安全边界:拒绝富文本链接和图片中的控制字符。
|
||||
if (!e || /[\u0000-\u001f\u007f]/.test(e)) return !1;
|
||||
if (
|
||||
t &&
|
||||
|
||||
@@ -465,7 +465,7 @@ function C(e, t = ``) {
|
||||
if (!n || /[×*¥¥$€]|(?:^|[\s([{])[-+]\s*\d/.test(n)) return null;
|
||||
let r = [...n.matchAll(/\d+(?:\.\d+)?\s*(?:[kmgtpe](?:i?b)?|b)(?![a-z])/gi)],
|
||||
i = r[0],
|
||||
a = ``;
|
||||
a;
|
||||
if (r.length === 1) a = S(/[a-z]+$/i.exec(i[0])?.[0] ?? ``);
|
||||
else if (r.length === 0 && S(t)) {
|
||||
let e = [...n.matchAll(/\d+(?:\.\d+)?/g)];
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
function e(e) {
|
||||
if (
|
||||
!/^(?:https?:\/\/|\/(?!\/)|\.\.?\/)/i.test(e) ||
|
||||
// eslint-disable-next-line no-control-regex -- 安全边界:拒绝附件 URL 内的控制字符。
|
||||
/[\u0000-\u001f\u007f\\]/.test(e)
|
||||
)
|
||||
return !1;
|
||||
@@ -56,6 +57,7 @@ function r(t) {
|
||||
u = c || (l ? n(l, i) : ``),
|
||||
d =
|
||||
l ||
|
||||
// eslint-disable-next-line no-control-regex -- 安全边界:拒绝附件名中的控制字符。
|
||||
(typeof o == `string` && !e(o) && !/[\\/:\u0000-\u001f]/.test(o)
|
||||
? o
|
||||
: ``),
|
||||
|
||||
@@ -402,6 +402,7 @@ function o(e) {
|
||||
function s(e) {
|
||||
if (typeof e != `string`) return `#`;
|
||||
let t = e.trim();
|
||||
// eslint-disable-next-line no-control-regex -- 安全边界:拒绝官网链接内的控制字符。
|
||||
return !t || /[\u0000-\u001f\\]/.test(t)
|
||||
? `#`
|
||||
: /^(https?:\/\/|mailto:|tel:|#|\/(?!\/))/i.test(t)
|
||||
@@ -412,6 +413,7 @@ function s(e) {
|
||||
function c(e) {
|
||||
if (typeof e != `string`) return ``;
|
||||
let t = e.trim();
|
||||
// eslint-disable-next-line no-control-regex -- 安全边界:拒绝官网图片 URL 内的控制字符。
|
||||
return !t || /[\u0000-\u001f\\]/.test(t)
|
||||
? ``
|
||||
: /^(https?:\/\/|\/(?!\/))/i.test(t)
|
||||
|
||||
Reference in new issue
Block a user