@@ -144,36 +144,36 @@ def test_prepare_output_makes_dir(mock_exists, mock_makedirs):
144144@pytest .fixture
145145def symlink_env ():
146146 """A working dir (the allowed root, via cwd) containing a normal file and a
147- symlink pointing at a secret file OUTSIDE that root.
147+ symlink pointing at a file OUTSIDE that root.
148148
149149 The working directory is the allowed root for path validation, so we chdir
150150 into ``work_dir`` rather than relying on CREWAI_TOOLS_ALLOWED_DIRS. This
151151 keeps the test independent of the configurable-allow-list feature and
152152 exercises the default cwd confinement.
153153 """
154154 work_dir = os .path .realpath (tempfile .mkdtemp ())
155- secret_dir = os .path .realpath (tempfile .mkdtemp ()) # outside the allowed root
156- secret_file = os .path .join (secret_dir , "secret .txt" )
157- with open (secret_file , "w" ) as f :
158- f .write ("TOP_SECRET_PRIVATE_KEY " )
155+ outside_dir = os .path .realpath (tempfile .mkdtemp ()) # outside the allowed root
156+ outside_file = os .path .join (outside_dir , "outside .txt" )
157+ with open (outside_file , "w" ) as f :
158+ f .write ("OUTSIDE_FILE_MARKER " )
159159
160160 src = os .path .join (work_dir , "src" )
161161 os .makedirs (src )
162162 with open (os .path .join (src , "normal.txt" ), "w" ) as f :
163163 f .write ("safe content" )
164- os .symlink (secret_file , os .path .join (src , "leak.txt" ))
164+ os .symlink (outside_file , os .path .join (src , "leak.txt" ))
165165
166166 prev_cwd = os .getcwd ()
167167 os .chdir (work_dir )
168168 yield {
169169 "work_dir" : work_dir ,
170170 "src" : src ,
171- "secret_dir " : secret_dir ,
172- "secret_file " : secret_file ,
171+ "outside_dir " : outside_dir ,
172+ "outside_file " : outside_file ,
173173 }
174174 os .chdir (prev_cwd )
175175 shutil .rmtree (work_dir , ignore_errors = True )
176- shutil .rmtree (secret_dir , ignore_errors = True )
176+ shutil .rmtree (outside_dir , ignore_errors = True )
177177
178178
179179def test_zip_excludes_symlink_to_outside_file (tool , symlink_env ):
@@ -189,7 +189,7 @@ def test_zip_excludes_symlink_to_outside_file(tool, symlink_env):
189189 assert "normal.txt" in names
190190 assert "leak.txt" not in names
191191 blob = b"" .join (zf .read (n ) for n in names )
192- assert b"TOP_SECRET_PRIVATE_KEY " not in blob
192+ assert b"OUTSIDE_FILE_MARKER " not in blob
193193
194194
195195def test_tar_excludes_symlink_to_outside_file (tool , symlink_env ):
@@ -213,14 +213,14 @@ def test_tar_excludes_symlink_to_outside_file(tool, symlink_env):
213213def test_compress_zip_validates_output_path_at_sink (symlink_env ):
214214 # Calling the compressor directly (bypassing _run) must still refuse to
215215 # write outside the allow-list.
216- outside = os .path .join (symlink_env ["secret_dir " ], "evil.zip" )
216+ outside = os .path .join (symlink_env ["outside_dir " ], "evil.zip" )
217217 with pytest .raises (ValueError , match = "outside the allowed director" ):
218218 FileCompressorTool ._compress_zip (symlink_env ["src" ], outside )
219219 assert not os .path .exists (outside )
220220
221221
222222def test_compress_tar_validates_output_path_at_sink (symlink_env ):
223- outside = os .path .join (symlink_env ["secret_dir " ], "evil.tar.gz" )
223+ outside = os .path .join (symlink_env ["outside_dir " ], "evil.tar.gz" )
224224 with pytest .raises (ValueError , match = "outside the allowed director" ):
225225 FileCompressorTool ._compress_tar (symlink_env ["src" ], outside , "tar.gz" )
226226 assert not os .path .exists (outside )
@@ -229,12 +229,12 @@ def test_compress_tar_validates_output_path_at_sink(symlink_env):
229229def test_compress_zip_validates_input_path_at_sink (symlink_env ):
230230 out = os .path .join (symlink_env ["work_dir" ], "archive.zip" )
231231 with pytest .raises (ValueError , match = "outside the allowed director" ):
232- FileCompressorTool ._compress_zip (symlink_env ["secret_file " ], out )
232+ FileCompressorTool ._compress_zip (symlink_env ["outside_file " ], out )
233233 assert not os .path .exists (out )
234234
235235
236236def test_compress_tar_validates_input_path_at_sink (symlink_env ):
237237 out = os .path .join (symlink_env ["work_dir" ], "archive.tar.gz" )
238238 with pytest .raises (ValueError , match = "outside the allowed director" ):
239- FileCompressorTool ._compress_tar (symlink_env ["secret_file " ], out , "tar.gz" )
239+ FileCompressorTool ._compress_tar (symlink_env ["outside_file " ], out , "tar.gz" )
240240 assert not os .path .exists (out )
0 commit comments