File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,18 @@ def create_silent_action(action_func):
187
187
os .path .join (PROJECT_DIR , "sdkconfig.%s" % env .subst ("$PIOENV" )),
188
188
))
189
189
190
+ def contains_path_traversal (url ):
191
+ """Check for Path Traversal patterns"""
192
+ dangerous_patterns = [
193
+ '../' , '..\\ ' , # Standard Path Traversal
194
+ '%2e%2e%2f' , '%2e%2e%5c' , # URL-encoded
195
+ '..%2f' , '..%5c' , # Mixed
196
+ '%252e%252e%252f' , # Double encoded
197
+ ]
198
+
199
+ url_lower = url .lower ()
200
+ return any (pattern in url_lower for pattern in dangerous_patterns )
201
+
190
202
#
191
203
# generate modified Arduino IDF sdkconfig, applying settings from "custom_sdkconfig"
192
204
#
@@ -220,6 +232,11 @@ def load_custom_sdkconfig_file():
220
232
for file_entry in sdkconfig_entries :
221
233
# Handle HTTP/HTTPS URLs
222
234
if "http" in file_entry and "://" in file_entry :
235
+ url = file_entry .split (" " )[0 ]
236
+ # Path Traversal protection
237
+ if contains_path_traversal (url ):
238
+ print (f"Path Traversal detected: { url } check your URL path" )
239
+ else :
223
240
try :
224
241
response = requests .get (file_entry .split (" " )[0 ])
225
242
if response .ok :
You can’t perform that action at this time.
0 commit comments