Skip to content
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

doc: Security TRG 8 UPDATED #681

Merged
merged 86 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
2f130c7
Security TRG
klaudiaZF Feb 9, 2024
5eb555c
Merge pull request #1 from klaudiaZF/klaudiaZF-patch-1
klaudiaZF Feb 9, 2024
84c2195
Delete docs/release/trg-8 directory
klaudiaZF Feb 16, 2024
1c09c63
Security TRG 8
klaudiaZF Feb 16, 2024
47b4add
Merge branch 'eclipse-tractusx:main' into main
klaudiaZF Feb 16, 2024
34e362d
Delete docs/release/trg-8/trg-8-07.md
klaudiaZF Feb 19, 2024
513590a
Update trg-8-00.md
klaudiaZF Feb 22, 2024
68b4111
Update trg-8-01.md
klaudiaZF Feb 22, 2024
2ed2681
Delete docs/release/trg-8/trg-8-05.md
klaudiaZF Feb 22, 2024
0eb1838
Update trg-8-02.md
klaudiaZF Feb 22, 2024
39aacf3
Update trg-8-03.md
klaudiaZF Feb 22, 2024
35c06c7
Update trg-8-04.md
klaudiaZF Feb 22, 2024
a073b04
Update and rename trg-8-06.md to trg-8-05.md
klaudiaZF Feb 22, 2024
8bfa754
Update trg-8-00.md
klaudiaZF Feb 23, 2024
07e1014
Update trg-8-01.md
klaudiaZF Feb 26, 2024
3e779d4
Update trg-8-01.md
klaudiaZF Feb 26, 2024
58905f7
Update trg-8-01.md
klaudiaZF Feb 26, 2024
6540bbc
Update trg-8-02.md
klaudiaZF Feb 26, 2024
076e242
Update trg-8-04.md
klaudiaZF Feb 26, 2024
7778f1f
Update trg-8-03.md
klaudiaZF Feb 26, 2024
06f3f7c
Update trg-8-05.md
klaudiaZF Feb 26, 2024
7a1c81a
Update trg-8-03.md
klaudiaZF Feb 26, 2024
369cd06
Update trg-8-00.md
klaudiaZF Feb 26, 2024
aa22049
Update trg-8-00.md
klaudiaZF Feb 26, 2024
92a0108
Update trg-8-00.md
klaudiaZF Feb 26, 2024
a10ccb5
Update trg-8-00.md
klaudiaZF Feb 26, 2024
97c0118
Update trg-8-00.md
klaudiaZF Feb 29, 2024
51c3d81
Update trg-8-05.md
klaudiaZF Feb 29, 2024
c332531
Update trg-8-03.md
klaudiaZF Feb 29, 2024
6c75967
Update trg-8-05.md
klaudiaZF Feb 29, 2024
b44cd12
Update trg-8-03.md
klaudiaZF Feb 29, 2024
1ae0a02
Update trg-8-05.md
klaudiaZF Feb 29, 2024
358fc04
Update trg-8-03.md
klaudiaZF Feb 29, 2024
3a42ef3
Update trg-8-00.md
klaudiaZF Mar 1, 2024
7d1b949
Update trg-8-01.md
klaudiaZF Mar 1, 2024
59b8517
Update trg-8-03.md
klaudiaZF Mar 1, 2024
c64d434
Update trg-8-01.md
klaudiaZF Mar 1, 2024
491cb5c
Update trg-8-05.md
klaudiaZF Mar 1, 2024
8b8a49f
Update trg-8-05.md
klaudiaZF Mar 1, 2024
d613ace
docs: delete docs/release/trg-8/trg-8-00.md
scherersebastian Mar 1, 2024
1f66c56
docs: delete docs/release/trg-8/trg-8-02.md
scherersebastian Mar 1, 2024
c708ac0
docs: create trg-8-01.md
scherersebastian Mar 1, 2024
5ae780b
docs: add codeql workflow description
scherersebastian Mar 1, 2024
f36ad75
docs: better why for codeql
scherersebastian Mar 1, 2024
20f5a70
docs: small textual adjustments
scherersebastian Mar 1, 2024
1589198
docs: add trg-8-03 on kics
scherersebastian Mar 1, 2024
d36836a
docs: add paths ignore to codeql workflow
scherersebastian Mar 1, 2024
f88c5c8
docs: emphasize code
scherersebastian Mar 1, 2024
5217ab7
docs: update codeql version
scherersebastian Mar 1, 2024
2e425e3
docs: fail / exit strategy for kics
scherersebastian Mar 1, 2024
d835bc3
docs: correct cron job
scherersebastian Mar 2, 2024
23afbc7
docs: correct schedule
scherersebastian Mar 2, 2024
cbf234b
docs: correct grammar
scherersebastian Mar 2, 2024
7dba489
docs: correct grammar on comments
scherersebastian Mar 2, 2024
c4078ca
docs: codeql fail on error
scherersebastian Mar 2, 2024
ee7280a
docs: kics fail on error
scherersebastian Mar 2, 2024
25b350b
docs: take care of error severity findings
scherersebastian Mar 2, 2024
d7dbefb
docs: fix error and high severity findings
scherersebastian Mar 2, 2024
f951d20
docs: kics failure condition
scherersebastian Mar 4, 2024
f9bf291
docs: failure condition codeql
scherersebastian Mar 4, 2024
174bce0
docs: schedule kics
scherersebastian Mar 4, 2024
8d48374
docs: update trg-8-01.md
scherersebastian Mar 4, 2024
2c79c51
docs: update trg-8-03.md
scherersebastian Mar 4, 2024
d29c3d7
docs: update trg-8-01.md
scherersebastian Mar 4, 2024
a297b38
docs: add trivy draft trg
scherersebastian Mar 4, 2024
10f5ca4
docs: add gitguardian draft trg
scherersebastian Mar 4, 2024
291e35d
Delete docs/release/trg-8/trg-8-05.md
klaudiaZF Mar 5, 2024
393dc15
Delete docs/release/trg-8/trg-8-04.md
klaudiaZF Mar 5, 2024
75c15ea
Delete docs/release/trg-8/trg-8-03.md
klaudiaZF Mar 5, 2024
3923610
Delete docs/release/trg-8/trg-8-01.md
klaudiaZF Mar 5, 2024
fae42e0
Delete docs/release/trg-8/_category_.json
klaudiaZF Mar 5, 2024
5d1702b
adding caution
klaudiaZF Mar 7, 2024
b7043c9
Update trg-8-05.md
klaudiaZF Mar 7, 2024
9f96b14
Update trg-8-05.md
klaudiaZF Mar 7, 2024
ddbe6cd
Caution about QG
klaudiaZF Mar 7, 2024
1e0c6cf
Caution about QG
klaudiaZF Mar 7, 2024
8a149d3
Caution about QG
klaudiaZF Mar 7, 2024
8caf99c
grammar correction
klaudiaZF Mar 7, 2024
82a23a2
docs: update trg-8-01.md
scherersebastian Mar 7, 2024
810521c
docs: update trg-8-03.md
scherersebastian Mar 7, 2024
16e7b83
docs: update trg-8-05.md
scherersebastian Mar 7, 2024
c0d4b99
docs: update trg-8-04.md
scherersebastian Mar 7, 2024
d5bfa3b
docs: update trg-8-03.md
scherersebastian Mar 7, 2024
02b3c89
docs: wrong trg caution
scherersebastian Mar 7, 2024
4a8ab8a
docs: add statement about IP issues
scherersebastian Mar 7, 2024
52e39dc
docs: update trg-8-05.md
scherersebastian Mar 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions docs/release/trg-0/trg-8-01.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
title: TRG 8.01 - CodeQL
---

| Status | Created | Post-History |
|--------|-------------|--------------------------------------|
| Draft | 01-Mar-2024 | Draft release |

## Why

Use CodeQL for deep, static code analysis to identify vulnerabilities and improve code quality across a wide range of programming languages.

## Description

Use CodeQL for all repos with classic code (e.g., C#, Java) without exception. Do not use it for documentation-only or pure IaC repos; it's intended solely for analyzing classic code vulnerabilities. Exclude files as necessary.

The GitHub Actions configuration must include the following triggers:

- `workflow_dispatch`: Manual workflow execution.
- `schedule`: Schedule the workflow to run at least once a week with `0 0 * * 0`.
- `push` and `pull_request`: Activate the workflow on both push and pull request events targeting the branch that contains the code for the currently supported version, which may not necessarily be the `main` branch. This is the branch from which new releases will be made.

Findings appear in the GitHub Advanced Security Dashboard. Dismiss high/error findings as non-exploitable or false positives with required justification in the vulnerability alert. Address high severity findings within 30 days; addressing medium severity findings is strongly recommended.

You can tailor the failure conditions (`fail-on`) for high severity issues in the workflow to suit your team's preferences.

Adjust your code's language and build settings as indicated within the workflow comments.

Example CodeQL workflow:

```yml
name: "CodeQL"

on:
push:
branches: ["main"]
paths-ignore:
- "**/*.md"
- "**/*.txt"
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
paths-ignore:
- "**/*.md"
- "**/*.txt"
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
timeout-minutes: 360
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ["java"] # Define languages here
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' 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@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
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
# Use +security-extended,security-and-quality for wider security and better code quality
queries: +security-extended,security-and-quality

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift)
# Automates dependency installation for Python, Ruby, and JavaScript, optimizing the CodeQL analysis setup
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ 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}}"
fail-on: error
```
77 changes: 77 additions & 0 deletions docs/release/trg-0/trg-8-03.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
title: TRG 8.03 - KICS
---

| Status | Created | Post-History |
|--------|-------------|--------------------------------------|
| Draft | 01-Mar-2024 | Draft release |

## Why

KICS is deployed for comprehensive scanning of Infrastructure as Code (IaC) files, ensuring secure and best-practice configurations across various IaC frameworks.

## Description

KICS is essential for repositories exclusively containing Infrastructure as Code (IaC) files, such as Terraform, CloudFormation, Kubernetes, GitHub Actions, and Helm charts. It's not applicable to traditional programming languages or documentation-only repositories. Exclude non-IaC files as necessary.

Configure your GitHub Actions to include:

- `workflow_dispatch`: Manual workflow execution.
- `schedule`: Schedule the workflow to run at least once a week with `0 0 * * 0`.
- `push` and `pull_request`: Targets the branch that holds the IaC files intended for current deployments, which might not always be the `main` branch.

Findings appear in the GitHub Advanced Security Dashboard. Dismiss high/error findings as non-exploitable or false positives with required justification in the vulnerability alert. Address high severity findings within 30 days; addressing medium severity findings is strongly recommended.

You can tailor the failure conditions (`fail_on`) for high severity issues in the workflow to suit your team's preferences.

Example KICS workflow:

```yml
name: KICS

on:
push:
branches: ["main"]
paths-ignore:
- "**/*.md"
- "**/*.txt"
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
paths-ignore:
- "**/*.md"
- "**/*.txt"
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Run KICS Scan with SARIF result
uses: checkmarx/[email protected]
with:
path: "." # Scanning directory .
output_path: kicsResults/ # Output path for SARIF results
output_formats: "sarif" # Output format
# ignore_on_exit: results # Ignore the results and return exit status code 0 unless a KICS engine error happens
fail_on: high # If you want your pipeline to fail only on high severity results and KICS engine execution errors
# exclude_paths: "terraform/gcp/big_data.tf,terraform/azure" # Exclude paths or files from scan
# exclude_queries: 0437633b-daa6-4bbc-8526-c0d2443b946e # Exclude accepted queries from the build
disable_secrets: true # No secret scanning

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: kicsResults/results.sarif
```
19 changes: 19 additions & 0 deletions docs/release/trg-0/trg-8-04.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: TRG 8.04 - GitGuardian
---

| Status | Created | Post-History |
|--------|-------------|--------------------------------------|
| Draft | 04-Mar-2024 | Draft release |

## Why

GitGuardian excels at detecting and preventing leaks of sensitive data in your code repositories, such as API keys, passwords, and other secrets. This can help you avoid security breaches and comply with data privacy regulations.

## Description

GitGuardian is integrated via its GitHub App, enabling automated secret scanning of our repositories. Each pull request undergoes a scan. If a potential secret is detected, the commit's author receives an immediate email notification.

If a secret is suspected, the pull request will be locked. Immediate action is required regarding the potential secret due to the high risk associated with exposing secrets.

The email contains a _temporary **link**_, allowing the author to either **report** the detected secret or **mark it as a false positive**, streamlining the review process for software engineers.
68 changes: 68 additions & 0 deletions docs/release/trg-0/trg-8-05.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: TRG 8.05 - Trivy
---

| Status | Created | Post-History |
|--------|-------------|--------------------------------------|
| Draft | 04-Mar-2024 | Draft release |

## Why

Trivy scans our Docker containers to accurately identify and remediate vulnerabilities in OS packages and application dependencies, ensuring our environment remains secure.

## Description

Trivy should be used if your project or repository builds containers and publishes them to Docker Hub.

Configure your GitHub Actions to include:

- `workflow_dispatch`: Manual workflow execution.
- `schedule`: Schedule the workflow to run at least once a week with `0 0 * * 0`.

Because Trivy scans the published image on Docker Hub, running it on a `schedule` suffices, removing the necessity to execute it on every push and pull request. Optionally, the local build in the pipeline run can be scanned, using the `push` and `pull_request` triggers for these scans.

In the Trivy workflow, the Docker Hub image scanned must be the currently supported version, not necessarily the `latest` image.

If multiple Docker images, such as frontend and backend, are published from the repository, configure a scan for each image either by using the `matrix` option or by duplicating the necessary steps from the example workflow.

Findings appear in the GitHub Advanced Security Dashboard. Dismiss high/error findings as non-exploitable or false positives with required justification in the vulnerability alert. Address high severity findings within 30 days; addressing medium severity findings is strongly recommended.

You can tailor the failure conditions (`exit-code`, `severity`) for high severity issues in the workflow to suit your team's preferences.

Example Trivy workflow:

```yml
name: "Trivy"

on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:


jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
image-ref: "tractusx/<your-image>:<version>" # Pull image from Docker Hub and run Trivy vulnerability scanner
format: "sarif"
output: "trivy-results.sarif"
exit-code: "1" # Trivy exits with code 1 if vulnerabilities are found, causing the workflow step to fail.
severity: "CRITICAL,HIGH" # While vulnerabilities of all severities are reported in the SARIF output, the exit code and workflow failure are triggered only by these specified severities (CRITICAL or HIGH).
hide-progress: false

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: "trivy-results.sarif"
```
Loading