Skip to content

Commit 3317966

Browse files
authored
Merge pull request OWASP#81 from Ali-Yazdani/master
adding a new version for doc structure V.03
2 parents 6ef522e + 0760e7c commit 3317966

124 files changed

Lines changed: 995 additions & 54 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 48 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ The OWASP DevSecOps Guideline explains how we can implement a secure pipeline an
33
This project helps any companies of each size that have a development pipeline or, in other words, have a DevOps pipeline.
44
We try to draw a perspective of a secure DevOps pipeline during this project and then improve it based on our customized requirements.
55

6-
The Ideal goal is **"detect security issues (by design or application vulnerability) as fast as possible."**
6+
The Ideal goal is **"detect security issues (by design or application vulnerability) as early as possible."**
77

88
## Initial steps
99
DevSecOps is all about putting security into DevOps. But to keep up with the pace of CI/CD, security has to be injected early into software writing and testing.
@@ -37,58 +37,54 @@ However, when using CI/CD tools to provide automation, keep in mind that the too
3737

3838
---
3939
## Table of Contents:
40+
- [0-Intro](current-version/0-Intro)
41+
- [0-1-Intro](current-version/0-Intro/0-1-Intro.md)
42+
- [0-2-Overview](current-version/0-Intro/0-2-Overview.md)
43+
- [1-People](current-version/1-People)
44+
- [1-1-Shape-the-team](current-version/1-People/1-1-Shape-the-team)
45+
- [1-1-1-Security-champions](current-version/1-People/1-1-Shape-the-team/1-1-1-Security-champions.md)
46+
- [1-2-Training](current-version/1-People/1-2-Training)
47+
- [1-2-1-Secure-coding](current-version/1-People/1-2-Training/1-2-1-Secure-coding.md)
48+
- [1-2-2-Security-CICD](current-version/1-People/1-2-Training/1-2-2-Security-CICD.md)
49+
- [2-Tools](current-version/2-Tools)
50+
- [2-1-Design](current-version/2-Tools/2-1-Design)
51+
- [2-1-1-Threat-modeling](current-version/2-Tools/2-1-Design/2-1-1-Threat-modeling.md)
52+
- [2-2-Code](current-version/2-Tools/2-2-Code)
53+
- [2-2-3-Interactive-Application-Security-Testing](current-version/2-Tools/2-2-Code/2-2-3-Interactive-Application-Security-Testing.md)
54+
- [2-2-1-Pre-commit](current-version/2-Tools/2-2-Code/2-2-1-Pre-commit)
55+
- [2-2-1-1-Pre-commit](current-version/2-Tools/2-2-Code/2-2-1-Pre-commit/2-2-1-1-Pre-commit.md)
56+
- [2-2-1-2-Secrets-Management](current-version/2-Tools/2-2-Code/2-2-1-Pre-commit/2-2-1-2-Secrets-Management.md)
57+
- [2-2-1-3-Linting-code](current-version/2-Tools/2-2-Code/2-2-1-Pre-commit/2-2-1-3-Linting-code.md)
58+
- [2-2-1-4-Repository-Hardening](current-version/2-Tools/2-2-Code/2-2-1-Pre-commit/2-2-1-4-Repository-Hardening.md)
59+
- [2-2-2-Static-Analysis](current-version/2-Tools/2-2-Code/2-2-2-Static-Analysis)
60+
- [2-2-2-1-Static-Application-Security-Testing](current-version/2-Tools/2-2-Code/2-2-2-Static-Analysis/2-2-2-1-Static-Application-Security-Testing.md)
61+
- [2-2-2-2-Software-Composition-Analysis](current-version/2-Tools/2-2-Code/2-2-2-Static-Analysis/2-2-2-2-Software-Composition-Analysis.md)
62+
- [2-2-2-3-Infastructure-as-Code-Scanning](current-version/2-Tools/2-2-Code/2-2-2-Static-Analysis/2-2-2-3-Infastructure-as-Code-Scanning.md)
63+
- [2-2-2-4-Container-Security](current-version/2-Tools/2-2-Code/2-2-2-Static-Analysis/2-2-2-4-Container-Security)
64+
- [2-2-2-4-1-Container-Scanning](current-version/2-Tools/2-2-Code/2-2-2-Static-Analysis/2-2-2-4-Container-Security/2-2-2-4-1-Container-Scanning.md)
65+
- [2-2-2-4-2-Container-Hardening](current-version/2-Tools/2-2-Code/2-2-2-Static-Analysis/2-2-2-4-Container-Security/2-2-2-4-2-Container-Hardening.md)
66+
- [2-3-Build](current-version/2-Tools/2-3-Build)
67+
- [2-3-1-Dynamic-Application-Security-Testing](current-version/2-Tools/2-3-Build/2-3-1-Dynamic-Application-Security-Testing.md)
68+
- [2-3-2-Mobile-Application-Security-Test](current-version/2-Tools/2-3-Build/2-3-2-Mobile-Application-Security-Test.md)
69+
- [2-3-3-API-Security](current-version/2-Tools/2-3-Build/2-3-3-API-Security.md)
70+
- [2-3-4-Miss-Configuration-Check](current-version/2-Tools/2-3-Build/2-3-4-Miss-Configuration-Check.md)
71+
- [2-4-Operation](current-version/2-Tools/2-4-Operation)
72+
- [2-4-1-Cloud-Native-Security](current-version/2-Tools/2-4-Operation/2-4-1-Cloud-Native-Security.md)
73+
- [2-4-2-Logging-and-Monitoring](current-version/2-Tools/2-4-Operation/2-4-2-Logging-and-Monitoring.md)
74+
- [2-4-3-Pentest](current-version/2-Tools/2-4-Operation/2-4-3-Pentest.md)
75+
- [2-4-4-Vulnerability-Management](current-version/2-Tools/2-4-Operation/2-4-4-Vulnerability-Management.md)
76+
- [2-4-5-VDP|Bug-bounty](current-version/2-Tools/2-4-Operation/2-4-5-VDP|Bug-bounty.md)
77+
- [2-4-6-Breach-and-attack-simulation](current-version/2-Tools/2-4-Operation/2-4-6-Breach-and-attack-simulation.md)
78+
- [3-Governance](current-version/3-Governance)
79+
- [3-2-Data-protection](current-version/3-Governance/3-2-Data-protection.md)
80+
- [3-1-Compliance-Auditing](current-version/3-Governance/3-1-Compliance-Auditing)
81+
- [3-1-1-Compliance-Auditing](current-version/3-Governance/3-1-Compliance-Auditing/3-1-1-Compliance-Auditing.md)
82+
- [3-1-2-Policy-as-code](current-version/3-Governance/3-1-Compliance-Auditing/3-1-2-Policy-as-code.md)
83+
- [3-1-3-Security-benchmarking](current-version/3-Governance/3-1-Compliance-Auditing/3-1-3-Security-benchmarking.md)
84+
- [3-3-Reporting](current-version/3-Governance/3-3-Reporting)
85+
- [3-3-1-Tracking-maturities](current-version/3-Governance/3-3-Reporting/3-3-1-Tracking-maturities.md)
86+
- [3-3-2-Central-vulnerability-management-dashboard](current-version/3-Governance/3-3-Reporting/3-3-2-Central-vulnerability-management-dashboard.md)
4087

41-
- [0-Intro](documents/0-Intro)
42-
- [0-1-Intro](documents/0-Intro/0-1-Intro.md)
43-
- [0-2-Overview](documents/0-Intro/0-2-Overview.md)
44-
- [1-Init](documents/1-Init)
45-
- [1-1-Shape-the-team](documents/1-Init/1-1-Shape-the-team)
46-
- [1-1-1-Security-champions](documents/1-Init/1-1-Shape-the-team/1-1-1-Security-champions.md)
47-
- [1-2-Training](documents/1-Init/1-2-Training)
48-
- [1-2-1-Secure-coding](documents/1-Init/1-2-Training/1-2-1-Secure-coding.md)
49-
- [1-2-2-Security-CICD](documents/1-Init/1-2-Training/1-2-1-Security-CICD.md)
50-
- [2-Pre-commit](documents/2-Pre-commit)
51-
- [2-1-Pre-commit](documents/2-Pre-commit/2-1-Pre-commit.md)
52-
- [2-2-Threat-modeling](documents/2-Pre-commit/2-2-Threat-modeling.md)
53-
- [2-3-Repository-hardening](documents/2-Pre-commit/2-3-Repository-hardening.md)
54-
- [2-4-Secrets-Management](documents/2-Pre-commit/2-4-Secrets-Management.md)
55-
- [2-5-Linting-code](documents/2-Pre-commit/2-5-Linting-code.md)
56-
- [3-Commit-CI](documents/3-Commit-CI)
57-
- [3-2-Interactive-Application-Security-Testing](documents/3-Commit-CI/3-2-Interactive-Application-Security-Testing.md)
58-
- [3-1-Static-analysis](documents/3-Commit-CI/3-1-Static-analysis)
59-
- [3-1-1-Static-Application-Security-Testing](documents/3-Commit-CI/3-1-Static-analysis/3-1-1-Static-Application-Security-Testing.md)
60-
- [3-1-2-Software-Composition-Analysis](documents/3-Commit-CI/3-1-Static-analysis/3-1-2-Software-Composition-Analysis.md)
61-
- [3-1-3-Container-Security](documents/3-Commit-CI/3-1-Static-analysis/3-1-3-Container-Security)
62-
- [3-1-3-1-Container-scanning](documents/3-Commit-CI/3-1-Static-analysis/3-1-3-Container-Security/3-1-3-1-Container-scanning.md)
63-
- [3-1-3-2-Container-hardening](documents/3-Commit-CI/3-1-Static-analysis/3-1-3-Container-Security/3-1-3-2-Container-hardening.md)
64-
- [3-1-4-Infastructure-as-code](documents/3-Commit-CI/3-1-Static-analysis/3-1-4-Infastructure-as-code.md)
65-
- [4-Continuous-delivery-CD](documents/4-Continuous-delivery-CD)
66-
- [4-1-Dynamic-Application-Security-Testing](documents/4-Continuous-delivery-CD/4-1-Dynamic-Application-Security-Testing.md)
67-
- [4-2-Mobile-Application-Security-Test](documents/4-Continuous-delivery-CD/4-2-Mobile-Application-Security-Test.md)
68-
- [4-3-API-Security](documents/4-Continuous-delivery-CD/4-3-API-Security.md)
69-
- [4-4-Miss-Configuration-Check](documents/4-Continuous-delivery-CD/4-4-Miss-Configuration-Check.md)
70-
- [5-Deploy-CD-Golive](documents/5-Deploy-CD-Golive)
71-
- [5-1-Key-and-certificate-management](documents/5-Deploy-CD-Golive/5-1-Key-and-certificate-management.md)
72-
- [5-2-Cloud-Native-Application-Protection-Platform](documents/5-Deploy-CD-Golive/5-2-Cloud-Native-Application-Protection-Platform.md)
73-
- [6-Operation](documents/6-Operation)
74-
- [6-1-Runtime|Continuous-test](documents/6-Operation/6-1-Runtime|Continuous-test)
75-
- [6-1-1-Infra-scanning](documents/6-Operation/6-1-Runtime|Continuous-test/6-1-1-Infra-scanning)
76-
- [6-1-1-1-Could-resources](documents/6-Operation/6-1-Runtime|Continuous-test/6-1-1-Infra-scanning/6-1-1-1-Could-resources.md)
77-
- [6-1-1-2-K8S-resources](documents/6-Operation/6-1-Runtime|Continuous-test/6-1-1-Infra-scanning/6-1-1-2-K8S-resources.md)
78-
- [6-1-2-Image-scanning](documents/6-Operation/6-1-Runtime|Continuous-test/6-1-2-Image-scanning.md)
79-
- [6-2-Breach-and-attack-simulation](documents/6-Operation/6-2-Breach-and-attack-simulation.md)
80-
- [6-3-Logging-and-Monitoring](documents/6-Operation/6-3-Logging-and-Monitoring.md)
81-
- [6-4-Pentest](documents/6-Operation/6-4-Pentest.md)
82-
- [6-5-VDP|Bug-bounty](documents/6-Operation/6-5-VDP|Bug-bounty.md)
83-
- [7-Governance](documents/7-Governance)
84-
- [7-1-Compliance-Auditing](documents/7-Governance/7-1-Compliance-Auditing)
85-
- [7-1-1-Compliance-Auditing](documents/7-Governance/7-1-Compliance-Auditing/7-1-1-Compliance-Auditing.md)
86-
- [7-1-2-Policy-as-code](documents/7-Governance/7-1-Compliance-Auditing/7-1-2-Policy-as-code.md)
87-
- [7-1-3-Security-benchmarking](documents/7-Governance/7-1-Compliance-Auditing/7-1-3-Security-benchmarking.md)
88-
- [7-2-Data-protection](documents/7-Governance/7-2-Data-protection.md)
89-
- [7-3-Reporting](documents/7-Governance/7-3-Reporting)
90-
- [7-3-1-Tracking-maturities](documents/7-Governance/7-3-Reporting/7-3-1-Tracking-maturities.md)
91-
- [7-3-2-Central-vulnerability-management-dashboard](documents/7-Governance/7-3-Reporting/7-3-2-Central-vulnerability-management-dashboard.md)
9288

9389

9490

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Introduction to the OWASP DevSecOps Guideline
2+
The OWASP DevSecOps Guideline explains how we can transition from a traditional approach to achieving security that starts with requirements and ends with security testing to an approach that brings together Development, Security, and Operations throughout the software lifecycle -- a "DevSecOps" approach.
3+
4+
This project's goal is to help companies of any size to add security to their DevOps pipeline and culture. There is no one **right** way to do DevSecOps, so it's important to stay focused.
5+
6+
DevSecOps strives to **"produce demonstrably secure code"** by:
7+
* leveraging automation to create short feedback loops to developers
8+
* breaking down the silos between development, security, and operations
9+
* breaking down security work into small pieces to create flow
10+
* making decisions based on threat intelligence from operations
11+
* establishing a culture of security experimentation and learning
12+
13+
There are tools to support security processes across the software development lifecycle. Every company should have processes in place to ensure:
14+
* **Custom Code Security** - your custom code has the right defenses and is free from vulnerabilities, including applications, APIs, serverless, mobile, infrastructure as code, etc...
15+
* **Supply Chain Security** - your platform, framework, libraries, containers, and other components
16+
* **Runtime Protection** - you detect attacks on your software and prevent them from being exploited
17+
18+
If you do these three processes well, you will be in relatively good shape in terms of application security. In this document, we will explore a variety of automated solutions that can help you implement these three processes.
19+
20+
The goal is not to use all of the tools in your pipeline. The goal is to ensure secure code emerges from your pipeline. You need to pick and choose the tools that are effective with your organization's people, process, technology, and culture. You will very likely want to use each tool for what it is best at, rather than repeating all tests with all tools. Of course, every software development organization is different and you are free to select tools and the exact location where you want to implement the tools.
21+
22+
![Secure Pipeline](/current-version/assets/images/Pipeline-view.png)

documents/1-Init/1-1-Shape-the-team/1-1-1-Security-champions.md renamed to current-version/1-People/1-1-Shape-the-team/1-1-1-Security-champions.md

File renamed without changes.

documents/1-Init/1-2-Training/1-2-1-Secure-coding.md renamed to current-version/1-People/1-2-Training/1-2-1-Secure-coding.md

File renamed without changes.

documents/1-Init/1-2-Training/1-2-2-Security-CICD.md renamed to current-version/1-People/1-2-Training/1-2-2-Security-CICD.md

File renamed without changes.
File renamed without changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Pre-commit
2+
3+
The Pre-commit phase is important because it can prevent security issues before they are submitted to a central (Git) repository.
4+
5+
Making sure that there are no secrets in the code, and that the code follows certain guidelines (According to the Linter rules) will result in a higher quality code.
6+
7+
In the following, we take a look into different types of pre-commit actions that are as follows:
8+
1. Secrets Management
9+
2. Linting Code
10+
11+
12+
The following image can give you a better view of what the pre-commit means and why we must consider it.
13+
14+
![Pre Commit](/current-version/assets/images/pre-commit.png)
15+
16+
## Tools:
17+
18+
+ [Pre-Commit](https://pre-commit.com/) - A framework for managing and maintaining multi-language pre-commit hooks.
19+
20+
21+
### References
22+
23+
+ [Wikipedia - Lint (software)](https://en.wikipedia.org/wiki/Lint_(software))
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Take care secrets and credentials
2+
3+
4+
*How can you ensure that sensitive information are not pushed to a repository?*
5+
6+
This is one of the [OWASP Top Ten issues](https://owasp.org/www-project-top-ten/2017/A3_2017-Sensitive_Data_Exposure) and
7+
several bug bounties write-ups are related to this kind of issue, eg hard-coded credentials pushed by mistake.
8+
9+
You should scan your commits and your repository, and detect any sensitive information such as password, secret key, confidential, etc.
10+
following the process shown in the picture.
11+
<br/>
12+
13+
The ideal approach is detecting and preventing the exposure of sensitive data before that they hit the repository,
14+
because they are then visible in the history. In case of code hosting platforms, secrets can still linger
15+
on the web and be searchable after you remove them from the repository.
16+
17+
A complimentary approach is scanning the repo for sensitive information, and then remove them;
18+
note that when a credential is leaked, it is already compromised and should be invalidated.
19+
20+
## Detecting secrets in several locations
21+
22+
- **Detecting existing secrets** by searching in a repository for existing secrets.
23+
- **Using Pre-commit hooks** in order to prevent secrets for entering our code base.
24+
- **Detecting secrets in a pipeline** .
25+
26+
## Why Detecting Secrets?
27+
28+
+ The secrets should not be hardcoded.
29+
+ The secrets should not be unencrypted.
30+
+ The secrets should not be stored in source code.
31+
+ The code history does not contain inadvertent secrets.
32+
33+
## Where and when to Detect Secrets?
34+
![Pre Commit](/current-version/assets/images/pre-commit.png)
35+
36+
37+
Well, the best location is the **pre-commit** location, This ensure that before a secret actually enters your code base, it is intercepted, and the developer or to committer gets a message. Another location is the build server or the **build** process. The build server retrieves source code, which is already committed and then it can analyze the source code where it contains new secrets or when it contains known secrets that the secrets are actually validated or audited.
38+
39+
---
40+
Here are some helpful tools to automatically scan repositories for sensitive information.
41+
Scans can be implemented directly in our pipeline, and be repeatable and efficient.
42+
43+
## Tools:
44+
- **Open-source**:
45+
+ [gittyleaks](https://github.com/kootenpv/gittyleaks) - Find sensitive information for a git repo
46+
+ [git-secrets](https://github.com/awslabs/git-secrets) - Prevents you from committing secrets and credentials into git repositories
47+
+ [Repo-supervisor](https://github.com/auth0/repo-supervisor) - Scan your code for security misconfiguration, search for passwords and secrets
48+
+ [truffleHog](https://github.com/dxa4481/truffleHog) - Searches through git repositories for high entropy strings and secrets, digging deep into commit history
49+
+ [Git Hound](https://github.com/ezekg/git-hound) - Git plugin that prevents sensitive data from being committed
50+
+ [Github Secret Scanning](https://docs.github.com/en/code-security/secret-scanning) - Github built in feature for secret detection
51+
52+
- **Proprietary software**:
53+
+ [GitGuardian](https://gitguardian.com) - Keep secrets out of your source code
54+
+ [Spectralops](https://spectralops.io) - Developer-first Cloud Security
55+
+ [TruffleSecurity](https://trufflesecurity.com) - Unhearth your secrets
56+
+ [GitHub Advanced Security](https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning) - GitHub scans repositories for known types of secrets, to prevent fraudulent use of secrets that were committed accidentally
57+
+ [BluBracket](https://blubracket.com) - Prevent secrets and credentials in code
58+
+ [Nightfall](https://nightfall.ai) - Find and protect secrets and keys across the cloud
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## Linting Code
2+
3+
### What Is Linting?
4+
Linting is the automated checking of your source code for programmatic and stylistic errors. This is done by using a lint tool (otherwise known as linter). A lint tool is a basic static code analyzer.
5+
6+
### What can Linting do?
7+
- Linting can **detect errors** in a code and errors that can lead to a security vulnerabilities.
8+
- Linters Can Also **detect formatting or styling issues** and makes the code more readable for more secure code.
9+
- Linters can **suggest best practices**.
10+
- Also they can **increases overall quality of the code**.
11+
- Since everybody follows the same linting rules it **makes maintenance of code easier**.
12+
13+
14+
### Basic Lint Tools
15+
Lint tools are the most basic form of static analysis. Using lint tools can be helpful for identifying common errors, such as:
16+
- Indexing beyond arrays.
17+
- Dereferencing null pointers.
18+
- (Potentially) dangerous data type combinations.
19+
- Unreachable code.
20+
- Non-portable constructs.
21+
22+
### Advanced Static Analysis Tools
23+
Advanced static analysis tools typically deliver:
24+
- Pattern-based simulation.
25+
- Quality and complexity metrics.
26+
- Best practice recommendations for developers.
27+
- Support for multiple safety and security-focused coding standards.
28+
- Out-of-the-box certification for use in the development of safety-critical applications.
29+
30+
### Issues with Linters
31+
+ Not every language has "quality" standard linter tools available, each framwork usually has one or several linters.
32+
+ Different versions or configurations can lead to different results.
33+
+ Since some linters are very verbose and information overload can lead to focusing on "unimportant" issues.
34+
35+
### Where and When to Use Linter
36+
![Pre Commit](/current-version/assets/images/pre-commit.png)
37+
38+
You can perform it in the **pre-commit** phase, so locally before actually committing code to your local repository to your local clone. Another phase where you often see linting is during the **build** phase, So here the build server pulls the code from the Git repository and performs linting on it and reports back that results from linting phase.
39+
40+
41+
### References
42+
43+
+ [Preforce](https://www.perforce.com/blog/qac/what-lint-code-and-why-linting-important)

0 commit comments

Comments
 (0)