Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename SERVICE principaly type to SYSTEM #7

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion audit_log/headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
2 changes: 1 addition & 1 deletion audit_log/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class PrincipalType(StrEnum):
USER = "USER"
SERVICE = "SERVICE"
SYSTEM = "SYSTEM"


class ActionType(StrEnum):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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"