Skip to content

Commit 7652a02

Browse files
committed
Add auth regression example
1 parent 1df98ba commit 7652a02

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

examples/auth_regression/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Example: Authorization Regression
2+
3+
## Scenario
4+
5+
An AI coding agent receives the issue:
6+
7+
```text
8+
Add an export endpoint for admin analytics.
9+
```
10+
11+
The agent modifies route and middleware files. The new `/admin/export` endpoint is accidentally reachable by non-admin users.
12+
13+
## Expected OVK behavior
14+
15+
OVK should:
16+
17+
1. detect changes to authorization-sensitive files;
18+
2. select the `no-admin-route-bypass` intent;
19+
3. build a small reachability abstraction;
20+
4. route to the Z3 adapter or policy adapter;
21+
5. return a counterexample showing a non-admin user reaching an admin-only route;
22+
6. generate a regression test;
23+
7. block the PR in enforce mode.
24+
25+
## Counterexample shape
26+
27+
```json
28+
{
29+
"user_role": "user",
30+
"route": "/admin/export",
31+
"path": [
32+
"route_group_added",
33+
"middleware_not_applied",
34+
"handler_reachable"
35+
]
36+
}
37+
```
38+
39+
## Generated regression test shape
40+
41+
```python
42+
def test_non_admin_cannot_export_admin_data(client, make_user, auth):
43+
user = make_user(role="user")
44+
response = client.get("/admin/export", headers=auth(user))
45+
assert response.status_code == 403
46+
```

0 commit comments

Comments
 (0)