-
Notifications
You must be signed in to change notification settings - Fork 7
🔐 Security Section #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
DavidSint
wants to merge
9
commits into
nodeshift:main
Choose a base branch
from
DavidSint:doc/security
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a16b2af
Security Initial Commit
DavidSint 2bfed35
Include headings and basic details
DavidSint 3139051
Include SPbD ref
DavidSint bad96b6
✨ add lint config and workflow
ctcpip b1da5c6
Include comments from 19 Jul Meeting
DavidSint a6a2019
Merge branch 'main' of github.com:nodeshift/web-application-reference…
DavidSint 45e81bf
fix: linting
DavidSint cbfad27
Topics on Secret Security & Bot detection
DavidSint c48bfdf
Add guidance on helmet library
DavidSint File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,71 @@ | ||
| # Security | ||
|
|
||
| ## Overview | ||
| Security is strongest from conscious design at the outset, rather than retroactively trying to fill gaps after a solution has been built. In this respect, security should be considered at every stage of the applications lifecycle. | ||
|
|
||
| A [threat model](https://www.ibm.com/garage/method/practices/code/threat-modeling/) should be considered based on the attack surface that the Web Application creates. A public-facing web application for highly confidential personal data will have a very different threat model to an internal web application that doesn't contain sensitive data nor control anything of value. | ||
|
|
||
| This section focuses on some of the common security threats to defend against and mitigation techniques to utilise from the `team`'s experience building web applications. | ||
|
|
||
| --- | ||
|
|
||
| ## Guidance | ||
|
|
||
| The consensus of the most critical security risks is codified by the Open Worldwide Application Security Project (OWASP) in the [OWASP Top Ten](https://owasp.org/www-project-top-ten/). This is the starting point for the `team` when considering attack vectors in a web application's threat model. | ||
|
|
||
| ### Coding best security practices | ||
| - Do we need to copy [this](https://github.com/nodeshift/nodejs-reference-architecture/blob/main/docs/development/secure-development-process.md#managing-access-and-content-of-public-and-private-data-stores) [content](https://github.com/nodeshift/nodejs-reference-architecture/blob/main/docs/development/secure-development-process.md#writing-defensive-code) | ||
| - Moving secrets to backend - secrets should not be exposed to the client-side | ||
| - Bot detection - e.g. CAPTCHA | ||
|
|
||
| ### Encrypted Data & Traffic | ||
|
|
||
| - HTTPS | ||
| - WSS | ||
| - SSL/TLS | ||
| - Client-side storage of sensitive data | ||
| - `private` cache-control | ||
| - ... | ||
|
|
||
| ### Authentication & Authorization | ||
|
|
||
| Broken access control was the top security risk in the 2021 OWASP top ten. The two steps that are required for successful access control are authentication (verifying identity), and authorization (verify permission). | ||
|
|
||
| - Cookies (including HTTP only) | ||
| - Token handling and storage e.g. JWTs | ||
| - Protecting routes on client-side routing (SPAs) | ||
|
|
||
| ### Cross Site Attacks | ||
|
|
||
| #### Cross-Site Scripting (XSS) | ||
|
|
||
| #### Cross-Site Request Forgery (CSRF) | ||
|
|
||
| #### Cross-Origin Resource Sharing (CORS) | ||
|
|
||
| ### Security Headers | ||
|
|
||
| The following are response headers that the `team` use to protect web applications. They should be configured with policies according to the web app's usage and threat model. | ||
|
|
||
| - `Content-Security-Policy` to declare a policy for trusted application sources from which the browser can load resources such as scripts, stylesheets, images, fonts, etc. | ||
| - `X-Frame-Options` to declare whether the web app can be placed into an iframe on another domain | ||
| - `Strict-Transport-Security` to declare that the website requires HTTPS for encrypted subsequent requests | ||
| - `Referrer-Policy` to control what, if any information is included in the `Referer` header for network requests | ||
| - `X-Content-Type-Options` to prevent MIME sniffing attacks and force the declared content type instead of allowing a browser to interpret it, leaving room for malicious manipulation | ||
|
|
||
| ### Secure deployment | ||
|
|
||
| - Do we need to copy https://github.com/nodeshift/nodejs-reference-architecture/blob/main/docs/development/secure-development-process.md#maintaining-a-secure-and-up-to-date-foundation-for-deployed-applications? | ||
|
|
||
| ### Dependency Management | ||
|
|
||
| - Keeping deps up to date | ||
| - Preventing Supply Chain attacks | ||
| - Vulnerability audits | ||
|
|
||
| ### Security testing & monitoring | ||
|
|
||
| - Pen testing | ||
| - Fuzzing | ||
| - SAST/DAST | ||
| - Active monitoring & incident response | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.