Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 0 additions & 12 deletions .devcontainer/Dockerfile.bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,6 @@ RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then \
chmod +x /usr/bin/asdf && \
rm -rf /tmp/asdf.tar.gz

# install gitsecrets
RUN git clone https://github.com/awslabs/git-secrets.git /tmp/git-secrets && \
cd /tmp/git-secrets && \
make install && \
cd && \
rm -rf /tmp/git-secrets && \
mkdir -p /usr/share/secrets-scanner && \
chmod 755 /usr/share/secrets-scanner && \
curl -L https://raw.githubusercontent.com/NHSDigital/software-engineering-quality-framework/main/tools/nhsd-git-secrets/nhsd-rules-deny.txt -o /usr/share/secrets-scanner/nhsd-rules-deny.txt

USER vscode

Expand Down Expand Up @@ -89,6 +80,3 @@ COPY .devcontainer/.tool-versions.bootstrap /home/vscode/.tool-versions
# install python before poetry to ensure correct python version is used
RUN asdf install python; \
asdf install

RUN git-secrets --register-aws --global && \
git-secrets --add-provider --global -- cat /usr/share/secrets-scanner/nhsd-rules-deny.txt
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ asdf install and setup for these so they are available globally as vscode user
- actionlint
- ruby (for GitHub Pages)

Install and setup git-secrets.
Install and setup gitleaks.

# Using the images
## Project setup
Expand Down Expand Up @@ -89,7 +89,6 @@ RUN if [ -n "${DOCKER_GID}" ]; then \
},
"updateRemoteUserUID": false,
},
"postAttachCommand": "git-secrets --register-aws; git-secrets --add-provider -- cat /usr/share/secrets-scanner/nhsd-rules-deny.txt",
"mounts": [
"source=${env:HOME}${env:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind",
"source=${env:HOME}${env:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind",
Expand Down Expand Up @@ -180,7 +179,7 @@ Check targets (`check.mk`)
- `cfn-guard-cdk` - validates `cdk.out` against cfn-guard rulesets and writes outputs to `.cfn_guard_out/`
- `cfn-guard-terraform` - validates `terraform_plans` against cfn-guard rulesets and writes outputs to `.cfn_guard_out/`
- `actionlint` - runs actionlint against GitHub Actions
- `secret-scan` - runs git-secrets or gitleaks (including scanning history) against the repository
- `secret-scan` - runs gitleaks (including scanning history) against the repository
- `guard-<ENVIRONMENT_VARIABLE>` - checks if an environment variable is set and errors if it is not
- `zizmor` - runs [zizmor](https://github.com/zizmorcore/zizmor) in the local directory to check github workflows and actions
- `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.
Expand Down
6 changes: 1 addition & 5 deletions src/base/.devcontainer/Mk/check.mk
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,7 @@ actionlint:
actionlint

secret-scan:
@if [ -f .gitallowed ]; then \
git-secrets --scan-history .; \
else \
gitleaks -v --redact git; \
fi
gitleaks -v --redact git
Comment thread
anthony-nhs marked this conversation as resolved.

guard-%:
@ if [ "${${*}}" = "" ]; then \
Expand Down
9 changes: 0 additions & 9 deletions src/base/.devcontainer/scripts/lifecycle/post_create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,3 @@
set -euo pipefail

echo "Running common post-create script"


# Install git-secrets, register AWS patterns and NHS rules in an idempotent way
if ! git config --get-all secrets.patterns | grep -Fq AKIA; then
git-secrets --register-aws
fi
if ! git config --get-all secrets.providers | grep -Fxq "cat /usr/share/secrets-scanner/nhsd-rules-deny.txt"; then
git-secrets --add-provider -- cat /usr/share/secrets-scanner/nhsd-rules-deny.txt
fi
11 changes: 0 additions & 11 deletions src/base/.devcontainer/scripts/root_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,6 @@ VERSION="${DIRENV_VERSION}" "${SCRIPTS_DIR}/${CONTAINER_NAME}/install_direnv.sh"
# install yq
VERSION="${YQ_VERSION}" "${SCRIPTS_DIR}/${CONTAINER_NAME}/install_yq.sh"

# install gitsecrets
# this should be removed once we have migrated all repos to gitleaks
git clone https://github.com/awslabs/git-secrets.git /tmp/git-secrets
cd /tmp/git-secrets
make install
cd
rm -rf /tmp/git-secrets
mkdir -p /usr/share/secrets-scanner
chmod 755 /usr/share/secrets-scanner
curl -L https://raw.githubusercontent.com/NHSDigital/software-engineering-quality-framework/main/tools/nhsd-git-secrets/nhsd-rules-deny.txt -o /usr/share/secrets-scanner/nhsd-rules-deny.txt

# get cfn-guard ruleset
tmp_dir="$(mktemp -d)"
Comment thread
anthony-nhs marked this conversation as resolved.
trap 'rm -rf "${tmp_dir}"' EXIT
Expand Down