From 286a865f5f019e7eb8da33cc856a01057ea4acb9 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Mon, 20 Jan 2025 11:56:46 +0100 Subject: [PATCH] Add test to ensure anonymous users cannot provide credentials --- test/integration/test_credentials.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/integration/test_credentials.py b/test/integration/test_credentials.py index 57a100ff7a3f..f3edf266a080 100644 --- a/test/integration/test_credentials.py +++ b/test/integration/test_credentials.py @@ -16,6 +16,11 @@ def test_provide_credential(self): assert len(created_user_credentials[0]["groups"]["default"]["variables"]) == 1 assert len(created_user_credentials[0]["groups"]["default"]["secrets"]) == 3 + def test_anon_users_cannot_provide_credentials(self): + payload = self._build_credentials_payload() + response = self._post("/api/users/current/credentials", data=payload, json=True, anon=True) + self._assert_status_code_is(response, 403) + def test_list_user_credentials(self): source_id = f"test_tool_list_credentials_{uuid4()}" payload = self._build_credentials_payload(source_id=source_id)