From 3d0a050777194319dc06f0891df3c7bfbc4723de Mon Sep 17 00:00:00 2001 From: Sinan Islekdemir Date: Fri, 24 May 2024 13:22:47 +0300 Subject: [PATCH] Rename SERVICE principaly type to SYSTEM --- audit_log/headers.py | 2 +- audit_log/schema.py | 2 +- tests/test_headers.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/audit_log/headers.py b/audit_log/headers.py index 1694850..d6281a3 100644 --- a/audit_log/headers.py +++ b/audit_log/headers.py @@ -97,5 +97,5 @@ def get_principal_from_headers( raise AuditPrincipalError("Invalid SPIFFE header") from e else: return Principal( - type=PrincipalType.SERVICE, authority=spiffe.domain, id=spiffe.spiffe_id + type=PrincipalType.SYSTEM, authority=spiffe.domain, id=spiffe.spiffe_id ) diff --git a/audit_log/schema.py b/audit_log/schema.py index aa6df0e..38a0c29 100644 --- a/audit_log/schema.py +++ b/audit_log/schema.py @@ -6,7 +6,7 @@ class PrincipalType(StrEnum): USER = "USER" - SERVICE = "SERVICE" + SYSTEM = "SYSTEM" class ActionType(StrEnum): diff --git a/tests/test_headers.py b/tests/test_headers.py index b191a5d..7a2ac9d 100644 --- a/tests/test_headers.py +++ b/tests/test_headers.py @@ -57,7 +57,7 @@ def test_parse_spiffe_invalid_header(): def test_get_principal_from_headers_valid(): principal = get_principal_from_headers(VALID_HEADERS) assert isinstance(principal, Principal) - assert principal.type == PrincipalType.SERVICE + assert principal.type == PrincipalType.SYSTEM assert principal.authority == "example.com" assert principal.id == "spiffe://example.com/ns/namespace/sa/service-account" @@ -98,6 +98,6 @@ def test_parse_principal_spiffe_insensitive(): } principal = get_principal_from_headers(headers) assert isinstance(principal, Principal) - assert principal.type == PrincipalType.SERVICE + assert principal.type == PrincipalType.SYSTEM assert principal.authority == "example.com" assert principal.id == "spiffe://example.com/ns/namespace/sa/service-account"