fix: prevent direct client invocation of KOT generation for arbitrary POS I - #231
Draft
esafwan wants to merge 1 commit into
Draft
fix: prevent direct client invocation of KOT generation for arbitrary POS I#231esafwan wants to merge 1 commit into
esafwan wants to merge 1 commit into
Conversation
Remove the unauthenticated-shape whitelisted kot_execute entry point that let any authenticated user create/cancel KOTs for an arbitrary POS Invoice ID with client-supplied items. - kot_execute is no longer whitelisted; it remains the internal implementation used by the server-side URY order sync flow. - New whitelisted kot_execute_for_invoice validates POS Invoice write permission, branch assignment (URY User), and draft docstatus, and derives current items from the saved invoice instead of trusting client input. - POS Invoice form script updated to call the validated endpoint.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does / Summary
Hardens KOT generation by making
kot_executeserver-side only, introducing a secure whitelisted endpointkot_execute_for_invoice, and updating the POS Invoice JS form script (ury_pos_kot.js).What it solves / Motivation
Key Technical Changes
ury/ury/api/ury_kot_generate.py):@frappe.whitelist()decorator fromkot_execute, restricting it to server-side callers (e.g.,ury_order.sync_order)._get_user_branchesand_validate_kot_accessto enforce POS Invoice write permission and branch assignment viatabURY User.kot_execute_for_invoicewhich validates access, verifies draft docstatus (docstatus == 0), and extracts current item data directly from the savedpos_invoice.items.ury/public/js/ury_pos_kot.js):kot_execute_for_invoice.