AS AgentScopeAPI 手册 / API Reference

WorkspaceArchiveExtractor

public class WorkspaceArchiveExtractor
源码Source io/agentscope/harness/agent/sandbox/WorkspaceArchiveExtractor.java:37–114

工作区归档 Extractor,承载智能体的部署、调度与服务化运行。位于 io.agentscope.harness.agent.sandbox 包。核心成员包括 extractTarArchive。

Securely extracts tar archives into a target directory.

Applies strict path traversal guards before extracting each archive entry:

  • Rejects entries with absolute paths (starting with / or \)

  • Rejects entries containing .. path segments

  • Verifies the resolved destination path starts with the canonical root

These guards defend against the "Zip Slip" class of path traversal attacks.

方法摘要Method Summary

方法Method说明Description
public static void extractTarArchive(Path destRoot, InputStream tarStream) throws Exception
static
执行 `extractTarArchive` 方法。
Extracts a tar archive stream into the given destination directory.

方法详情Method Detail

extractTarArchive

public static void extractTarArchive(Path destRoot, InputStream tarStream) throws Exception
static

执行 extractTarArchive 方法。

Extracts a tar archive stream into the given destination directory.

参数Parameters
名称Name类型Type说明Description
destRootPathdest 根(类型 `Path`)。the directory to extract into; must already exist
tarStreamInputStreamtar 流(类型 `InputStream`)。the tar archive input stream; caller is responsible for closing
抛出Throws
  • Exception 可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source io/agentscope/harness/agent/sandbox/WorkspaceArchiveExtractor.java:54–81
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.