mirror of
https://github.com/whyour/qinglong.git
synced 2026-12-01 01:39:52 +08:00
fix(security): restrict task environment controls and app scopes (#3121)
* fix(security): restrict task environment controls and app scopes * fix(security): preserve legacy scopes and add read-only access * feat(security): add read-only scopes for remaining resources * fix(security): reject apps scope grants in app API * fix(security): protect system app and task file boundaries * fix: block case-variant secret paths and task runner env overrides
This commit is contained in:
1 parent
a5f22f8d44
commit
442ab2c616
28 files changed
+782
-28
No files matched your search
@@ -112,6 +112,7 @@
|
||||
"代理端口": "Proxy Port",
|
||||
"以后再说": "Later",
|
||||
"仪表盘": "Dashboard",
|
||||
"仪表盘(只读)": "Dashboard (read only)",
|
||||
"任务": "Task",
|
||||
"任务数": "Tasks",
|
||||
"任务未运行": "Task not running",
|
||||
@@ -122,6 +123,7 @@
|
||||
"使用手机应用扫描二维码,或者输入秘钥": "Scan the QR code with the mobile app or enter the key",
|
||||
"依赖文件": "Dependency Files",
|
||||
"依赖管理": "Dependency Management",
|
||||
"依赖管理(只读)": "Dependencies (read only)",
|
||||
"依赖类型": "Dependency Type",
|
||||
"依赖缓存": "Dependency cache",
|
||||
"依赖设置": "Dependence Settings",
|
||||
@@ -188,6 +190,8 @@
|
||||
"可用,你使用的版本为": "available, the version you are using is",
|
||||
"同时删除关联任务和脚本": "Delete associated tasks and scripts as well",
|
||||
"名称": "Name",
|
||||
"名称受限": "Restricted name",
|
||||
"名称受限,未注入任务": "Restricted name; not injected into tasks",
|
||||
"名称不能为保留关键字": "The name cannot be a reserved keyword",
|
||||
"吗": "?",
|
||||
"否": "No",
|
||||
@@ -228,6 +232,7 @@
|
||||
"完成设置": "Finish Setup",
|
||||
"定时": "Schedule",
|
||||
"定时任务": "Scheduled Tasks",
|
||||
"定时任务(只读)": "Scheduled Tasks (read only)",
|
||||
"定时任务并发数": "Concurrent Scheduled Tasks",
|
||||
"定时类型": "Schedule Type",
|
||||
"定时规则": "Schedule Rule",
|
||||
@@ -331,6 +336,7 @@
|
||||
"日志名称只能包含中文、字母、数字、下划线、连字符、点和路径分隔符": "Log name can only contain Chinese characters, letters, numbers, underscores, hyphens, dots, and path separators",
|
||||
"日志文件": "Log files",
|
||||
"日志管理": "Log Management",
|
||||
"日志管理(只读)": "Logs (read only)",
|
||||
"时": "hour(s)",
|
||||
"时区": "Timezone",
|
||||
"是": "Yes",
|
||||
@@ -411,6 +417,7 @@
|
||||
"版本": "Version",
|
||||
"状态": "Status",
|
||||
"环境变量": "Environment variable",
|
||||
"环境变量(只读)": "Environment variables (read only)",
|
||||
"生成数据中...": "Generating data...",
|
||||
"用于访问所有私有仓库的全局SSH私钥": "Global SSH private key for accessing all private repositories",
|
||||
"用户令牌,扫描登录后 我的—>设置->令牌 中获取,参考 https://www.weplusbot.com/": "Token, which can be obtained after scanning and logging in, is available under 'My Account' -> 'Settings' -> 'Tokens'. Please refer to the instructions for detailed steps: https://www.weplusbot.com/",
|
||||
@@ -494,6 +501,7 @@
|
||||
"脚本执行时的工作目录,留空则自动检测。相对路径基于 scripts 目录,也支持绝对路径": "Working directory for script execution. Leave blank for auto-detection. Relative paths are based on the scripts directory. Absolute paths are also supported.",
|
||||
"脚本文件": "Script files",
|
||||
"脚本管理": "Script Management",
|
||||
"脚本(只读)": "Scripts (read only)",
|
||||
"自动删除任务": "Automatically Delete Tasks",
|
||||
"自动拆分": "Auto Split",
|
||||
"自动添加任务": "Automatically Add Tasks",
|
||||
@@ -508,11 +516,13 @@
|
||||
"视图管理": "View Management",
|
||||
"订阅": "Subscription",
|
||||
"订阅管理": "Subscription Management",
|
||||
"订阅管理(只读)": "Subscriptions (read only)",
|
||||
"设置": "Settings",
|
||||
"访问密钥": "Access Key",
|
||||
"语言": "Language",
|
||||
"请": "Please",
|
||||
"请先按如下方式修复:": "Please fix it as follows:",
|
||||
"请先修改环境变量名称": "Rename the environment variable first",
|
||||
"请求体格式key1: value1,多个换行分割。url或者body中必须包含$title,$content可选,对应api内容的位置": "Request body format: key1: value1 (separate multiple keys with line breaks). URL or body must contain $title, $content is optional and corresponds to the API content position.",
|
||||
"请求头Content-Type": "Request Header Content-Type",
|
||||
"请求头格式Custom-Header1: Header1,多个换行分割": "Request header format: Custom-Header1: Header1 (separate multiple headers with line breaks)",
|
||||
@@ -606,6 +616,7 @@
|
||||
"邮箱服务名称,比如126、163、Gmail、QQ等,支持列表https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json": "Email service name, e.g., 126, 163, Gmail, QQ, etc. Supported list: https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json",
|
||||
"邮箱认证地址": "Email address for SMTP authentication",
|
||||
"配置文件": "Configuration Files",
|
||||
"配置文件(只读)": "Configuration files (read only)",
|
||||
"重启": "Restart",
|
||||
"重命名": "Rename",
|
||||
"重新下载": "Redownload",
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
"代理端口": "代理端口",
|
||||
"以后再说": "以后再说",
|
||||
"仪表盘": "仪表盘",
|
||||
"仪表盘(只读)": "仪表盘(只读)",
|
||||
"任务": "任务",
|
||||
"任务数": "任务数",
|
||||
"任务未运行": "任务未运行",
|
||||
@@ -121,6 +122,7 @@
|
||||
"使用手机应用扫描二维码,或者输入秘钥": "使用手机应用扫描二维码,或者输入秘钥",
|
||||
"依赖文件": "依赖文件",
|
||||
"依赖管理": "依赖管理",
|
||||
"依赖管理(只读)": "依赖管理(只读)",
|
||||
"依赖类型": "依赖类型",
|
||||
"依赖缓存": "依赖缓存",
|
||||
"依赖设置": "依赖设置",
|
||||
@@ -187,6 +189,8 @@
|
||||
"可用,你使用的版本为": "可用,你使用的版本为",
|
||||
"同时删除关联任务和脚本": "同时删除关联任务和脚本",
|
||||
"名称": "名称",
|
||||
"名称受限": "名称受限",
|
||||
"名称受限,未注入任务": "名称受限,未注入任务",
|
||||
"名称不能为保留关键字": "名称不能为保留关键字",
|
||||
"吗": "吗",
|
||||
"否": "否",
|
||||
@@ -227,6 +231,7 @@
|
||||
"完成设置": "完成设置",
|
||||
"定时": "定时",
|
||||
"定时任务": "定时任务",
|
||||
"定时任务(只读)": "定时任务(只读)",
|
||||
"定时任务并发数": "定时任务并发数",
|
||||
"定时类型": "定时类型",
|
||||
"定时规则": "定时规则",
|
||||
@@ -330,6 +335,7 @@
|
||||
"日志名称只能包含中文、字母、数字、下划线、连字符、点和路径分隔符": "日志名称只能包含中文、字母、数字、下划线、连字符、点和路径分隔符",
|
||||
"日志文件": "日志文件",
|
||||
"日志管理": "日志管理",
|
||||
"日志管理(只读)": "日志管理(只读)",
|
||||
"时": "时",
|
||||
"时区": "时区",
|
||||
"是": "是",
|
||||
@@ -411,6 +417,7 @@
|
||||
"版本": "版本",
|
||||
"状态": "状态",
|
||||
"环境变量": "环境变量",
|
||||
"环境变量(只读)": "环境变量(只读)",
|
||||
"生成数据中...": "生成数据中...",
|
||||
"用于访问所有私有仓库的全局SSH私钥": "用于访问所有私有仓库的全局SSH私钥",
|
||||
"用户令牌,扫描登录后 我的—>设置->令牌 中获取,参考 https://www.weplusbot.com/": "用户令牌,扫描登录后 我的—>设置->令牌 中获取,参考 https://www.weplusbot.com/",
|
||||
@@ -494,6 +501,7 @@
|
||||
"脚本执行时的工作目录,留空则自动检测。相对路径基于 scripts 目录,也支持绝对路径": "脚本执行时的工作目录,留空则自动检测。相对路径基于 scripts 目录,也支持绝对路径",
|
||||
"脚本文件": "脚本文件",
|
||||
"脚本管理": "脚本管理",
|
||||
"脚本(只读)": "脚本(只读)",
|
||||
"自动删除任务": "自动删除任务",
|
||||
"自动拆分": "自动拆分",
|
||||
"自动添加任务": "自动添加任务",
|
||||
@@ -508,11 +516,13 @@
|
||||
"视图管理": "视图管理",
|
||||
"订阅": "订阅",
|
||||
"订阅管理": "订阅管理",
|
||||
"订阅管理(只读)": "订阅管理(只读)",
|
||||
"设置": "设置",
|
||||
"访问密钥": "访问密钥",
|
||||
"语言": "语言",
|
||||
"请": "请",
|
||||
"请先按如下方式修复:": "请先按如下方式修复:",
|
||||
"请先修改环境变量名称": "请先修改环境变量名称",
|
||||
"请求体格式key1: value1,多个换行分割。url或者body中必须包含$title,$content可选,对应api内容的位置": "请求体格式key1: value1,多个换行分割。url或者body中必须包含$title,$content可选,对应api内容的位置",
|
||||
"请求头Content-Type": "请求头Content-Type",
|
||||
"请求头格式Custom-Header1: Header1,多个换行分割": "请求头格式Custom-Header1: Header1,多个换行分割",
|
||||
@@ -606,6 +616,7 @@
|
||||
"邮箱服务名称,比如126、163、Gmail、QQ等,支持列表https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json": "邮箱服务名称,比如126、163、Gmail、QQ等,支持列表https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json",
|
||||
"邮箱认证地址": "邮箱认证地址",
|
||||
"配置文件": "配置文件",
|
||||
"配置文件(只读)": "配置文件(只读)",
|
||||
"重启": "重启",
|
||||
"重命名": "重命名",
|
||||
"重新下载": "重新下载",
|
||||
|
||||
Vendored
+24
-2
@@ -174,7 +174,7 @@ const Env = () => {
|
||||
title: intl.get('状态'),
|
||||
key: 'status',
|
||||
dataIndex: 'status',
|
||||
width: 100,
|
||||
width: 170,
|
||||
filters: [
|
||||
{
|
||||
text: intl.get('已启用'),
|
||||
@@ -192,6 +192,13 @@ const Env = () => {
|
||||
<Tag color={StatusColor[record.status]} style={{ marginRight: 0 }}>
|
||||
{intl.get(Status[record.status])}
|
||||
</Tag>
|
||||
{record.securityBlocked && (
|
||||
<Tooltip title={intl.get('名称受限,未注入任务')}>
|
||||
<Tag color="warning" style={{ marginRight: 0 }}>
|
||||
{intl.get('名称受限')}
|
||||
</Tag>
|
||||
</Tooltip>
|
||||
)}
|
||||
</Space>
|
||||
);
|
||||
},
|
||||
@@ -202,6 +209,8 @@ const Env = () => {
|
||||
width: 160,
|
||||
render: (text: string, record: any, index: number) => {
|
||||
const isPc = !isPhone;
|
||||
const isBlockedEnable =
|
||||
record.status === Status.已禁用 && record.securityBlocked;
|
||||
return (
|
||||
<Space size="middle">
|
||||
<Tooltip title={isPc ? intl.get('编辑') : ''}>
|
||||
@@ -212,7 +221,9 @@ const Env = () => {
|
||||
<Tooltip
|
||||
title={
|
||||
isPc
|
||||
? record.status === Status.已禁用
|
||||
? isBlockedEnable
|
||||
? intl.get('请先修改环境变量名称')
|
||||
: record.status === Status.已禁用
|
||||
? intl.get('启用')
|
||||
: intl.get('禁用')
|
||||
: ''
|
||||
@@ -278,6 +289,10 @@ const Env = () => {
|
||||
};
|
||||
|
||||
const enabledOrDisabledEnv = (record: any, index: number) => {
|
||||
if (record.status === Status.已禁用 && record.securityBlocked) {
|
||||
message.error(intl.get('请先修改环境变量名称'));
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: intl.get('确认操作', {
|
||||
operation:
|
||||
@@ -538,6 +553,13 @@ const Env = () => {
|
||||
};
|
||||
|
||||
const operateEnvs = (operationStatus: number) => {
|
||||
if (
|
||||
operationStatus === 0 &&
|
||||
value.some((env) => selectedRowIds.includes(env.id) && env.securityBlocked)
|
||||
) {
|
||||
message.error(intl.get('请先修改环境变量名称'));
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: intl.get('确认操作', {
|
||||
operation: intl.get(OperationName[operationStatus]),
|
||||
|
||||
@@ -20,30 +20,58 @@ export default {
|
||||
name: intl.get('定时任务'),
|
||||
value: 'crons',
|
||||
},
|
||||
{
|
||||
name: intl.get('定时任务(只读)'),
|
||||
value: 'crons:read',
|
||||
},
|
||||
{
|
||||
name: intl.get('环境变量'),
|
||||
value: 'envs',
|
||||
},
|
||||
{
|
||||
name: intl.get('环境变量(只读)'),
|
||||
value: 'envs:read',
|
||||
},
|
||||
{
|
||||
name: intl.get('订阅管理'),
|
||||
value: 'subscriptions',
|
||||
},
|
||||
{
|
||||
name: intl.get('订阅管理(只读)'),
|
||||
value: 'subscriptions:read',
|
||||
},
|
||||
{
|
||||
name: intl.get('配置文件'),
|
||||
value: 'configs',
|
||||
},
|
||||
{
|
||||
name: intl.get('配置文件(只读)'),
|
||||
value: 'configs:read',
|
||||
},
|
||||
{
|
||||
name: intl.get('脚本管理'),
|
||||
value: 'scripts',
|
||||
},
|
||||
{
|
||||
name: intl.get('脚本(只读)'),
|
||||
value: 'scripts:read',
|
||||
},
|
||||
{
|
||||
name: intl.get('日志管理'),
|
||||
value: 'logs',
|
||||
},
|
||||
{
|
||||
name: intl.get('日志管理(只读)'),
|
||||
value: 'logs:read',
|
||||
},
|
||||
{
|
||||
name: intl.get('依赖管理'),
|
||||
value: 'dependencies',
|
||||
},
|
||||
{
|
||||
name: intl.get('依赖管理(只读)'),
|
||||
value: 'dependencies:read',
|
||||
},
|
||||
{
|
||||
name: intl.get('系统信息'),
|
||||
value: 'system',
|
||||
@@ -52,17 +80,29 @@ export default {
|
||||
name: intl.get('仪表盘'),
|
||||
value: 'dashboard',
|
||||
},
|
||||
{
|
||||
name: intl.get('仪表盘(只读)'),
|
||||
value: 'dashboard:read',
|
||||
},
|
||||
],
|
||||
scopesMap: {
|
||||
crons: intl.get('定时任务'),
|
||||
'crons:read': intl.get('定时任务(只读)'),
|
||||
envs: intl.get('环境变量'),
|
||||
'envs:read': intl.get('环境变量(只读)'),
|
||||
subscriptions: intl.get('订阅管理'),
|
||||
'subscriptions:read': intl.get('订阅管理(只读)'),
|
||||
configs: intl.get('配置文件'),
|
||||
'configs:read': intl.get('配置文件(只读)'),
|
||||
scripts: intl.get('脚本管理'),
|
||||
'scripts:read': intl.get('脚本(只读)'),
|
||||
logs: intl.get('日志管理'),
|
||||
'logs:read': intl.get('日志管理(只读)'),
|
||||
dependencies: intl.get('依赖管理'),
|
||||
'dependencies:read': intl.get('依赖管理(只读)'),
|
||||
system: intl.get('系统信息'),
|
||||
dashboard: intl.get('仪表盘'),
|
||||
'dashboard:read': intl.get('仪表盘(只读)'),
|
||||
},
|
||||
notificationModes: [
|
||||
{ value: 'gotify', label: 'Gotify' },
|
||||
|
||||
Reference in new issue
Block a user