Identity, Authorization, and Least Privilege › Measuring boundary behavior across many requests

Michael BrenndoerferDecember 2, 20264 min read
Language AI HandbookAll chapters
Part 61 of 67Agentic AI and Protocol Security
Chapter 468Identity, Authorization, and Least Privilege › Measuring boundary behavior across many requests
Reading section 7 of 11 · Measuring boundary behavior across many requests · 4 minSection 7 of 11 · 4 min

Section 7 of 11 · 4 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

A single decision is easy to trace. A small matrix lets us see whether the notebook covers every result label we introduced. Reuse the same cases for the matrix and the output table so the caption and counts have one source. Each row belongs to the operation the case proposes and each column belongs to its decision. The resulting counts measure the fixtures we chose. They say nothing about how often a production user will see a denial.

A count table is convenient when a project first introduces a new reason label. If every test still reaches an older rule before it can reach the new rule, the new reason may have no recorded examples. Count coverage gives a hint about this problem. The actual assertions remain the stronger signal because each names the intended expected decision.

The notebook groups the common, delegation, and approval cases by operation and counts the resulting verdicts. There is no random sampling. The total number of requests is the sum of the sizes of the three sets because each case in each set is evaluated once for the table. When a request changes two conditions, the test labels why that case is useful and what its diagnostic priority measures.

In a service review, the corresponding table would need a definition of its population. For example, a count could refer to all evaluated request attempts during one policy version, with retries still counted as distinct attempts. A count grouped by unique tasks answers a different question. The decision labels in this fixture are useful without assuming anything about the prevalence of one kind of request.

PythonIn [15]
CollapseExpand
from collections import Counter

combined_cases = [
    *scenarios.values(),
    *chain_cases.values(),
    *approval_cases.values(),
]
counts_by_op = {op: Counter() for op in Op}
for context, _ in combined_cases:
    counts_by_op[context.op][evaluate(context)] += 1

decision_counts = [
    sum(counts_by_op[op][decision] for op in Op) for decision in Decision
]
assert sum(decision_counts) == len(combined_cases)
PythonIn [16]
CollapseExpand
decision_labels = [decision.value for decision in Decision]

print(f"{'operation':16}", *(f"{label:>8}" for label in decision_labels))
for operation, counts in counts_by_op.items():
    if sum(counts.values()):
        print(
            f"{operation.value:16}",
            *(f"{counts[decision]:>8}" for decision in Decision),
        )
ConsoleOut [16]
CollapseExpand
operation           Allow     Deny   StepUp  Expired  Revoked
read draft              3       11        0        1        2
mark ready              1        2        3        0        0

The printed rows include operations that appear in the examples. The figure aggregates over operations and shows the number of cases leading to each label. The bars share a linear count axis starting from zero. Their lengths are counts from the same set of assertions checked earlier.

VisualizationOut [17]
CollapseExpand
A bar chart of the number of invented cases in each of five authorization verdicts.
Counts by verdict for the invented request cases. Each case contributes to one verdict. The relative bar lengths reflect the cases chosen for this notebook.

The Deny bar includes several separate reasons. The earlier named cases show which condition each is designed to test. Expired and Revoked are deliberately visible beside it, and StepUp still differs from Allow. Those distinctions are useful when reviewing why a workflow paused. In a monitoring system, a rise in any one label is a reason to investigate contributing requests and policy changes. The label alone does not establish the cause.

The operation rows also make a missing dimension easy to spot. The chapter defines four operations but the selected requests propose only read and mark ready. Review-read and annotate appear in delegation scope tests while remaining absent as proposed operations. The notebook checks the authority relationships it names. A more complete service regression suite needs positive and negative scenarios for every operation it exposes, including operation-specific effects and authorization decisions after an approval expires.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy