Skip to content

fix: harden the serve_kot endpoint so serving a KOT cannot be forged by arb - #230

Draft
esafwan wants to merge 1 commit into
developfrom
task/SweepSecurity-SEC-17-impl-1
Draft

fix: harden the serve_kot endpoint so serving a KOT cannot be forged by arb#230
esafwan wants to merge 1 commit into
developfrom
task/SweepSecurity-SEC-17-impl-1

Conversation

@esafwan

@esafwan esafwan commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

What it does / Summary

Hardens the serve_kot API endpoint in ury/ury/api/ury_kot_display.py by enforcing POST HTTP method restriction, role-based authorization, branch-level scoping, and server-side timestamp generation.

What it solves / Motivation

  • Resolves security finding SEC-17 by preventing unauthorized or cross-branch users from forging KOT serving actions.
  • Eliminates reliance on untrusted client-supplied timestamps by using the server clock for production time calculations and served timestamp logging.

Key Technical Changes

  • HTTP Method & Role Authorization:
    • Updated decorator to @frappe.whitelist(methods=["POST"]).
    • Enforced role check requiring one of URY Manager, URY Captain, System Manager, or Administrator (raising PermissionError otherwise).
  • Branch Validation:
    • Compares target URY KOT branch against caller's branch via getBranch() (bypassed for System Manager and Administrator).
  • Server Clock Timestamping:
    • Overrode client-supplied time argument with server current_time.strftime("%I:%M:%S %p") to prevent timestamp spoofing while maintaining backward compatibility for call signatures.

- Restrict serve_kot to POST requests only
- Require a kitchen/manager role (URY Captain, URY Manager,
  System Manager, Administrator) to serve a KOT
- Verify the session user is authorized for the KOT's branch
  and reject cross-branch requests
- Record the served timestamp from the server clock instead of
  trusting the caller-supplied time parameter
@esafwan esafwan changed the title Harden the serve_kot endpoint so serving a KOT cannot be forged by arb fix: harden the serve_kot endpoint so serving a KOT cannot be forged by arb Jul 21, 2026
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