node-esapi | minimal port of the ESAPI4JS
kandi X-RAY | node-esapi Summary
kandi X-RAY | node-esapi Summary
node-esapi is a minimal port of the ESAPI4JS (Enterprise Security API for JavaScript) encoder.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Default middleware .
- Splits parameters array .
- Checks to see if an array has a given key .
- Test if element contains an array .
node-esapi Key Features
node-esapi Examples and Code Snippets
Community Discussions
Trending Discussions on node-esapi
QUESTION
After checkmarx scan, we got report about Client Potential XSS and tried to fix it
We already tried the following utility to encode content but none works
...ANSWER
Answered 2021-Aug-04 at 19:49It could be a false positive with Checkmarx not seeing what ESAPI is doing. Is the error displayed right if it contains characters like <
or >
?
It may be easier to avoid creating HTML with concatenation and use the text()
methods instead. Then you don't need the encoding. Like:
QUESTION
I'm having an issue of my controller returning data before url-exists
finishes running.
ANSWER
Answered 2021-May-12 at 20:26urlExists
is a callback-based function, you can promisify it and then await
it.
To promisify urlExists
function, you can use built-in node module: util.promisify
.
QUESTION
I'm familiar with using templates in NodeJS like EJS to escape data for an HTML context.
However what would be the recommended way to safely output from an API? Given the intended usage is not known, it couldn't be escaped using HTML encoding.
Since I'm currently basically just doing res.json({})
for the output.
I'm thinking while some fields of incoming data can be validated (like 'email'), other fields that are more vague (like 'description') could contain any of the characters someone might use for XSS. Like < and ;. The options on OWASP seem limited https://cheatsheetseries.owasp.org/cheatsheets/Nodejs_Security_Cheat_Sheet.html Like this, but it was last updated 7 years ago https://github.com/ESAPI/node-esapi
Is it up to the recipient to handle? So if someone sends "alert(0);" as their description, I allow it through, as that is a valid JSON {"description":"alert(0);"}
...ANSWER
Answered 2020-Sep-05 at 19:43If someone wants to send in a description let them do so. They may have perfectly valid and legitimate reasons to do that. Perhaps they're writing an article about security and this is just an example of an XSS attack.
This isn't a threat to your database but to your web pages.
Security is neither a server-only nor a client-only job. It's a bit of both and the way you mitigate threats depends on the context.
When writing to a database, it's not XSS you have to worry about but things like SQL injection for example.
XSS is a threat for web applications and the way to mitigate that threat is to properly encode and/or escape any user-controlled input before it gets into the DOM.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install node-esapi
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page