https://github.com/alextanhongpin/node-security
Implementing a safer node-express server
https://github.com/alextanhongpin/node-security
express nodejs owasp security
Last synced: 2 months ago
JSON representation
Implementing a safer node-express server
- Host: GitHub
- URL: https://github.com/alextanhongpin/node-security
- Owner: alextanhongpin
- Created: 2018-09-11T15:01:10.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-11T15:16:01.000Z (almost 8 years ago)
- Last Synced: 2025-03-24T16:15:37.950Z (over 1 year ago)
- Topics: express, nodejs, owasp, security
- Language: JavaScript
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# node-security
## Checking if "use strict" is enabled
The fact that this inside a function called in the global context will not point to the global object can be used to detect strict mode:
```
> echo '"use strict"; var isStrict = (function() { return !this; })(); console.log(isStrict);' | node
true
> echo 'var isStrict = (function() { return !this; })(); console.log(isStrict);' | node
false
> echo 'var isStrict = (function() { return !this; })(); console.log(isStrict);' | node --use_strict
true
```
To enforce `use strict` globally, run your application with `node --use_strict`.
## save-exact
Force the dependencies saved in the `package.json` to have the exact version (without the `~` or `^`).
```bash
$ yarn add express --exact
```