mirror of
https://github.com/whyour/qinglong.git
synced 2026-08-05 16:25:04 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ee8fb68839 | |||
| eaafaf3dfc |
@@ -22,6 +22,14 @@ export default ({ app }: { app: Application }) => {
|
||||
app.use(rewrite(`${config.baseUrl}/*`, '/$1'));
|
||||
}
|
||||
|
||||
// Normalize URL path to lowercase to prevent authentication bypass via mixed-case paths
|
||||
// e.g. /API/system/command-run should not bypass JWT checks designed for /api/...
|
||||
// The regex only matches the path portion (stops at ? or #), preserving query strings.
|
||||
app.use((req: Request, res: Response, next: NextFunction) => {
|
||||
req.url = req.url.replace(/^[^?#]*/, (p) => p.toLowerCase());
|
||||
next();
|
||||
});
|
||||
|
||||
app.get(`${config.api.prefix}/env.js`, serveEnv);
|
||||
app.use(`${config.api.prefix}/static`, express.static(config.uploadPath));
|
||||
|
||||
|
||||
@@ -258,16 +258,8 @@ git_clone_scripts() {
|
||||
|
||||
set_proxy "$proxy"
|
||||
|
||||
# Set TMPDIR to /tmp to avoid "unable to get random bytes" error in some Docker environments
|
||||
local original_tmpdir="${TMPDIR:-}"
|
||||
export TMPDIR=/tmp
|
||||
git clone -q --depth=1 $part_cmd $url $dir
|
||||
exit_status=$?
|
||||
if [[ -n "$original_tmpdir" ]]; then
|
||||
export TMPDIR="$original_tmpdir"
|
||||
else
|
||||
unset TMPDIR
|
||||
fi
|
||||
|
||||
unset_proxy
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user