mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-12 17:23:38 +00:00
Updated Code Security Guidelines (markdown)
@@ -113,4 +113,12 @@ If you're reading or writing to a file and user can somehow control the file pat
|
||||
- Use "File" doctype API wherever possible to create files and read content. File doctype ensures that whatever you're reading and writing belongs to the site.
|
||||
- If it's not possible and you're accepting user input in any way make sure the path is:
|
||||
- not traversing back using /../../
|
||||
- In site's folder and not somewhere else.
|
||||
- In site's folder and not somewhere else.
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
@frappe.whitelist()
|
||||
def get_file(path):
|
||||
return open(path).read() # This allows reading everything on server.
|
||||
```
|
||||
Reference in New Issue
Block a user