已实施的安全加固措施
第一层防御:启用Express严格路由(第17-18行)
app.set('case sensitive routing', true); // 路由大小写敏感
app.set('strict routing', true); // 严格路由匹配
第二层防御:路径标准化检查中间件(第23-37行)
app.use((req, res, next) => {
const originalPath = req.path;
const normalizedPath = originalPath.toLowerCase();
// 检测并拦截大小写混淆攻击
if (originalPath !== normalizedPath &&
(normalizedPath.startsWith('/api/') || normalizedPath.startsWith('/open/'))) {
return res.status(400).json({
code: 400,
message: 'Invalid path format'
});
}
next();
});
作用:主动检测并拒绝含有大小写变体的恶意请求
第三层防御:JWT中间件正则表达式修复(第59行)
// 修复前:
path: [...config.apiWhiteList, /^\/(?!api\/).*/],
// 修复后:添加大小写不敏感标志 'i'
path: [...config.apiWhiteList, /^(\/(?!api\/).*)$/i],
作用:防御正则匹配层面的绕过
第四层防御:自定义Token中间件路径标准化(第74-87行)
// 修复前:
if (!['/open/', '/api/'].some((x) => req.path.startsWith(x))) {
// 修复后:统一转小写比较
const pathLower = req.path.toLowerCase();
if (!['/open/', '/api/'].some((x) => pathLower.startsWith(x))) {
}
作用:确保Token验证逻辑对所有路径变体生效
第五层防御:初始化接口路径检查修复(第122-123行)
// 修复前:
if (!['/api/user/init', '/api/user/notification/init'].includes(req.path)) {
// 修复后:
const pathLower = req.path.toLowerCase();
if (!['/api/user/init', '/api/user/notification/init'].includes(pathLower)) {
|
||
|---|---|---|
| .github | ||
| back | ||
| docker | ||
| sample | ||
| shell | ||
| src | ||
| .editorconfig | ||
| .env.example | ||
| .gitignore | ||
| .npmrc | ||
| .prettierignore | ||
| .prettierrc | ||
| .umirc.ts | ||
| ecosystem.config.js | ||
| LICENSE | ||
| nodemon.json | ||
| package.json | ||
| pnpm-lock.yaml | ||
| README-en.md | ||
| README.md | ||
| SECURITY.md | ||
| tsconfig.json | ||
| typings.d.ts | ||
| version.yaml | ||
青龙
简体中文 | English
支持 Python3、JavaScript、Shell、Typescript 的定时任务管理平台
Timed task management platform supporting Python3, JavaScript, Shell, Typescript
Demo / Issues / Telegram Channel / Buy Me a Coffee
演示 / 反馈 / Telegram 频道 / 打赏开发者
功能
- 支持多种脚本语言(python3、javaScript、shell、typescript)
- 支持在线管理脚本、环境变量、配置文件
- 支持在线查看任务日志
- 支持秒级任务设置
- 支持系统级通知
- 支持暗黑模式
- 支持手机端操作
版本
docker
latest 镜像是基于 alpine 构建,debian 镜像是基于 debian-slim 构建。如果需要使用 alpine 不支持的依赖,建议使用 debian 镜像
⚠️ 重要提示: 如果您需要以非 root 用户运行 Docker,请使用 debian 镜像。Alpine 的 crond 需要 root 权限。
docker pull whyour/qinglong:latest
docker pull whyour/qinglong:debian
npm
npm 版本支持 debian/ubuntu/alpine 系统,需要自行安装 node/npm/python3/pip3/pnpm
npm i @whyour/qinglong
部署
内置 API
内置命令
开发
git clone https://github.com/whyour/qinglong.git
cd qinglong
cp .env.example .env
# 推荐使用 pnpm https://pnpm.io/zh/installation
npm install -g pnpm@8.3.1
pnpm install
pnpm start
打开你的浏览器,访问 http://127.0.0.1:5700
链接
名称来源
青龙,又名苍龙,在中国传统文化中是四象之一、天之四灵之一,根据五行学说,它是代表东方的灵兽,为青色的龙,五行属木,代表的季节是春季,八卦主震。苍龙与应龙一样,都是身具羽翼。《张果星宗》称“又有辅翼,方为真龙”。
《后汉书·律历志下》记载:日周于天,一寒一暑,四时备成,万物毕改,摄提迁次,青龙移辰,谓之岁。
在中国二十八宿中,青龙是东方七宿(角、亢、氐、房、心、尾、箕)的总称。 在早期星宿信仰中,祂是最尊贵的天神。 但被道教信仰吸纳入其神系后,神格大跌,道教将其称为“孟章”,在不同的道经中有“帝君”、“圣将”、“神将”和“捕鬼将”等称呼,与白虎监兵神君一起,是道教的护卫天神。
