In this section, we will discuss the security measures we have implemented in the GitHub repository to ensure the integrity and security of the codebase.
To reduce the risk of accidental changes to critical files, we use the CODEOWNERS file. The file is located in the .github folder, and it defines the code owners for the project. The code owners are responsible for reviewing and approving changes to the codebase.
- If not specified otherwise, the code owner are @pstoeckle and @b3n3d17, i.e., one of them must approve the changes.
- Only @b3n3d17 can approve changes to the
/.github/folder, i.e., the GitHub workflows, and other GitHub-related files. - Only @pstoeckle can approve changes to the
/.github/CODEOWNERSfile itself. - Files in the
/demo/and/ui/folders can be approved by anyone who has write access to the repository.
We use reusable workflows for this project. Each workflow starts at a base CI file, i.e., ci.yml, which references the rest. It is important to note that both the parent and the child workflow can define permissions. Using permissions in the child and parent workflow, we want to demonstrate that the child workflow can set less/fewer permissions than the parent, and proceed with them.
Here is an exhaustive list of all workflows you can find in the .github/workflows folder.
Security-related workflows:
java: this workflow uses agradleaction to check the java code and run tests. Thenebula.lintplugin is used to lint thebuild.gradlefile itself. Thejacocoplugin generates test reports that are later included in the PR. Thecom.github.spotbugsplugin checks for common programming bugs in the java code.npm-audit: this workflow usesnpm-auditaction to check thepackage.jsonandpackage-lock.jsonfiles for known vulnerabilities. It is a good practice to run this action to ensure that your JavaScript/TypeScript/NPM dependencies do not contain known vulnerabilities.gitleaks: this workflow usesgitleaksto find passwords, tokens, private keys, or other credentials accidentally committed to the repository. It is a good practice to run this action to ensure that your repository does not contain any sensitive information that an attacker could use to compromise your system, especially if the repository is public.build-container: this workflow demonstrates the flexibility of reusable workflows. It encompasses other actions, and combines them in a bundle. It takes care of everything from building a docker image to analyzing the result. More specifically, this workflow entails:hadolint: this workflow uses thehadolintto lint theDockerfile. It is a good practice to lint yourDockerfiles as it can help catch common mistakes and improve the overall quality of your images.docker: A common workflow to build the container image, and push it to the GitHub Container Registry (ghcr). We need the container image in the container registry to demonstrate other tools that scan the image itself.dockle: this workflow uses thedockleto scan the container image for security vulnerabilities.trivy: this workflow uses thetrivyto generate a Software Bill of Materials (SBOM), and find vulnerabilities in the container image based on the SBOM. Furthermore, the SBOM is then signed viacosignwith a key generated viaGITHUB_TOKEN="<your-token>" cosign generate-key-pair github://USERNAME/REPO.
tflint: this workflow usestflintto lint the Terraform code.kics: this workflow useskicsto scan the codebase for security vulnerabilities.semgrep:semgrepis a static-analysis tool for various languages. Creating an account with the service opens the door to ✨ AI-enhanced ✨ feedback, but the free OSS version can catch some early errors as well.renovatebot: GitHubdependabotis not the only tool out there to update third-party dependencies.renovatecan be added as a separate action, or as a GitHub Application, but you need to create a free account. Since we added it as GitHub Application, there is NO renovate workflow file.
Other workflows:
spelling: No project looks professional without proper spelling! Here, we use thecspellandtyposto check the spelling of the codebase.cspellchecks the documentation, i.e., the*.mdfiles, andtyposthe code files, e.g.,*.javaor*.ts, and configuration files like*.yml.hawkeye: this workflow useshawkeyeto check if all code files have a correct copyright header; you can also usehawkeyeto generate the copyright headers.
In this section, we will discuss security aspects of the CI/CD pipeline itself.
We can categorize the GitHub Actions used in this project into four groups:
Official GitHub Actions:
GitHub Actions from Well-Known Organizations:
aquasecurity/trivy-actioncheckmarx/kics-github-actiondocker/build-push-actiondocker/login-actiondocker/setup-buildx-actiondocker/setup-qemu-actiongitleaks/gitleaks-actiongoodwithtech/dockle-actionhadolint/hadolint-actionsigstore/cosign-installerterraform-linters/setup-tflint
Smaller Organizations:
Single Contributors or few Contributors:
To state this clearly: We do NOT say that the last group is not trustworthy.
We use commit SHAs to pin the versions of the GitHub Actions used in this project. This is a good practice to ensure that the CI/CD pipeline is not affected by changes in the GitHub Actions. Furthermore, we use renovatebot to update the SHAs of the GitHub Actions automatically, but in a controlled manner.
We would like to thank our working students for their contributions to this repository.