📦 deps(thirdparty): update snapshots
This commit is contained in:
@@ -99,6 +99,12 @@ const eclEnvironmentGuide = fs.readFileSync(
|
||||
'utf8',
|
||||
);
|
||||
const lovableCleanupSkill = fs.readFileSync(path.join(repoRoot, 'skills', 'lovable-cleanup', 'SKILL.md'), 'utf8');
|
||||
const blueprintSkill = fs.readFileSync(path.join(repoRoot, 'skills', 'blueprint', 'SKILL.md'), 'utf8');
|
||||
const uiUpdateSkill = fs.readFileSync(path.join(repoRoot, 'skills', 'ui-update', 'SKILL.md'), 'utf8');
|
||||
const xTwitterScraperSkill = fs.readFileSync(path.join(repoRoot, 'skills', 'x-twitter-scraper', 'SKILL.md'), 'utf8');
|
||||
const agentMemoryMcpSkill = fs.readFileSync(path.join(repoRoot, 'skills', 'agent-memory-mcp', 'SKILL.md'), 'utf8');
|
||||
const speckitUpdaterSkill = fs.readFileSync(path.join(repoRoot, 'skills', 'speckit-updater', 'SKILL.md'), 'utf8');
|
||||
const securityAntivirusGuide = fs.readFileSync(path.join(repoRoot, 'docs', 'users', 'security-and-antivirus.md'), 'utf8');
|
||||
|
||||
function fencedBlocks(content, language) {
|
||||
const blocks = [];
|
||||
@@ -522,6 +528,21 @@ assert.match(
|
||||
/react-native-keychain|expo-secure-store/,
|
||||
'React Native reference should direct token storage to platform-backed secure storage',
|
||||
);
|
||||
for (const [name, content] of [
|
||||
['blueprint', blueprintSkill],
|
||||
['ui-update', uiUpdateSkill],
|
||||
['x-twitter-scraper', xTwitterScraperSkill],
|
||||
['agent-memory-mcp', agentMemoryMcpSkill],
|
||||
]) {
|
||||
assert.match(content, /checkout --detach [0-9a-f]{40}/, `${name} must pin its reviewed external source`);
|
||||
assert.match(content, /mktemp -d/, `${name} must review external content outside active skill paths`);
|
||||
assert.match(content, /explicit (?:user )?approval/i, `${name} must require approval before activation`);
|
||||
}
|
||||
assert.doesNotMatch(uiUpdateSkill, /git reset --hard|Always safe \(do without asking\)|safe and reversible/i);
|
||||
assert.doesNotMatch(speckitUpdaterSkill, /C:\\Users\\bobby/i);
|
||||
assert.match(securityAntivirusGuide, /does not itself run/i);
|
||||
assert.match(securityAntivirusGuide, /does not prove safety/i);
|
||||
assert.match(securityAntivirusGuide, /evidence of execution/i);
|
||||
|
||||
for (const scriptName of ['generate_slides.py', 'create_pdf_slides.py']) {
|
||||
const helpRun = spawnSync(
|
||||
|
||||
@@ -23,6 +23,8 @@ const exactPreview = installer.parseArgs([
|
||||
]);
|
||||
assert.strictEqual(exactPreview.skillsArg, 'frontend-design,game-development/2d-games');
|
||||
assert.strictEqual(exactPreview.dryRun, true);
|
||||
assert.strictEqual(installer.parseArgs(['--all', '--dry-run']).installAll, true);
|
||||
assert.strictEqual(installer.parseArgs(['audit', '--skills', 'frontend-design']).auditOnly, true);
|
||||
assert.deepStrictEqual(
|
||||
installer.parseExactSkillArg(exactPreview.skillsArg),
|
||||
['frontend-design', 'game-development/2d-games'],
|
||||
@@ -40,3 +42,20 @@ assert.doesNotMatch(version.stdout, /Cloning repository/i);
|
||||
const invalid = spawnSync(process.execPath, [installerPath, '--unknown'], { encoding: 'utf8' });
|
||||
assert.notStrictEqual(invalid.status, 0);
|
||||
assert.match(invalid.stderr, /unknown option/i);
|
||||
|
||||
assert.throws(
|
||||
() => installer.assertExplicitInstallSelection(
|
||||
installer.parseArgs(['--all', '--skills', 'frontend-design']),
|
||||
installer.buildInstallSelectors({}),
|
||||
['frontend-design'],
|
||||
),
|
||||
/--all cannot be combined/i,
|
||||
);
|
||||
assert.throws(
|
||||
() => installer.assertExplicitInstallSelection(
|
||||
installer.parseArgs(['audit']),
|
||||
installer.buildInstallSelectors({}),
|
||||
[],
|
||||
),
|
||||
/audit command requires --skills/i,
|
||||
);
|
||||
|
||||
@@ -203,3 +203,27 @@ withTempDir((root) => {
|
||||
"a nested skill that does not match filters must not leak into the installation",
|
||||
);
|
||||
});
|
||||
|
||||
withTempDir((root) => {
|
||||
const repoRoot = path.join(root, "repo");
|
||||
fs.mkdirSync(path.join(repoRoot, "skills"), { recursive: true });
|
||||
fs.mkdirSync(path.join(repoRoot, "docs"), { recursive: true });
|
||||
writeSkill(
|
||||
repoRoot,
|
||||
"audited-skill",
|
||||
'name: audited-skill\ncategory: testing\nrisk: unknown\ntags: [audit]',
|
||||
);
|
||||
fs.appendFileSync(
|
||||
path.join(repoRoot, "skills", "audited-skill", "SKILL.md"),
|
||||
"\n```bash\ngit clone https://example.com/tool.git /tmp/tool\nrm -rf /tmp/tool\n```\n",
|
||||
);
|
||||
const report = installer.auditSkillEntries(repoRoot, ["audited-skill", "docs"]);
|
||||
assert.strictEqual(report.length, 1);
|
||||
assert.strictEqual(report[0].skill, "audited-skill");
|
||||
assert.ok(report[0].findings.some((finding) => finding.categories.includes("external-install")));
|
||||
assert.ok(report[0].findings.some((finding) => finding.categories.includes("destructive-or-irreversible")));
|
||||
assert.deepStrictEqual(
|
||||
installer.buildRiskSummary(repoRoot, ["audited-skill", "docs"]),
|
||||
{ unknown: 1 },
|
||||
);
|
||||
});
|
||||
|
||||
@@ -8,6 +8,12 @@ const HEAD_SHA = "2".repeat(40);
|
||||
const BLOB_SHA = "3".repeat(40);
|
||||
const ZERO_SHA = "0".repeat(40);
|
||||
|
||||
assert.strictEqual(
|
||||
mergeBatch.EVIDENCE_TIMEOUT_MS,
|
||||
300_000,
|
||||
"repository-wide trusted evidence must have a five-minute execution budget",
|
||||
);
|
||||
|
||||
function makeCheckRun(name, status, conclusion, startedAt, id, suiteId = 1) {
|
||||
return {
|
||||
name,
|
||||
|
||||
@@ -209,3 +209,10 @@ test("canonical security fixes are synchronized to distributed plugin mirrors",
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test("BrowserAct never delegates its operating policy to mutable provider guides", () => {
|
||||
const skill = read("skills/browser-act/SKILL.md");
|
||||
assert.doesNotMatch(skill, /^browser-act get-skills\b/m);
|
||||
assert.match(skill, /checked-in Skill remains the complete operating policy/);
|
||||
assert.match(skill, /browser-act <subcommand> --help/);
|
||||
});
|
||||
|
||||
@@ -96,6 +96,23 @@ def init_repo(*, with_skill: bool = True) -> tuple[Path, str]:
|
||||
|
||||
|
||||
class ChangedSkillEvidenceTests(unittest.TestCase):
|
||||
def test_canonical_skill_lookup_checks_only_path_ancestors(self):
|
||||
class NonIterableRoots(set):
|
||||
def __iter__(self):
|
||||
raise AssertionError("canonical lookup must not scan every skill root")
|
||||
|
||||
roots = NonIterableRoots({"parent", "parent/child", "unrelated"})
|
||||
|
||||
self.assertEqual(
|
||||
changed_skill_evidence.canonical_skill_id(
|
||||
"skills/parent/child/references/example.md", roots
|
||||
),
|
||||
"parent/child",
|
||||
)
|
||||
self.assertIsNone(
|
||||
changed_skill_evidence.canonical_skill_id("docs/example.md", roots)
|
||||
)
|
||||
|
||||
def test_mixed_copy_and_rename_keep_distinct_change_types(self):
|
||||
root, base = init_repo()
|
||||
original = root / "skills/example/SKILL.md"
|
||||
@@ -150,6 +167,30 @@ class ChangedSkillEvidenceTests(unittest.TestCase):
|
||||
|
||||
self.assertTrue(any("unsafe_snapshot_regression:100755:run.sh" in reason for reason in report["reasons"]))
|
||||
|
||||
def test_legacy_executable_skill_markdown_can_be_normalized_and_compared(self):
|
||||
root, _ = init_repo()
|
||||
path = root / "skills/example/SKILL.md"
|
||||
os.chmod(path, 0o755)
|
||||
git(root, "add", ".")
|
||||
git(root, "commit", "-m", "legacy executable skill markdown")
|
||||
base = git(root, "rev-parse", "HEAD")
|
||||
path.write_text(
|
||||
path.read_text(encoding="utf-8").replace("risk: safe", "risk: critical"),
|
||||
encoding="utf-8",
|
||||
)
|
||||
os.chmod(path, 0o644)
|
||||
git(root, "add", ".")
|
||||
git(root, "commit", "-m", "normalize skill markdown")
|
||||
|
||||
report = changed_skill_evidence.build_report(root, base, "HEAD")
|
||||
|
||||
change = report["changes"][0]
|
||||
self.assertIsNotNone(change["before"])
|
||||
self.assertIsNotNone(change["after"])
|
||||
self.assertEqual(change["before"]["risk"]["declared"], "safe")
|
||||
self.assertEqual(change["after"]["risk"]["declared"], "critical")
|
||||
self.assertFalse(change["blocking"])
|
||||
|
||||
def test_skill_markdown_replaced_by_gitlink_is_not_treated_as_deletion(self):
|
||||
root, base = init_repo()
|
||||
git(root, "rm", "skills/example/SKILL.md")
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
import importlib.util
|
||||
import pathlib
|
||||
import unittest
|
||||
|
||||
|
||||
REPO_ROOT = pathlib.Path(__file__).resolve().parents[3]
|
||||
SCRIPT_DIR = REPO_ROOT / "skills" / "find-complementary-founders" / "scripts"
|
||||
|
||||
|
||||
def load_module(name: str, filename: str):
|
||||
spec = importlib.util.spec_from_file_location(name, SCRIPT_DIR / filename)
|
||||
if spec is None or spec.loader is None:
|
||||
raise RuntimeError(f"Cannot load {filename}")
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
return module
|
||||
|
||||
|
||||
PUBLISHER = load_module("findmate_moltbook_publish_test", "moltbook_publish.py")
|
||||
GITHUB_THREAD = load_module("findmate_github_thread_test", "github_thread.py")
|
||||
COMMIT = "0123456789abcdef0123456789abcdef01234567"
|
||||
IMMUTABLE_URL = (
|
||||
f"https://github.com/owner/repo/blob/{COMMIT}/profiles/owner-profile.public.json"
|
||||
)
|
||||
|
||||
|
||||
class FindMateProfileUrlTests(unittest.TestCase):
|
||||
def test_accepts_full_sha_pinned_github_blob(self):
|
||||
self.assertEqual(
|
||||
PUBLISHER.immutable_github_profile_url(IMMUTABLE_URL),
|
||||
IMMUTABLE_URL,
|
||||
)
|
||||
body = f"Owner-approved profile: {IMMUTABLE_URL}"
|
||||
self.assertEqual(GITHUB_THREAD.safe_profile_url(body), IMMUTABLE_URL)
|
||||
|
||||
def test_rejects_mutable_or_non_github_profile_urls(self):
|
||||
invalid_urls = [
|
||||
"https://github.com/owner/repo/blob/main/owner-profile.public.json",
|
||||
f"https://example.com/owner/repo/blob/{COMMIT}/owner-profile.public.json",
|
||||
f"https://github.com/owner/repo/blob/{COMMIT}/owner-profile.public.json?raw=1",
|
||||
f"https://github.com/owner/repo/blob/{COMMIT}/profiles/../owner-profile.public.json",
|
||||
]
|
||||
for url in invalid_urls:
|
||||
with self.subTest(url=url):
|
||||
with self.assertRaises(PUBLISHER.PublishError):
|
||||
PUBLISHER.immutable_github_profile_url(url)
|
||||
self.assertIsNone(
|
||||
GITHUB_THREAD.safe_profile_url(
|
||||
f"Owner-approved profile: {url}"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,75 @@
|
||||
import importlib.util
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[3]
|
||||
TOOLS_SCRIPTS_DIR = REPO_ROOT / "tools" / "scripts"
|
||||
if str(TOOLS_SCRIPTS_DIR) not in sys.path:
|
||||
sys.path.insert(0, str(TOOLS_SCRIPTS_DIR))
|
||||
|
||||
|
||||
def load_module(relative_path: str, name: str):
|
||||
spec = importlib.util.spec_from_file_location(name, REPO_ROOT / relative_path)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
assert spec.loader is not None
|
||||
spec.loader.exec_module(module)
|
||||
return module
|
||||
|
||||
|
||||
validate_skills = load_module("tools/scripts/validate_skills.py", "validate_skills_offensive_guardrails")
|
||||
|
||||
|
||||
EXACT_GUARDRAIL = """
|
||||
> **⚠️ AUTHORIZED USE ONLY**
|
||||
> This skill is for educational purposes or authorized security assessments only.
|
||||
> You must have explicit, written permission from the system owner before using this tool.
|
||||
> Misuse of this tool is illegal and strictly prohibited.
|
||||
|
||||
> **Mandatory confirmation gate**
|
||||
> Before running any command that probes, exploits, changes, persists on, extracts data from, or attempts credential access against a target:
|
||||
> 1. Ask the user to state the exact target URL, IP, account, or resource.
|
||||
> 2. Ask the user to confirm written authorization and the permitted scope.
|
||||
> 3. Show the exact command(s) and explain their expected effect.
|
||||
> 4. Wait for explicit confirmation in the current conversation.
|
||||
"""
|
||||
|
||||
|
||||
def write_skill(root: Path, body: str):
|
||||
skill_dir = root / "offensive-test"
|
||||
skill_dir.mkdir(parents=True)
|
||||
(skill_dir / "SKILL.md").write_text(
|
||||
"---\n"
|
||||
"name: offensive-test\n"
|
||||
"description: Test an authorized offensive workflow.\n"
|
||||
"risk: offensive\n"
|
||||
"source: self\n"
|
||||
"date_added: \"2026-07-29\"\n"
|
||||
"---\n\n"
|
||||
f"{body}\n\n"
|
||||
"## When to Use\n\n- Authorized tests only.\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
|
||||
class OffensiveSkillGuardrailTests(unittest.TestCase):
|
||||
def test_generic_disclaimer_without_confirmation_fails(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
skills_dir = Path(tmp) / "skills"
|
||||
write_skill(skills_dir, "> AUTHORIZED USE ONLY: authorized tests only.")
|
||||
results = validate_skills.collect_validation_results(str(skills_dir))
|
||||
self.assertTrue(any("EXACT AUTHORIZED-USE DISCLAIMER" in error for error in results["errors"]))
|
||||
self.assertTrue(any("PER-ACTION CONFIRMATION GATE" in error for error in results["errors"]))
|
||||
|
||||
def test_exact_guardrail_passes_security_checks(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
skills_dir = Path(tmp) / "skills"
|
||||
write_skill(skills_dir, EXACT_GUARDRAIL)
|
||||
results = validate_skills.collect_validation_results(str(skills_dir))
|
||||
self.assertFalse(any("OFFENSIVE SKILL" in error for error in results["errors"]))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user