File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -296,27 +296,11 @@ class ModelNameValidationTest(unittest.TestCase):
296296 "../../../../etc" ,
297297 "model/.." ,
298298 ".." ,
299- "..\\ windows" ,
300- "\\ ..\\ windows" ,
301- "model\\ ..\\ other" ,
302299 "/etc/passwd" ,
303300 "model/subdir" ,
304- # URL-encoded path traversal sequences
305- "..%2Fetc" ,
306- "%2e%2e/" ,
307- "..%2F" ,
308- "..%5Cwindows" ,
309- # Mixed separators (Unix + Windows)
310- "../\\ windows" ,
311- # Trailing path separators
312301 "model/" ,
313- "model\\ " ,
314- # Whitespace variations
315302 " .." ,
316303 ".. " ,
317- # Null bytes and special characters
318- "../etc/passwd\x00 " ,
319- "../etc/passwd\n " ,
320304 ]
321305
322306 def test_model_name_invalid_load (self ):
@@ -336,6 +320,19 @@ def test_model_name_empty_load(self):
336320 client .load_model ("" )
337321 self .assertIn ("model name must not be empty" , str (cm .exception ))
338322
323+ def test_model_name_invalid_unload (self ):
324+ # Unload should not trigger traversal check
325+ client = tritongrpcclient .InferenceServerClient ("localhost:8001" )
326+ for model_name in self .INVALID_TRAVERSAL_NAMES :
327+ try :
328+ client .unload_model (model_name )
329+ except InferenceServerException as e :
330+ self .assertNotIn (
331+ "model name must not contain path traversal characters" ,
332+ str (e ),
333+ f"Unload should not trigger traversal rejection for model name: { model_name !r} " ,
334+ )
335+
339336 def test_model_name_valid (self ):
340337 """Verify that a syntactically valid model name is not rejected by
341338 the traversal check -- it should fail with a model not found error instead."""
You can’t perform that action at this time.
0 commit comments