Skip to content

Commit

Permalink
Cleanup, improve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jerr0328 committed May 17, 2024
1 parent 0fc1fe0 commit fc69998
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
2 changes: 2 additions & 0 deletions audit_log/headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def parse_spiffe(xfcc_header: str) -> ParsedSPIFFE:
Raises exception if header is invalid.
Note: When using this with Istio, the ingress gateway will also include a SPIFFE header. However, this does not represent the actual principal.
Args:
xfcc_header (str): X-Forwarded-Client-Cert header contents
Expand Down
24 changes: 0 additions & 24 deletions audit_log/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
from functools import singledispatch
from typing import Any

from audit_log.headers import (
ISS_HEADER,
SUB_HEADER,
SUB_TYPE_HEADER,
get_principal_from_headers,
)
from audit_log.schema import (
SCHEMA_VERSION,
ActionType,
Expand Down Expand Up @@ -80,21 +74,3 @@ def log(
}
)
)


if __name__ == "__main__":
headers = {
SUB_HEADER: "[email protected]",
ISS_HEADER: "respect_mime",
SUB_TYPE_HEADER: "USER",
}
principal = get_principal_from_headers(headers)
log(
action_type=ActionType.CREATE,
resource_type="test",
resource_id=uuid.uuid4(),
result=OutcomeResult.SUCCEEDED,
request_id=uuid.uuid4(),
outcome_reason=ValueError("test"), # type: ignore[arg-type] # Purposeful mis-type to verify
principal=principal,
)

0 comments on commit fc69998

Please sign in to comment.