Skip to content

Commit b36fefc

Browse files
Merge pull request #197 from advanced-security/jeongsoolee09/XSJS-docs-update
Update `XSJSCsrfDisabled`
2 parents 7ae1aa6 + b53844c commit b36fefc

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed
Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
1-
# Disabled XSJS CSRF protection
1+
# CSRF protection disabled in HANA XS application
22

3-
A web server that receives a request from a client without verifying that it was intentionally sent might be vulnerable to Cross Site Request Forgery (CSRF). An attacker can trick a client into making an unintended request to the web server that will be treated as an authentic request. This can be done via a URL, image load, XMLHttpRequest, etc. and can result in exposure of data or unintended code execution.
3+
This XS application is not protected against CSRF (cross-site request forgery) because it either disables the protection or fails to enable the protection explicitly.
4+
5+
## Overview
6+
7+
A web server that receives a request from a client without verifying that it was intentionally sent might be vulnerable to Cross Site Request Forgery (CSRF). An attacker can trick a client into making an unintended request to the web server that will be treated as an authentic request. This can be done via a URL, image load, `XMLHttpRequest`, etc. and can result in exposure of data or unintended code execution.
48

59
## Recommendation
610

7-
SAP’s recommendation is to use CSRF protection for any request that could be processed by a browser client by normal users.
8-
- In `XS Advanced` CSRF protection is enabled by default and should not be disabled.
9-
- In `XS Classic` CSRF protection should be enabled explicitly.
11+
SAP’s recommendation is to use CSRF protection for any request that could be processed by a browser client by normal users.
12+
- If `XS Advanced` is used, CSRF protection is configured with the `"csrfProtection"` property of `xs-app.json`. It is **enabled by default and should not be disabled.**
13+
- If `XS Classic` is used, CSRF protection is configured with the `"prevent_xsrf"` property of `.xsaccess`. It is **disabled by default and should be enabled explicitly.**
1014

1115
## Example
1216

13-
The following `xs-app.json` fragment enables CSRF protection in XSJS.
17+
The following `xs-app.json` fragment disables CSRF protection of the application it configures.
1418

1519
```json
1620
"routes": [
17-
{
18-
"source": "/bad/(.*)",
19-
"destination": "srv_api",
20-
"csrfProtection": true,
21-
...
22-
}
23-
]
21+
{
22+
"source": "/bad/(.*)",
23+
"destination": "srv_api",
24+
"csrfProtection": false,
25+
...
26+
},
2427
...
25-
}
2628
]
2729
```
2830

2931
## References
3032

31-
* SAP: [Server-Side JavaScript Security Considerations](https://help.sap.com/docs/SAP_HANA_PLATFORM/d89d4595fae647eabc14002c0340a999/e8a6bc904c0c48a182288604f467e84a.html).
32-
* OWASP: [Cross-Site Request Forgery (CSRF)](https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)).
33-
* Common Weakness Enumeration: [CWE-352](https://cwe.mitre.org/data/definitions/352.html).
33+
- SAP: [XS Advanced Application Router Configuration Syntax](https://help.sap.com/docs/SAP_HANA_PLATFORM/b3d0daf2a98e49ada00bf31b7ca7a42e/a9fc5c220d744180850996e2f5d34d6c.html?version=2.0.03#loioa9fc5c220d744180850996e2f5d34d6c__section_N101F7_N10016_N10001), relavant to XS Classic applications.
34+
- SAP: [Application-Access File Keyword Options, prevent_xsrf](https://help.sap.com/docs/SAP_HANA_PLATFORM/4505d0bdaf4948449b7f7379d24d0f0d/5f77e58ec01b46f6b64ee1e2afe3ead7.html#authenticationmethod), relevant to XS Advanced applications.
35+
- SAP: [Server-Side JavaScript Security Considerations](https://help.sap.com/docs/SAP_HANA_PLATFORM/d89d4595fae647eabc14002c0340a999/e8a6bc904c0c48a182288604f467e84a.html).
36+
- Common Weakness Enumeration: [CWE-352](https://cwe.mitre.org/data/definitions/352.html).
37+
- OWASP: [Cross-Site Request Forgery (CSRF)](https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)).

0 commit comments

Comments
 (0)