diff options
| author | omnom62 <omnom62@outlook.com> | 2026-09-22 06:37:12 +1000 |
|---|---|---|
| committer | omnom62 <omnom62@outlook.com> | 2026-09-29 06:58:05 +1000 |
| commit | f75c7b74dc4c2f38ad9e61e08dfe9fd1fc0686f9 (patch) | |
| tree | 93db5dffca052d4bec4ada58c730915bdf255efd /smoketest/scripts/cli | |
| parent | ed218c254d964775ddf24158ac6520972d575faf (diff) | |
| download | vyos-1x-f75c7b74dc4c2f38ad9e61e08dfe9fd1fc0686f9.tar.gz vyos-1x-f75c7b74dc4c2f38ad9e61e08dfe9fd1fc0686f9.zip | |
https: T8989: Hotfix to enforce audience settings with OIDC is configured
Diffstat (limited to 'smoketest/scripts/cli')
| -rwxr-xr-x | smoketest/scripts/cli/test_service_https.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_service_https.py b/smoketest/scripts/cli/test_service_https.py index e7a2ba60a..f432b4d57 100755 --- a/smoketest/scripts/cli/test_service_https.py +++ b/smoketest/scripts/cli/test_service_https.py @@ -521,6 +521,58 @@ class TestHTTPSService(VyOSUnitTestSHIM.TestCase): success = r.json()['data']['ShowVersion']['success'] self.assertTrue(success) + def test_api_oidc_audience_required(self): + # Regression test for GHSA-8pg8-p637-q6ch: OIDC issuer configured + # without audience must be rejected at commit time. Without this + # check, verify_oidc_token() would silently disable aud claim + # validation, accepting any valid token from the trusted issuer + # regardless of which application it was actually issued for. + self.cli_set( + base_path + + [ + 'api', + 'rest', + 'authentication', + 'oidc', + 'issuer', + 'https://idp.example.com', + ] + ) + self.assertRaises(ConfigSessionError, self.cli_commit) + + # Setting audience alongside issuer must allow the commit to succeed. + self.cli_set( + base_path + + ['api', 'rest', 'authentication', 'oidc', 'audience', 'vyos-rest-api'] + ) + self.cli_commit() + + def test_api_oidc_standalone_auth_allowed(self): + # Regression test: OIDC alone (issuer + audience, no API keys, + # no GraphQL token auth, no mTLS) must be sufficient to commit. + # verify()'s "at least one auth method" check previously only + # recognized API keys, GraphQL token auth, and mTLS -- OIDC was + # never added to it despite being introduced in the same PR + # that added mTLS to this same check, so an OIDC-only deployment + # was incorrectly rejected at commit time. + self.cli_set( + base_path + + [ + 'api', + 'rest', + 'authentication', + 'oidc', + 'issuer', + 'https://idp.example.com', + ] + ) + self.cli_set( + base_path + + ['api', 'rest', 'authentication', 'oidc', 'audience', 'vyos-rest-api'] + ) + # No API key configured at all -- this must succeed now. + self.cli_commit() + @ignore_warning(InsecureRequestWarning) def test_api_add_delete(self): url = f'https://{address}/retrieve' |
