Fix Python scripts failing to read relative paths in subdirectories + upgrade multer to patch DoS vulns#2961
Draft
Fix Python scripts failing to read relative paths in subdirectories + upgrade multer to patch DoS vulns#2961
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix relative path issue for config.yaml in Python script
Fix Python scripts failing to read relative paths in subdirectories + upgrade multer to patch DoS vulns
Mar 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Python scripts in subdirectories (e.g.
btdr/app.py) had their working directory set to$dir_scriptsroot instead of the script's own directory, breaking relative file access likeopen('./config.json').Root cause
run_normal()inshell/otask.shhad an[[ ${file_param} != /* ]]guard that skipped thecdinto the script's subdirectory for absolute paths.run_concurrent()andrun_designated()had no such guard and worked correctly.Changes
shell/otask.sh[[ ${file_param} != /* ]] &&from therun_normal()path-handling condition — CWD is now correctly set to the script's directory for both relative and absolute invocations, consistent with the other run modes.shell/preload/sitecustomize.pyos.path.abspath(sys.argv[0])instead of baresys.argv[0]when computing the script's relative path fromdir_scripts. When Python is invoked aspython3 app.pyfrom a subdirectory,sys.argv[0]is justapp.py;abspathresolves it to the full path first sotask_before.shreceivesbtdr/app.pyrather than a bare filename.package.json/pnpm-lock.yamlmulter1.4.5-lts.1→2.1.1and@types/multer^1.4.7→^2.0.0to address 7 DoS CVEs (uncontrolled recursion, resource exhaustion, memory leaks from unclosed streams, unhandled exceptions from malformed requests). The v2 API is backwards-compatible with all usage in this codebase.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.