def test_history_import_relpath_in_archive():
 dest_parent = mkdtemp()
 with HistoryArchive(arcname_prefix='../insecure') as history_archive:
  history_archive.write_metafiles()
  history_archive.write_file('datasets/Pasted_Entry_1.txt', 'foo')
  history_archive.finalize()
  _run_unpack(history_archive, dest_parent, 'Relative parent path in import archive allowed')

def test_history_import_relpath_in_archive ( ) : dest_parent = mkdtemp ( ) with HistoryArchive ( arcname_prefix = '../insecure' ) as history_archive : history_archive . write_metafiles ( ) history_archive . write_file ( 'datasets/Pasted_Entry_1.txt' , 'foo' ) history_archive . finalize ( ) _run_unpack ( history_archive , dest_parent , 'Relative parent path in import archive allowed' )
ensure that a history import archive cannot reference a relative path outside the archive .