49 lines
1.5 KiB
Python
49 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
import argparse
|
|
import json
|
|
|
|
from kings_guard.adapters import observation_from_audit_event
|
|
from kings_guard.contracts import as_jsonable
|
|
from kings_guard.fixtures import load_qonto_assistant_pilot
|
|
from kings_guard.posture import PostureEvaluator
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(description="Run the Kings Guard pilot posture demo.")
|
|
parser.add_argument(
|
|
"--pilot",
|
|
default="qonto-assistant",
|
|
choices=["qonto-assistant"],
|
|
help="Pilot bundle to evaluate.",
|
|
)
|
|
args = parser.parse_args()
|
|
|
|
if args.pilot != "qonto-assistant":
|
|
raise SystemExit(f"Unsupported pilot: {args.pilot}")
|
|
|
|
fixture = load_qonto_assistant_pilot()
|
|
observation = observation_from_audit_event(
|
|
fixture.audit_event,
|
|
subject_id=fixture.normalization_hints["subject_id"],
|
|
capability_scope=fixture.normalization_hints["capability_scope"],
|
|
identity_binding=fixture.normalization_hints["identity_binding"],
|
|
egress_destination=fixture.normalization_hints["egress_destination"],
|
|
)
|
|
evaluation = PostureEvaluator().evaluate(fixture.genome, observation)
|
|
print(
|
|
json.dumps(
|
|
{
|
|
"pilot": args.pilot,
|
|
"source_notes": list(fixture.source_notes),
|
|
"observation": as_jsonable(observation),
|
|
"evaluation": as_jsonable(evaluation),
|
|
},
|
|
indent=2,
|
|
sort_keys=True,
|
|
)
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|