Repository navigation
fix: solve CWE 23 - #15761
fix: solve CWE 23#15761alejandro-vaz wants to merge 1 commit into
Conversation
[Medium impact] The change affects the config refresh workflow used by users and helper commands. The PR appears safe to merge, with a non-blocking request to test the new path checks. SummaryAdds path checks to
Reviews (1) · Last reviewed commit: "fix: solve CWE 23" · Reviewed by Greptile |
| user_config_file=$(realpath -m -- "$user_config_root/$config_file") || { | ||
| echo "Could not resolve user config path: $config_file" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| if [[ $user_config_file != "$user_config_root/"* ]]; then | ||
| echo "Config path must stay inside .config: $config_file" >&2 | ||
| exit 1 |
There was a problem hiding this comment.
The new path checks have no regression tests. refresh-config-test.sh only covers copying a normal file and rejecting a missing source, so a later change could undo these checks without failing the tests.
Add cases for absolute paths, .. components, source and destination symlinks that escape their roots, and a missing destination directory. For rejected paths, assert that outside files stay unchanged.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Comments Outside DiffThese findings could not be posted inline.
|
|
Thanks for this. I read the change against The question is whether this fixes something broken. Every caller in the repository (the There's also a behaviour change to weigh. This now waits on the maintainer to decide whether the hardening is wanted. |
|
Thanks @alejandro-vaz. The |
this PR solves the weakness affecting
omarchy-refresh-configwhich accepts any path relative path traversal and can leak data outwardsit is solved by verifying the relative path stays within config