@@ -1754,6 +1754,69 @@ def test_cli_mcp_registry_rejects_skill_only_flags(tmp_path: Path, flag: str) ->
17541754 assert "cannot be combined" in result .output
17551755
17561756
1757+ @pytest .mark .parametrize (
1758+ "flags" ,
1759+ [
1760+ ["--use-shipped-baseline" ],
1761+ ["--transitive" ],
1762+ ["--transitive-depth" , "1" ],
1763+ ["--transitive-depth" , "0" ],
1764+ ["--transitive-depth" , "-1" ],
1765+ ["--transitive-depth" , "2" ],
1766+ ["--transitive-allow-prefix" , "https://example.com/" ],
1767+ ["--transitive-deny-prefix" , "https://example.com/" ],
1768+ ["--transitive-allow-prefix" , "" ],
1769+ ["--transitive-deny-prefix" , "not-a-prefix" ],
1770+ ["--transitive" , "--transitive-depth" , "2" , "--use-shipped-baseline" ],
1771+ ],
1772+ )
1773+ def test_cli_mcp_registry_rejects_ignored_options_before_scanning (
1774+ tmp_path : Path , monkeypatch : pytest .MonkeyPatch , flags : list [str ]
1775+ ) -> None :
1776+ payload = tmp_path / "registry.json"
1777+ payload .write_text ('{"servers": []}' , encoding = "utf-8" )
1778+ output = tmp_path / "report.json"
1779+ output .write_text ("previous report" , encoding = "utf-8" )
1780+ scan_registry = MagicMock (return_value = {"findings" : [], "risk_score" : 0 })
1781+ monkeypatch .setattr (cli , "scan_registry" , scan_registry )
1782+
1783+ result = runner .invoke (
1784+ app ,
1785+ [
1786+ "scan" ,
1787+ str (payload ),
1788+ "--mcp-registry" ,
1789+ "--format" ,
1790+ "json" ,
1791+ "--output" ,
1792+ str (output ),
1793+ * flags ,
1794+ ],
1795+ )
1796+
1797+ assert result .exit_code == 2
1798+ assert "cannot be combined" in result .stderr
1799+ assert flags [0 ] in result .stderr
1800+ assert result .stdout == ""
1801+ assert output .read_text (encoding = "utf-8" ) == "previous report"
1802+ scan_registry .assert_not_called ()
1803+
1804+
1805+ def test_cli_mcp_registry_rejects_configured_transitive_depth (tmp_path : Path ) -> None :
1806+ payload = tmp_path / "registry.json"
1807+ payload .write_text ('{"servers": []}' , encoding = "utf-8" )
1808+
1809+ result = runner .invoke (
1810+ app ,
1811+ ["scan" , str (payload ), "--mcp-registry" , "--format" , "json" ],
1812+ default_map = {"scan" : {"transitive_depth" : 1 }},
1813+ )
1814+
1815+ assert result .exit_code == 2
1816+ assert "--transitive-depth" in result .stderr
1817+ assert result .stdout == ""
1818+
1819+
17571820def test_cli_scan_missing_baseline_exits_2 (tmp_path : Path ) -> None :
17581821 """scan with a --baseline pointing at a missing file exits with code 2."""
17591822 (tmp_path / "SKILL.md" ).write_text ("# Hi" , encoding = "utf-8" )
0 commit comments