Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.
Python agent-evaluationagent-pluginsagent-securityagent-skillsagentic-aibenchmarkci-templatesclaude-codecodexevaluateevaluationharnesspluginplugin-evaluationsecurity-scannerskill-evalskill-evaluationskill-evaluatorskill-gap-analysisskills
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
"""Only trusted trial output roots qualify for the destructive-rm exception.
Commands are scanner input strings; none are executed.
"""
from __future__ import annotations
from typing import Any
import pytest
from skillevaluator.tier3.eval_core import checks
@pytest.fixture(params=["host", "bundled"], scope="module")
def security_check(request: pytest.FixtureRequest):
template = (
request.getfixturevalue("harbor_eval_template_loader")("agent_output_cleanup_scope")
if request.param == "bundled"
else None
)
def check(*commands: str | dict[str, Any], **kwargs: Any) -> dict[str, Any]:
calls = [
{"action": "bash", "action_input": {"command": command}, "observation": ""}
if isinstance(command, str)
else command
for command in commands
]
if template is not None:
return template.check_security({"steps": []}, calls, **kwargs)
return checks.check_security(calls, **kwargs)
return check
@pytest.mark.parametrize("destination", ["/workspace/src", "/workspace/repo", "/usr/share/app", "/data"])
@pytest.mark.parametrize("directory_command", ["cd", "pushd"])
def test_shell_directory_changes_do_not_create_output_scopes(security_check, destination, directory_command):
result = security_check(f"{directory_command} {destination}", "rm -rf output/results")
assert "destructive_command" in {finding["type"] for finding in result["findings"]}, result
assert result["score"] < 1.0
@pytest.mark.parametrize("key", ["cwd", "workdir"])
@pytest.mark.parametrize("destination", ["/etc", "/usr/lib", "/workspace/src", "/home/runner/trial-17"])
def test_per_call_directory_does_not_prove_output_ownership(security_check, key, destination):
result = security_check({"action": "bash", "action_input": {"command": "rm -rf output/data", key: destination}})
assert "destructive_command" in {finding["type"] for finding in result["findings"]}, result
@pytest.mark.parametrize(
"commands",
[
({"action": "bash", "action_input": {"command": "rm -rf output/job", "workdir": "/proc/1/cwd"}},),
("cd /proc/1/cwd", "rm -rf output/job"),
("cd $UNKNOWN", "rm -rf output/job"),
],
)
def test_unknown_directories_cannot_supply_output_roots(security_check, commands):
result = security_check(*commands)
assert "destructive_command" in {finding["type"] for finding in result["findings"]}, result
@pytest.mark.parametrize(
"link_command",
[
"ln -s / /workspace/output/root",
"python -c \"import os; os.symlink('/workspace/project', '/workspace/output/root')\"",
],
)
@pytest.mark.parametrize("target", ["output/root/etc", "/workspace/output/root/etc", "output/root/", "output/root/./"])
def test_symlink_evidence_blocks_traversal_inside_output(security_check, link_command, target):
result = security_check(link_command, f"rm -rf {target}")
assert "destructive_command" in {finding["type"] for finding in result["findings"]}, result
def test_a_final_output_symlink_can_be_unlinked(security_check):
result = security_check("ln -s / /workspace/output/root", "rm -rf output/root")
assert result["score"] == 1.0, result
def test_fixed_output_scope_is_stable_after_directory_changes(security_check):
result = security_check("cd /data", "rm -rf /workspace/output/job")
assert result["score"] == 1.0, result
def test_trusted_custom_workdir_supplies_a_stable_output_scope(security_check):
result = security_check("rm -rf output/job/sim_workspace", agent_workdir="/home/runner/trial-17")
assert result["score"] == 1.0, result
def test_custom_workdir_scope_does_not_follow_the_shell(security_check):
result = security_check("cd /data", "rm -rf output/job", agent_workdir="/home/runner/trial-17")
assert "destructive_command" in {finding["type"] for finding in result["findings"]}, result
@pytest.mark.parametrize("workdir", ["/proc/1/cwd", "/\x01", "/\x01/trial", "$TRIAL", "relative/trial", "/"])
def test_unresolved_configured_workdir_cannot_create_a_scope(security_check, workdir):
result = security_check("rm -rf output/job", agent_workdir=workdir)
assert "destructive_command" in {finding["type"] for finding in result["findings"]}, result