Commit 88d7884
feat: enhance pipeFileToResponse with error handling (#7169)
* Enhance pipeFileToResponse with error handling
Added error handling for file streaming in pipeFileToResponse function.
* Security: Fix path traversal vulnerability in pipeFileToResponse with input validation and error handling
Security: Enhance file streaming with comprehensive path validation
- Add path traversal protection in pipeFileToResponse function
- Implement input validation to prevent directory traversal attacks
- Improve error handling for file read operations with proper status codes
- Ensure resolved paths stay within intended directory boundaries
- Add security checks using path.resolve() and startsWith() methods
- Fix CodeQL "Uncontrolled data in path expression" vulnerability
- Maintain backward compatibility while enhancing security
---------
Co-authored-by: Jay <jasonsaayman@gmail.com>1 parent 86b2423 commit 88d7884
1 file changed
+49
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | | - | |
71 | | - | |
72 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
73 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
74 | 115 | | |
75 | | - | |
76 | 116 | | |
77 | 117 | | |
78 | | - | |
79 | 118 | | |
80 | 119 | | |
81 | 120 | | |
| |||
123 | 162 | | |
124 | 163 | | |
125 | 164 | | |
| 165 | + | |
126 | 166 | | |
127 | 167 | | |
128 | 168 | | |
129 | 169 | | |
130 | 170 | | |
131 | 171 | | |
132 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
133 | 176 | | |
134 | 177 | | |
135 | 178 | | |
136 | 179 | | |
| 180 | + | |
137 | 181 | | |
138 | 182 | | |
139 | 183 | | |
| |||
0 commit comments