-
Notifications
You must be signed in to change notification settings - Fork 6.5k
fix: code weakness of path traversal #22932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Jayendra Parsai <[email protected]>
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #22932 +/- ##
==========================================
- Coverage 60.03% 60.00% -0.04%
==========================================
Files 344 344
Lines 57781 57787 +6
==========================================
- Hits 34689 34673 -16
- Misses 20333 20356 +23
+ Partials 2759 2758 -1 ☔ View full report in Codecov by Sentry. |
crenshaw-dev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, security concerns should be reported following these directions: https://github.com/argoproj/argo-cd/blob/master/SECURITY.md#reporting-a-vulnerability
|
|
||
| func (server *ArgoCDServer) uiAssetExists(filename string) bool { | ||
| f, err := server.staticAssets.Open(strings.Trim(filename, "/")) | ||
| f, err := server.staticAssets.Open(filepath.Clean(filename)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
server.staticAssets by default only serves an embedded FS, so it shouldn't be vulnerable to traversal.
If the user has specified a --staticassets dir on the API deployment, they expand server.staticAssets to serve on-disk files. By my understanding of os.DirFS can only be escaped via symlinks, not just paths. Either way I'd want to see a PoC of a working exploit.
I think a better way to harden the --staticassets feature would be to use root.FS instead of os.DirFS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I guess I can close this PR then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! Let me know if you have feedback on my PR's approach
This PR is to fix a path traversal vulnerability CWE-22 where a malicious user could potentially craft a URL with special characters (like ../) to try and access files or directories outside of the intended UI asset directory
Here are logs from scanner: