Commit 9957c52
committed
fix: validate user_id and session_id against path traversal in FileArtifactService
FileArtifactService validated filenames for path traversal but used
user_id and session_id directly in Path() construction without
validation. A user_id or session_id containing ../ segments could
escape the root_dir. Add _validate_path_segment() to reject path
separators (/, \) and traversal sequences (..) in these parameters.
Fixes #51101 parent 114deef commit 9957c52
File tree
2 files changed
+49
-0
lines changed- src/google/adk/artifacts
- tests/unittests/artifacts
2 files changed
+49
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
65 | 84 | | |
66 | 85 | | |
67 | 86 | | |
| |||
145 | 164 | | |
146 | 165 | | |
147 | 166 | | |
| 167 | + | |
148 | 168 | | |
149 | 169 | | |
150 | 170 | | |
| |||
220 | 240 | | |
221 | 241 | | |
222 | 242 | | |
| 243 | + | |
223 | 244 | | |
224 | 245 | | |
225 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
769 | 769 | | |
770 | 770 | | |
771 | 771 | | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
772 | 800 | | |
773 | 801 | | |
774 | 802 | | |
| |||
0 commit comments