-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add doctype caster security rule
- Loading branch information
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ def function_name(input): | |
|
||
# ok: frappe-codeinjection-eval | ||
eval("1 + 1") | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from frappe.model import Document | ||
import frappe | ||
from frappe import requires_permission | ||
|
||
# ruleid: require-permission-decorator-on-conversion-methods | ||
class MyDocument(Document): | ||
def _into_sales_invoice(self, so): | ||
... | ||
|
||
# ok: require-permission-decorator-on-conversion-methods | ||
class MyDocument(Document): | ||
@requires_permission("Sales Invoice", "create") | ||
def _into_sales_invoice(self, so): | ||
... | ||
|
||
# ruleid: require-permission-decorator-on-conversion-methods | ||
class MyDocument(Document): | ||
def _from_sales_invoice(self, so): | ||
... | ||
|
||
# ok: require-permission-decorator-on-conversion-methods | ||
class MyDocument(Document): | ||
@frappe.requires_permission("Sales Invoice", "read") | ||
def _from_sales_invoice(self, so): | ||
... |