codetether-agent 4.7.0-a-002.4

A2A-native AI coding agent for the CodeTether ecosystem
Documentation
use serde_json::json;

use crate::tool::Tool;
use crate::tool::tetherscript::TetherScriptPluginTool;

#[tokio::test]
async fn rejects_project_file_escape() {
    let dir = tempfile::tempdir().unwrap();
    let root = dir.path().join("workspace");
    tokio::fs::create_dir_all(&root).await.unwrap();
    let outside = dir.path().join("outside.tether");
    tokio::fs::write(&outside, r#"fn validate() { return Ok("bad") }"#)
        .await
        .unwrap();

    let tool = TetherScriptPluginTool::with_root(root);
    let result = tool
        .execute(json!({
            "path": "../outside.tether",
            "hook": "validate"
        }))
        .await
        .unwrap();

    assert!(!result.success);
    assert!(result.output.contains("escapes workspace root"));
}