Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

docs(contributing): define secure development requirements (#5229)

Qin Haojie701d12097057
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 37a7c5040..dbc4c0d84 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -170,6 +170,34 @@ If a local edge case starts changing task boundaries, public semantics, or the
overall architecture, stop and return to the design discussion instead of adding
special branches throughout the main path.
+### Security Requirements
+
+These requirements define the security boundaries that OpenViking changes must preserve. They are review and remediation requirements, not a claim that every existing feature or released version already satisfies them.
+
+#### Untrusted input must not become executable commands
+
+Treat external requests, tool arguments, imported data, metadata, and model-generated output as untrusted. Authentication or access to a resource does not grant permission to execute commands on the server.
+
+- Do not interpolate untrusted values into shell commands or executable code. Data operations must preserve the distinction between data and instructions, including in downstream tools and integrations.
+- When an external program is necessary, use a server-controlled executable and structured arguments. Disabling the shell is not sufficient: validate values according to their domain and prevent them from being interpreted as options. Use option terminators where supported; do not expose arbitrary command or extra-argument passthrough through ordinary data APIs.
+- Control executable lookup, child-process environment, and tool configuration. Untrusted input must not enable additional execution capabilities through configuration or other indirect mechanisms. Ambient configuration must not silently expand the privileges or behavior of a server operation.
+- Agent and Skill execution exposed through server workflows must run in an isolated environment with explicitly scoped filesystem, network, and credential access. Do not default or fall back to host execution. A working directory, prompt instruction, or command denylist is not a sandbox. Disabling command execution must also prevent execution through file tools or other indirect paths.
+
+#### Remote operations must not access arbitrary server files
+
+Server APIs operate on authorized OpenViking resources and uploads, not arbitrary host paths. Legitimate access to service-managed storage must remain scoped to the authenticated account, user, and resource permissions.
+
+- Do not accept server-local paths or `file://` URLs as a way to ingest, read, search, preview, or export host files. Remote clients must use authorized resource URIs or uploads owned by the requesting principal. Do not expose server configuration, credentials, process-environment files, or another tenant's data through these operations or their error responses.
+- Enforce containment and authorization at the layer that resolves and performs the actual file operation. Validate the resolved target, including traversal, encoded paths, absolute paths, symbolic links, and archive entries. Checking only the original path string or a caller's initial directory is insufficient; every accessed file must remain inside its permitted boundary.
+- Apply the same boundary to indirect access: imported repositories and archives, uploaded files, generated artifacts, search results, and agent tools must not bypass it. Remote fetches and redirects must not turn into local-file access or unauthorized access to internal services.
+- Local operator workflows may intentionally access local files or run administrative commands. Such privileges must be explicit and must not become remotely selectable through request parameters, tool arguments, or imported content.
+
+#### Validation and reporting
+
+For changes affecting these boundaries, trace untrusted input through the real API, service, native binding, external program, and filesystem paths that apply. Validate option-like values, shell metacharacters, crafted file contents, traversal and symlink cases, and cross-tenant access at the relevant boundary. Use focused contract coverage or bounded reproductions; a successful normal request alone does not establish isolation.
+
+Command or argument injection, arbitrary server-file access, and escapes from the intended execution or tenant boundary are security issues. Report suspected violations through the private channels in [SECURITY.md](SECURITY.md). Public documentation and pull requests should describe the required boundary without disclosing an unremediated exploit or sensitive data.
+
### Code Style
Python uses Ruff for formatting and linting, and mypy for type checking. The
diff --git a/CONTRIBUTING_CN.md b/CONTRIBUTING_CN.md
index 4b964266d..849209979 100644
--- a/CONTRIBUTING_CN.md
+++ b/CONTRIBUTING_CN.md
@@ -149,6 +149,34 @@ SDK、Integration、Plugin 和 Benchmark 可能有额外要求,请查看对应
如果局部边缘 Case 开始改变任务边界、公开语义或整体架构,应暂停实现并回到设计讨论,
不要在主流程中不断增加特殊分支。
+### 安全开发要求
+
+以下要求定义了 OpenViking 的变更必须遵守的安全边界,用于开发评审和安全整改,不代表所有现有功能或已发布版本都已符合要求。
+
+#### 不可信输入不得转变为可执行命令
+
+外部请求、工具参数、导入数据、元数据和模型输出都必须视为不可信输入。通过身份认证或拥有资源访问权限,不代表拥有在服务器上执行命令的权限。
+
+- 不得将不可信值拼接进 Shell 命令或可执行代码。数据操作必须始终区分数据与指令,下游工具和集成也必须遵守这一要求。
+- 确实需要调用外部程序时,必须使用由服务端控制的可执行程序和结构化参数。仅禁用 Shell 并不足够,还必须按业务语义校验输入,防止其被解释为命令选项。在支持时使用选项结束标记;不得通过普通数据 API 提供任意命令或额外命令参数的透传能力。
+- 必须控制可执行程序的查找路径、子进程环境和工具配置。不可信输入不得通过配置或其他间接机制启用额外执行能力。环境中隐式继承的配置不得悄然扩大服务端操作的权限或行为范围。
+- 通过服务端工作流提供的 Agent 和 Skill 执行能力,必须运行在隔离环境中,并明确限制文件系统、网络和凭据的访问范围。不得默认在宿主机执行,也不得回退到宿主机执行。工作目录、提示词和命令黑名单都不能代替沙箱。禁用命令执行时,也必须阻止通过文件工具或其他间接路径执行命令。
+
+#### 远程操作不得访问任意服务器文件
+
+服务端 API 应操作经过授权的 OpenViking 资源和上传文件,不得访问任意宿主机路径。对服务管理的存储进行合法访问时,也必须遵守已认证账号、用户和资源权限限定的范围。
+
+- 不得接受服务器本地路径或 `file://` URL,用于导入、读取、搜索、预览或导出宿主机文件。远程客户端必须使用经过授权的资源 URI,或属于请求主体的上传文件。不得通过这些操作或错误响应暴露服务器配置、凭据、进程环境相关文件或其他租户的数据。
+- 必须在解析路径并实际执行文件操作的层级落实路径范围限制和权限校验。检查解析后的最终目标,覆盖路径穿越、编码路径、绝对路径、符号链接和归档文件条目。仅检查原始路径字符串或调用方的初始目录并不足够;每个被访问的文件都必须处于允许范围内。
+- 间接访问也必须遵守同样的边界:导入的代码仓库和归档文件、上传文件、生成产物、搜索结果及 Agent 工具都不得绕过限制。远程获取和重定向不得转变为本地文件访问或未经授权的内部服务访问。
+- 本地运维流程可以按设计访问本地文件或执行管理命令,但这些权限必须明确授予,不能让远程调用方通过请求参数、工具参数或导入内容获得这些权限。
+
+#### 验证与报告
+
+涉及上述边界的修改,必须沿真实调用链追踪不可信输入,覆盖相关 API、服务层、原生绑定层、外部程序和文件系统操作。在相应边界验证形似命令选项的输入、Shell 特殊字符、特制文件内容、路径穿越、符号链接和跨租户访问。通过聚焦的契约测试或范围受控的复现进行验证;正常请求成功不能证明隔离有效。
+
+命令或参数注入、任意服务器文件访问,以及突破预定执行边界或租户边界的行为都属于安全问题。疑似问题应通过 [SECURITY.md](SECURITY.md) 中的私密渠道报告。公开文档和 PR 应说明必须遵守的安全边界,不得披露尚未修复问题的利用方法或敏感数据。
+
### 代码风格
Python 使用 Ruff 进行格式化和 Lint,使用 mypy 进行类型检查,配置行宽为 100 字符。
diff --git a/CONTRIBUTING_JA.md b/CONTRIBUTING_JA.md
index 89966ebe5..ab08b7d14 100644
--- a/CONTRIBUTING_JA.md
+++ b/CONTRIBUTING_JA.md
@@ -163,6 +163,34 @@ SDK、Integration、Plugin、Benchmarkには追加のセットアップ手順が
局所的なエッジケースがタスク境界、公開セマンティクス、全体アーキテクチャを変え始めた場合は、
メインフローに特殊分岐を追加し続けず、実装を止めて設計議論に戻ってください。
+### セキュリティ要件
+
+以下の要件は、OpenVikingの変更で維持すべきセキュリティ境界を定義します。レビューと是正のための要件であり、既存のすべての機能やリリース済みバージョンがすでに満たしていることを示すものではありません。
+
+#### 信頼できない入力を実行可能なコマンドにしない
+
+外部リクエスト、ツール引数、インポートされたデータ、メタデータ、モデルが生成した出力は、すべて信頼できない入力として扱ってください。認証済みであることやリソースへのアクセス権があることは、サーバー上でコマンドを実行する権限を意味しません。
+
+- 信頼できない値をシェルコマンドや実行可能なコードに埋め込まないでください。データ操作では、下流のツールや連携先も含め、データと命令を明確に区別してください。
+- 外部プログラムが必要な場合は、サーバー側で管理する実行ファイルと構造化された引数を使用してください。シェルを無効にするだけでは不十分です。値をドメインの意味に従って検証し、オプションとして解釈されないようにしてください。対応している場合はオプション終端記号を使用し、通常のデータAPIから任意のコマンドや追加のコマンド引数を透過的に渡せるようにしないでください。
+- 実行ファイルの検索、子プロセスの環境、ツール設定を管理してください。信頼できない入力が、設定やその他の間接的な仕組みを通じて実行能力を追加できてはなりません。環境から暗黙に継承した設定によって、サーバー操作の権限や動作範囲が拡大しないようにしてください。
+- サーバーワークフローで提供するAgentやSkillの実行は、ファイルシステム、ネットワーク、認証情報へのアクセス範囲を明示した隔離環境で行ってください。ホスト上での実行をデフォルトやフォールバックにしないでください。作業ディレクトリ、プロンプト指示、コマンド拒否リストはサンドボックスの代わりにはなりません。コマンド実行を無効にする場合は、ファイルツールやその他の間接経路からの実行も防いでください。
+
+#### リモート操作から任意のサーバーファイルにアクセスさせない
+
+サーバーAPIは、認可されたOpenVikingリソースとアップロードファイルを操作し、任意のホストパスにはアクセスしないでください。サービスが管理するストレージへの正当なアクセスも、認証されたアカウント、ユーザー、リソース権限の範囲内に限定してください。
+
+- ホストファイルの取り込み、読み取り、検索、プレビュー、エクスポートのために、サーバーのローカルパスや`file://` URLを受け付けないでください。リモートクライアントは、認可されたリソースURI、またはリクエスト主体が所有するアップロードファイルを使用する必要があります。これらの操作やエラーレスポンスを通じて、サーバー設定、認証情報、プロセス環境に関するファイル、他テナントのデータを公開しないでください。
+- パスを解決して実際のファイル操作を行うレイヤーで、許可範囲への制限と認可を適用してください。解決後の対象を検証し、パストラバーサル、エンコードされたパス、絶対パス、シンボリックリンク、アーカイブ内のエントリを考慮してください。元のパス文字列や呼び出し元の初期ディレクトリの確認だけでは不十分です。アクセスするすべてのファイルを許可された境界内に保ってください。
+- 間接的なアクセスにも同じ境界を適用してください。インポートされたリポジトリやアーカイブ、アップロードファイル、生成物、検索結果、Agentツールが制限を迂回してはなりません。リモート取得やリダイレクトが、ローカルファイルへのアクセスや内部サービスへの未認可アクセスに変わらないようにしてください。
+- ローカルの運用手順では、意図的にローカルファイルへアクセスしたり管理コマンドを実行したりする場合があります。ただし、その権限は明示的に付与し、リクエストパラメーター、ツール引数、インポート内容を通じてリモートから取得できないようにしてください。
+
+#### 検証と報告
+
+これらの境界に影響する変更では、信頼できない入力を、該当する実際のAPI、サービス、ネイティブバインディング、外部プログラム、ファイルシステム操作まで追跡してください。関連する境界で、オプションに見える値、シェルの特殊文字、細工されたファイル内容、パストラバーサル、シンボリックリンク、テナントをまたぐアクセスを検証してください。焦点を絞った契約テストや範囲を制限した再現で確認してください。通常のリクエストが成功するだけでは、隔離の有効性を証明できません。
+
+コマンドや引数のインジェクション、任意のサーバーファイルへのアクセス、意図した実行境界やテナント境界からの逸脱は、セキュリティ問題です。疑わしい問題は[SECURITY.md](SECURITY.md)に記載された非公開の窓口から報告してください。公開ドキュメントやPRでは必要な境界を説明し、未修正の問題の悪用方法や機密データを公開しないでください。
+
### コードスタイル
PythonではRuffをフォーマットとLintに、mypyを型チェックに使用します。設定行幅は100文字です。