Publish curated Unraid-AppOps-Gateway source from fe49858778940715742d53eea89241f01878f7ee
This commit is contained in:
1 parent
1a54836efc
commit
29c1e3d5a1
3 files changed
+42
-4
No files matched your search
@@ -172,6 +172,44 @@ def test_runtime_requires_exact_container_mount_port_and_health(controller, monk
|
||||
assert controller._self_upgrade_runtime() is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("source", "accepted"),
|
||||
[
|
||||
("jens/unraid-appops-gateway", True),
|
||||
("https://gitea.example.com/Jens/Unraid-AppOps-Gateway", True),
|
||||
("other/repository", False),
|
||||
("https://evil.example/Jens/Unraid-AppOps-Gateway", False),
|
||||
("https://gitea.example.com/Jens/Other-App", False),
|
||||
("https://gitea.example.com/Jens/Unraid-AppOps-Gateway.evil", False),
|
||||
("http://gitea.example.com/Jens/Unraid-AppOps-Gateway", False),
|
||||
],
|
||||
)
|
||||
def test_runtime_accepts_only_fixed_appops_oci_sources(controller, monkeypatch, source, accepted):
|
||||
monkeypatch.setattr(
|
||||
controller,
|
||||
"_gitea_validation_settings",
|
||||
lambda: ("https://gitea.example.com/api/v1", b"t" * 32),
|
||||
)
|
||||
payload = [{
|
||||
"State": {"Running": True, "Health": {"Status": "healthy"}},
|
||||
"Mounts": [{"Destination": "/data", "Source": "/srv/example/appdata/unraid-appops-gateway-1216", "RW": True}],
|
||||
"Config": {"Labels": {
|
||||
"org.opencontainers.image.revision": "a" * 40,
|
||||
"org.opencontainers.image.source": source,
|
||||
}},
|
||||
"NetworkSettings": {"Ports": {"1216/tcp": [{"HostPort": "1216"}]}},
|
||||
"Image": "sha256:" + "b" * 64,
|
||||
}]
|
||||
|
||||
def fake_run(args, **kwargs):
|
||||
stdout = json.dumps(payload) if args[1] == "inspect" else "Unraid-AppOps-Gateway"
|
||||
return subprocess.CompletedProcess(args, 0, stdout, "")
|
||||
|
||||
monkeypatch.setattr(controller.subprocess, "run", fake_run)
|
||||
|
||||
assert (controller._self_upgrade_runtime() is not None) is accepted
|
||||
|
||||
|
||||
def test_mcp_self_upgrade_rejects_arbitrary_repository(monkeypatch):
|
||||
from backend.app import mcp_server
|
||||
|
||||
|
||||
Reference in new issue
Block a user