From 570636590a3e5ce26be8d190846cecf4b7965ef2 Mon Sep 17 00:00:00 2001 From: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com> Date: Mon, 26 Oct 2026 18:32:44 +0100 Subject: [PATCH] demo: the pipeline with the mistakes glsec reports Signed-off-by: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com> --- bad-pipeline.yml | 60 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/bad-pipeline.yml b/bad-pipeline.yml index 643eaf2..de0dd5e 100644 --- a/bad-pipeline.yml +++ b/bad-pipeline.yml @@ -1,12 +1,62 @@ -# The same service before the changes in the demo pull request: no findings. +# The pipeline of a small Node.js service, with the kind of security mistakes +# glsec reports. Intentionally insecure: don't copy it. -workflow: - rules: - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH +include: + - project: platform/ci-templates + ref: main + file: /templates/notify.yml + - template: Security/Secret-Detection.gitlab-ci.yml + +variables: + DOCKER_AUTH_CONFIG: '{"auths":{"registry.example.com":{"auth":"ZGVwbG95OnMzY3IzdA=="}}}' + +stages: [build, test, deploy] + +build: + stage: build + image: node:latest + script: + - npm install + - npm run build + artifacts: + expire_in: 1 week + paths: + - dist/ + - .env + +docker-image: + stage: build + image: docker:27.3.1 + services: + - docker:27.3.1-dind + variables: + DOCKER_HOST: tcp://docker:2375 + DOCKER_TLS_CERTDIR: "" + script: + - docker build -t registry.example.com/shop/api:$CI_COMMIT_SHORT_SHA . + - docker push registry.example.com/shop/api:$CI_COMMIT_SHORT_SHA test: + stage: test image: node:22.11.0 script: - npm ci + - echo Running tests for $CI_COMMIT_REF_NAME - npm test + +secret_detection: + rules: + - when: never + +deploy: + stage: deploy + image: alpine:3.20.3 + environment: production + id_tokens: + AWS_TOKEN: + aud: https://sts.amazonaws.com + script: + - set -x + - curl -sSL https://get.example.com/install.sh | sh + - 'curl -H "Authorization: Bearer $DEPLOY_TOKEN" "https://hooks.example.com/deploy?branch=$CI_COMMIT_REF_NAME"' + - ssh -o StrictHostKeyChecking=no deploy@prod.example.com ./release.sh