Skip to content

feat(flows): access check with a second user (OWASP API1) - #151

Merged
berkantepli merged 5 commits into
mainfrom
feat/access-check
Oct 14, 2026
Merged

berkantepli merged 5 commits into
mainfrom
feat/access-check

Conversation

@berkantepli

Copy link
Copy Markdown
Owner

Summary

Retries the two-user IDOR idea as a defensive check of the user's own API.

  • Access check under each lifecycle flow (OWASP API1:2023, Broken Object Level Authorization): the first user (Target & auth) creates a record with the flow's create steps; a second user tries to read, change, and delete it and must get 403 or 404; the first user reads it again (fails if the second user could delete it) and the flow's cleanup deletes it.
  • Avoiding false results: only steps whose endpoint documents a credential are tried (reading a public catalog entry is not a finding); every attempt runs on its own (always_run), so one success does not hide the others; a 401 for the second user is reported as inconclusive, not as a pass; the check cannot start until the second user has a value for every credential the first user sends (otherwise a request would silently go out with the first user's token).
  • Second user's credentials: typed in, or Sign in as the second user via the contract's sign-in request (reuses the Target & auth sign-in helpers). Kept in the tab's memory only, never saved (not even with Remember in this tab), sent as step headers/query values under the contract's credential names, so the existing secret_names masking hides them in evidence. No backend API change.
  • Results: a verdict plus one plain sentence per attempt on the flow card; Run history saves the run as Access check: … with the second user's steps tagged.
  • Demo bookstore: a second reader (second@example.com / second-password) and book owners. DELETE /books/{bookId} refuses another reader's book with 403 (now documented); PUT deliberately does not check the owner, so the access check finds a real gap in the demo. Sample books stay ownerless, so existing runs behave as before. New demo tour step.
  • Docs (README, guide, changelog). Release 1.21.0, since chore: release 1.20.0 #150 releases 1.20.0 for feat: run the app's saved checks and flows from the CLI with --workspace #149.

Test plan

  • pytest: 319 passed (new: only the owner deletes a book, anyone signed in replaces it, sample books stay editable)
  • ruff check backend --select F,E9,I
  • vitest run: 247 passed (new: derived steps and order, protected-steps-only, second user's credentials only on second-user steps, missing-credential messages, per-attempt findings incl. 401, actor kept in Run history)
  • playwright test: 27 passed (the demo test signs in the second reader, runs the access check, and sees "could change" (200) and "could not delete" (403); the workspace contains no second-user secret)
  • Panel checked in light and dark on a fresh demo database

🤖 Generated with Claude Code

berkantepli and others added 5 commits October 14, 2026 16:30
The demo bookstore gets a second account (second@example.com) and
records who added each book. DELETE /books/{bookId} refuses another
reader's book with 403 (now documented), while PUT deliberately does
not check the owner, so an access check finds it. Sample books have no
owner and stay editable by any signed-in reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each lifecycle flow offers an access check: the first user creates a
record, a second user tries to read, change, and delete it and must get
403 or 404, and the first user checks it is still there and cleans up.
Only steps whose endpoint documents a credential are tried, every
attempt runs on its own, and a 401 for the second user is reported as
inconclusive rather than a pass. The second user's credentials (typed,
or from the contract's sign-in request) stay in the tab's memory only
and are masked in evidence like the first user's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1.20.0 is being released separately (#150) for the CLI --workspace work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main released 1.20.0 (#150); this branch stays 1.21.0, listed above it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@berkantepli
berkantepli merged commit a92e330 into main Oct 14, 2026
4 checks passed
@berkantepli
berkantepli deleted the feat/access-check branch October 14, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant