This repository has been archived by the owner on Sep 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 02eb76d
Showing
26 changed files
with
1,906 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,84 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
# | ||
name: "CodeQL - Manual Example" | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
schedule: | ||
- cron: '34 3 * * 0' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
# Runner size impacts CodeQL analysis time. To learn more, please see: | ||
# - https://gh.io/recommended-hardware-resources-for-running-codeql | ||
# - https://gh.io/supported-runners-and-hardware-resources | ||
# - https://gh.io/using-larger-runners | ||
# Consider using larger runners for possible analysis time improvements. | ||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} | ||
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} | ||
permissions: | ||
# required for all workflows | ||
security-events: write | ||
|
||
# only required for workflows in private repositories | ||
actions: read | ||
contents: read | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'javascript-typescript' ] | ||
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] | ||
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both | ||
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both | ||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v3 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
|
||
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs | ||
# queries: security-extended,security-and-quality | ||
|
||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v3 | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun | ||
|
||
# If the Autobuild fails above, remove it and uncomment the following three lines. | ||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. | ||
|
||
# - run: | | ||
# echo "Run, Build Application using script" | ||
# ./location_of_script_within_repo/buildscript.sh | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v3 | ||
with: | ||
category: "/language:${{matrix.language}}" |
This file contains 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,23 @@ | ||
name: TruffleHog Secrets Scan | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
name: Test for Secrets | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Secret Scanning | ||
uses: trufflesecurity/trufflehog@main | ||
with: | ||
base: "" | ||
head: ${{ github.ref_name }} | ||
extra_args: --debug |
This file contains 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,13 @@ | ||
fileignoreconfig: | ||
- filename: part1/README.md | ||
checksum: 296322f09011c5d5842a59367be6128832786fab03e2473eaaf7bd1d0401b007 | ||
- filename: part2/VulnerableAppTwo/keys/rsaexample.pem | ||
checksum: cc5872d91bc99346267659d9bc7bb2189547f6742edf25bf7b447b04af65d440 | ||
- filename: part2/README.md | ||
checksum: dece0d209b83000453119ab7a500465654ed9d5a96a5fbdeb7738a5dd17560d9 | ||
- filename: README.md | ||
checksum: d5a9d7377587552896b7ce67ebe4da86bec5c9c753e16c120c7622df01b3a956 | ||
- filename: horusec-config.json | ||
checksum: 727c5016cd645828fba85e4e02a5d6d4b0d762a881aadb695333c973b6c03e27 | ||
threshold: medium | ||
version: "" |
This file contains 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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Tweag | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains 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,65 @@ | ||
|
||
# Template Repository - Shifting Security Left a Hands On Workshop | ||
|
||
The following repository contains training material workshops on shifting security left. | ||
|
||
This workshop is held at venue `X` on `DATE` at `TIME`. | ||
|
||
## Workshop Outline | ||
|
||
*Shifting Security Left a Hands On Workshop* provides participants with an introduction to baking security into the software development process and leveraging DevSecOps tooling to support this. | ||
|
||
Attendees will learn about setting up a local development environment which includes security tools such as IDE plugins. Students will then progress into learning how to use DevSecOps pipelines to detect security issues such as accidentally committed secrets. | ||
|
||
The workshop will then wrap up with tips on how to handle secure deployments and a look to what the future holds in this space. | ||
|
||
## Pre-setup Phase | ||
|
||
In order to fully participate in this workshop you will need a GitHub account. | ||
|
||
You can obtain this by signing up at http://www.github.com. | ||
|
||
Students will be able to sign up for a .edu account which comes with some added bonuses, such as being able to setup private repositories for free. | ||
|
||
Once your account is setup, you will need to `Fork` and `Clone` this repository. | ||
|
||
A full guide to setting up the tooling for this workshop can be found in the Part 1 README file. | ||
|
||
[Part 1 - Security within the development environment](https://github.com/tweag/dev-sec-ops-workshop/tree/main/part1#part-1---security-within-the-development-environment) | ||
|
||
|
||
## Part 1: Security within the development environment | ||
|
||
Attendees will learn to integrate security tools and pre-commit hooks into their development environment thus enhancing code security off the bat: | ||
|
||
1. 3rd party plugin integration. In this part of the talk we explore third-party tooling that can be integrated into the IDE to aid in linting and SAST. An example here includes the SonarLint plugin. We also look at CodeQL and GitHub Copilot [Part 1 - Module1: IDE Integration](https://github.com/tweag/dev-sec-ops-workshop/tree/main/part1#module-1-ide-integration) | ||
|
||
2. Setting up pre-commit hooks to aid in security will be explored. This includes tools such as AWS Labs git-secrets and Talisman. [Part 1 - Module2: pre-commit Hooks](https://github.com/tweag/dev-sec-ops-workshop/tree/main/part1#module-2-pre-commit-hooks) | ||
|
||
3. Git ignores. Git ignore files are a great way of preventing config files which may contain secrets, and other undesirable files such as .zips accidentally being committed. In this portion of the talk we provide practical examples of using .gitignore to aid in security. [Part 1 - Module 3: Preventing accidental commits](https://github.com/tweag/dev-sec-ops-workshop/tree/main/part1#module-3-preventing-accidental-commits) | ||
|
||
|
||
## Part 2: Repository Scanning | ||
|
||
Here we cover some repository scanning techniques, including secrets scanning and vulnerability detection, using tools like GitHub's dependabot and Tartufo. | ||
|
||
1. Secrets scanning. A demonstration of how secret scanning can be performed in the source code. This includes examples of Tartufo/TruffleHog, GitHub's tooling and Horusec. [Part 2 - Module 4:Secrets Scanning](https://github.com/tweag/dev-sec-ops-workshop/tree/main/part2#module-4secrets-scanning) | ||
|
||
2. Handling secrets in GitHub. GitHub provides users the ability to store secrets such as API keys securely within the SCM, and pull these out at deployment time. Here participants learn the basics of the environment within GitHub and how to leverage GitHub native secret storage mechanisms. We will also discuss other options for storing secrets and pulling them into CI/CD pipelines [Part 2 - Module 5: Handling secrets in GitHub](https://github.com/tweag/dev-sec-ops-workshop/tree/main/part2#module-5handling-secrets-in-github) | ||
|
||
3. Detecting security vulnerabilities within the repository. Students are introduced to the concept of detecting security vulnerabilities in the source code repository. A general overview of techniques and approaches is given, as well as those specific to GitHub.[Part 2 - Module 6:Detecting Security vulnerabilities](https://github.com/tweag/dev-sec-ops-workshop/tree/main/part2#module-5handling-secrets-in-github) | ||
|
||
4. Vulnerable dependency detection. GitHub's dependabot provides a mechanism for analyzing the dependencies associated with a project and understanding if they contain security vulnerabilities. Walkthrough of dependabot is performed. [Part 2 - Module 7:Vulnerable dependencies](https://github.com/tweag/dev-sec-ops-workshop/tree/main/part2#module-7vulnerable-dependencies) | ||
|
||
5. Static analysis. GitHub Advanced Security contains a GitHub native SAST tool built on CodeQL. This section of the class walks through its feature sets and how it can be integrated into GitHub actions. This section of the talk will also cover Horusec and how it cane be used in the same capacity.[Part 2 - Module 8:Static Analysis](https://github.com/tweag/dev-sec-ops-workshop/tree/main/part2#module-8static-analysis) | ||
|
||
6. Branch protection and pull request gating mechanisms. The penultimate topic covered is how branch protection rules and PR gating mechanisms can leverage SAST tools to block pull requests that fail security checks.[Module 9:Branch protection rules](https://github.com/tweag/dev-sec-ops-workshop/tree/main/part2#module-9branch-protection-rules) | ||
|
||
7. SBOMs. A final note on SBOMs. These can be used to extract a Software Bill of Materials from your applications stored in GitHub. [Part 2 - Module 10:SBOMs Software Bill of Materials](https://github.com/tweag/dev-sec-ops-workshop/tree/main/part2#module-10sboms-software-bill-of-materials) | ||
|
||
## Wrap-up | ||
|
||
Discussion of future trends in this space. | ||
|
||
Recap of what we've learned | ||
|
This file contains 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,145 @@ | ||
{ | ||
"horusecCliCertInsecureSkipVerify": false, | ||
"horusecCliCertPath": "", | ||
"horusecCliContainerBindProjectPath": "", | ||
"horusecCliCustomRulesPath": "", | ||
"horusecCliDisableDocker": false, | ||
"horusecCliEnableCommitAuthor": false, | ||
"horusecCliEnableGitHistoryAnalysis": false, | ||
"horusecCliEnableInformationSeverity": false, | ||
"horusecCliFalsePositiveHashes": [], | ||
"horusecCliFilesOrPathsToIgnore": [ | ||
"*tmp*", | ||
"**/.vscode/**", | ||
"**/deployments/**", | ||
"**/.git/**", | ||
"**/.pyre/**", | ||
"**/.venv/**", | ||
"**/*.env", | ||
"**/.mypy_cache/**", | ||
"**/htmlcov/**", | ||
"**/tests/**", | ||
"**/frontend/**", | ||
"**/Makefile**" | ||
], | ||
"horusecCliFilterPath": "", | ||
"horusecCliHeaders": {}, | ||
"horusecCliHorusecApiUri": "http://0.0.0.0:8000", | ||
"horusecCliJsonOutputFilepath": "", | ||
"horusecCliMonitorRetryInSeconds": 15, | ||
"horusecCliPrintOutputType": "text", | ||
"horusecCliProjectPath": "", | ||
"horusecCliRepositoryAuthorization": "00000000-0000-0000-0000-000000000000", | ||
"horusecCliRepositoryName": "blog", | ||
"horusecCliReturnErrorIfFoundVulnerability": false, | ||
"horusecCliRiskAcceptHashes": [ | ||
], | ||
"horusecCliSeveritiesToIgnore": [ | ||
"INFO" | ||
], | ||
"horusecCliTimeoutInSecondsAnalysis": 600, | ||
"horusecCliTimeoutInSecondsRequest": 300, | ||
"horusecCliToolsConfig": { | ||
"Bandit": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"Brakeman": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"Eslint": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"Flawfinder": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"GitLeaks": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"GoSec": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"HorusecCsharp": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"HorusecDart": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"HorusecJava": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"HorusecKotlin": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"HorusecKubernetes": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"HorusecLeaks": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"HorusecNodeJS": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"NpmAudit": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"PhpCS": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"Safety": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"SecurityCodeScan": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"Semgrep": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"ShellCheck": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"TfSec": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
}, | ||
"YarnAudit": { | ||
"istoignore": false, | ||
"imagepath": "" | ||
} | ||
}, | ||
"horusecCliToolsToIgnore": [], | ||
"horusecCliWorkDir": { | ||
"go": [], | ||
"netCore": [], | ||
"csharp": [], | ||
"ruby": [], | ||
"python": [], | ||
"java": [], | ||
"kotlin": [], | ||
"javaScript": [], | ||
"leaks": [], | ||
"hcl": [], | ||
"php": [], | ||
"c": [], | ||
"yaml": [], | ||
"generic": [] | ||
} | ||
} |
Oops, something went wrong.