Skip to content

Commit 3b8f045

Browse files
committed
update docs
1 parent c7a574f commit 3b8f045

4 files changed

Lines changed: 97 additions & 9 deletions

File tree

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ EPS DEV CONTAINERS
1010
- [Using local or pull request images in Visual Studio Code and GitHub Actions](#using-local-or-pull-request-images-in-visual-studio-code-and-github-actions)
1111
- [Common Makefile targets](#common-makefile-targets)
1212
- [Defined Targets](#targets)
13+
- [Anchore tools](#anchore-tools-syft-grype-grant)
1314

1415
- [Project structure](#project-structure)
1516
- [Pull requests and merge to main process](#pull-requests-and-merge-to-main-process)
@@ -177,7 +178,18 @@ Check targets (`check.mk`)
177178
- `actionlint` - runs actionlint against GitHub Actions
178179
- `secret-scan` - runs git-secrets (including scanning history) against the repository
179180
- `guard-<ENVIRONMENT_VARIABLE>` - checks if an environment variable is set and errors if it is not
180-
- `zizmor` runs [zizmor](https://github.com/zizmorcore/zizmor) in the local directory to check github workflows and actions
181+
- `zizmor` - runs [zizmor](https://github.com/zizmorcore/zizmor) in the local directory to check github workflows and actions
182+
- `syft-generate-sbom` - uses syft to generate an sbom in cyclonedx-json format. This *does not* include dev dependencies. Outputs file to .sbom/sbom.cdx.json.
183+
- `syft-generate-sbom-dev-dependencies`- uses syft to generate an sbom in cyclonedx-json format. This *DOES* include dev dependencies. Outputs file to .sbom/sbom.dev.cdx.json.
184+
- `grype-scan` - Uses grype to scan for vulnerabilities. Uses an sbom generated by `syft-generate-sbom` target to find dependencies.
185+
- `grype-scan-dev-dependencies` - Uses grype to scan for vulnerabilities. Uses an sbom generated by `syft-generate-sbom-dev-dependencies` target to find dependencies.
186+
- `grype-scan-json` - Uses grype to scan for vulnerabilities. Uses an sbom generated by `syft-generate-sbom` target to find dependencies. Outputs file to .sbom/grype_analysis.json
187+
- `grype-scan-json-dev-dependencies` - Uses grype to scan for vulnerabilities. Uses an sbom generated by `syft-generate-sbom-dev-dependencies` target to find dependencies. Outputs file to .sbom/grype_analysis.dev.json
188+
- `grype-scan-local` - Uses grype to scan local folders for vulnerabilities. This is installed as a pre-commit hook in each project.
189+
- `grant-scan` - Uses scan to check for possible incompatible licenses. Uses an sbom generated by `syft-generate-sbom` target to find dependencies.
190+
- `grant-scan-dev-dependencies` - Uses scan to check for possible incompatible licenses. Uses an sbom generated by `syft-generate-sbom-dev-dependencies` target to find dependencies.
191+
- `grant-scan-json` - Uses scan to check for possible incompatible licenses. Uses an sbom generated by `syft-generate-sbom` target to find dependencies. Outputs file to .sbom/grant_analysis.json
192+
- `grant-scan-json-dev-dependencies` - Uses scan to check for possible incompatible licenses. Uses an sbom generated by `syft-generate-sbom-dev-dependencies` target to find dependencies. Outputs file to .sbom/grant_analysis.dev.json
181193

182194
Credentials targets (`credentials.mk`)
183195
- `aws-configure` - configures an AWS SSO session
@@ -195,6 +207,28 @@ These are all changed to not run anything and will be removed in a future releas
195207
- `trivy-scan-java`
196208
- `trivy-scan-docker`
197209

210+
# Anchore tools (syft, grype, grant)
211+
We use tools from [anchore](https://oss.anchore.com/docs/projects/) for various analysis. The tools we use are
212+
- syft to generate SBOM
213+
- grype to scan for vulnerabilities
214+
- grant to check for incompatible licenses
215+
216+
## syft
217+
This is used to generate SBOM (software bill of materials) for dependencies.
218+
There are makefile targets defined that run with most common settings we need. There should be no need to modify any configuration files for use
219+
220+
# grype
221+
This scans for known vulnerabilities.
222+
There are several makefile targets defined that can be used to run this - either outputting to console, or to a json file. It can also run for just runtime dependencies or include dev dependencies.
223+
You may need to create a `.grype.yaml` with known accepted vulnerabilities in a project while we are waiting for downstream dependencies to update. Details of how to do this are documented at https://oss.anchore.com/docs/guides/vulnerability/filter-results/#ignore-specific-vulnerabilities-or-packages
224+
225+
# grant
226+
This scans for incompatible licenses in dependencies.
227+
There are several makefile targets defined that can be used to run this - either outputting to console, or to a json file. It can also run for just runtime dependencies or include dev dependencies.
228+
There is a default .grant.yaml file placed in home directories of devcontainers that lists acceptable licenses and known packages where the scanner incorrectly identified a license for a dependency.
229+
If you need to modify this for a specific project, you must copy this to the root folder of the project and then modify it - eg `cp $HOME/.grant.yaml .`.
230+
See https://oss.anchore.com/docs/guides/license/policies/ for details of what to put in the file.
231+
198232
# Project structure
199233
We have 5 types of dev container. These are defined under src
200234

src/base/.devcontainer/.grant.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
allow:
2+
- MIT*
3+
- Apache-2.0
4+
- BSD-2-Clause
5+
- BSD-3-Clause
6+
- ISC
7+
- 0BSD
8+
- Unlicense
9+
- CC0-1.0
10+
- BlueOak-1.0.0
11+
- BSD
12+
- MPL-2.0
13+
- CC-BY-4.0
14+
- Python-2.0
15+
ignore-packages:
16+
- "case"

src/base/.devcontainer/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ COPY --chmod=755 scripts/vscode_install.sh ${SCRIPTS_DIR}/${CONTAINER_NAME}/vsco
2828
USER vscode
2929
COPY --chown=vscode:vscode .tool-versions.asdf /home/vscode/.tool-versions.asdf
3030
COPY --chown=vscode:vscode .tool-versions /home/vscode/.tool-versions
31+
COPY --chown=vscode:vscode .grant.yaml /home/vscode/.grant.yaml
3132

3233
ENV PATH="/home/vscode/.asdf/shims:/home/vscode/.guard/bin:$PATH"
3334
WORKDIR ${SCRIPTS_DIR}/${CONTAINER_NAME}

src/base/.devcontainer/Mk/check.mk

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,59 @@ guard-%:
9595
zizmor:
9696
zizmor --min-severity medium .
9797

98-
generate-sbom:
98+
syft-generate-sbom:
9999
syft \
100100
--output cyclonedx-json=.sbom/sbom.cdx.json \
101101
dir:./
102102

103-
generate-sbom-dev-deps:
104-
SYFT_JAVASCRIPT_INCLUDE_DEV_DEPENDENCIES=true syft \
103+
syft-generate-sbom-dev-dependencies:
104+
SYFT_JAVASCRIPT_INCLUDE_DEV_DEPENDENCIES=true \
105+
syft \
105106
--output cyclonedx-json=.sbom/sbom.dev.cdx.json \
106107
dir:./
107108

108-
grype-scan: generate-sbom
109-
grype .sbom/sbom.cdx.json \
110-
--output json=".sbom/grype_analysis.json"
111-
112-
grant-scan: generate-sbom
109+
grype-scan: syft-generate-sbom
110+
grype \
111+
--fail-on high \
112+
.sbom/sbom.cdx.json
113+
114+
grype-scan-dev-dependencies: syft-generate-sbom-dev-dependencies
115+
grype \
116+
--fail-on high \
117+
.sbom/sbom.dev.cdx.json
118+
119+
grype-scan-json: syft-generate-sbom
120+
grype \
121+
--fail-on high \
122+
.sbom/sbom.cdx.json \
123+
--output json=".sbom/grype_analysis.json"
124+
125+
grype-scan-json-dev-dependencies: syft-generate-sbom-dev-dependencies
126+
grype \
127+
--fail-on high \
128+
.sbom/sbom.dev.cdx.json \
129+
--output json=".sbom/grype_analysis.dev.json"
130+
131+
grype-scan-local:
132+
grype \
133+
--fail-on high \
134+
.
135+
grant-scan: syft-generate-sbom
136+
grant check \
137+
.sbom/sbom.cdx.json
138+
139+
grant-scan-dev-dependencies: syft-generate-sbom-dev-dependencies
140+
grant check \
141+
.sbom/sbom.dev.cdx.json
142+
143+
grant-scan-json: syft-generate-sbom
113144
grant check .sbom/sbom.cdx.json \
114145
--output json \
115146
--quiet \
116147
--output-file ".sbom/grant_analysis.json"
148+
149+
grant-scan-json-dev-dependencies: syft-generate-sbom-dev-dependencies
150+
grant check .sbom/sbom.dev.cdx.json \
151+
--output json \
152+
--quiet \
153+
--output-file ".sbom/grant_analysis.dev.json"

0 commit comments

Comments
 (0)