Commit 3591394
fix: Add path traversal protection for schema file loading
Add validation to prevent path traversal vulnerabilities when loading
structured output schema files. The fix ensures that resolved file paths
remain within the intended schemas directory by validating that the
resolved path starts with the schemas directory path.
This addresses a potential security issue where malicious input could
potentially manipulate file paths through path traversal sequences.
The fix adds checks in two locations:
1. In schemaPathFor() for schema files
2. In getMcpOutputSchema() for the common schema file
Resolves: https://linear.app/getsentry/issue/VULN-1596
Resolves: https://linear.app/getsentry/issue/ENG-7560
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 92c9fe7 commit 3591394
1 file changed
Lines changed: 23 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
77 | 87 | | |
78 | 88 | | |
79 | 89 | | |
| |||
192 | 202 | | |
193 | 203 | | |
194 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
195 | 216 | | |
196 | | - | |
| 217 | + | |
197 | 218 | | |
198 | 219 | | |
199 | 220 | | |
| |||
0 commit comments