Skip to content

Commit 7d3bebf

Browse files
committed
demo: the pipeline with the mistakes glsec reports
Signed-off-by: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com>
1 parent 170622f commit 7d3bebf

1 file changed

Lines changed: 55 additions & 5 deletions

File tree

‎bad-pipeline.yml‎

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,62 @@
1-
# The same service before the changes in the demo pull request: no findings.
1+
# The pipeline of a small Node.js service, with the kind of security mistakes
2+
# glsec reports. Intentionally insecure: don't copy it.
23

3-
workflow:
4-
rules:
5-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
6-
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
4+
include:
5+
- project: platform/ci-templates
6+
ref: main
7+
file: /templates/notify.yml
8+
- template: Security/Secret-Detection.gitlab-ci.yml
9+
10+
variables:
11+
DOCKER_AUTH_CONFIG: '{"auths":{"registry.example.com":{"auth":"ZGVwbG95OnMzY3IzdA=="}}}'
12+
13+
stages: [build, test, deploy]
14+
15+
build:
16+
stage: build
17+
image: node:latest
18+
script:
19+
- npm install
20+
- npm run build
21+
artifacts:
22+
expire_in: 1 week
23+
paths:
24+
- dist/
25+
- .env
26+
27+
docker-image:
28+
stage: build
29+
image: docker:27.3.1
30+
services:
31+
- docker:27.3.1-dind
32+
variables:
33+
DOCKER_HOST: tcp://docker:2375
34+
DOCKER_TLS_CERTDIR: ""
35+
script:
36+
- docker build -t registry.example.com/shop/api:$CI_COMMIT_SHORT_SHA .
37+
- docker push registry.example.com/shop/api:$CI_COMMIT_SHORT_SHA
738

839
test:
40+
stage: test
941
image: node:22.11.0
1042
script:
1143
- npm ci
44+
- echo Running tests for $CI_COMMIT_REF_NAME
1245
- npm test
46+
47+
secret_detection:
48+
rules:
49+
- when: never
50+
51+
deploy:
52+
stage: deploy
53+
image: alpine:3.20.3
54+
environment: production
55+
id_tokens:
56+
AWS_TOKEN:
57+
aud: https://sts.amazonaws.com
58+
script:
59+
- set -x
60+
- curl -sSL https://get.example.com/install.sh | sh
61+
- 'curl -H "Authorization: Bearer $DEPLOY_TOKEN" "https://hooks.example.com/deploy?branch=$CI_COMMIT_REF_NAME"'
62+
- ssh -o StrictHostKeyChecking=no deploy@prod.example.com ./release.sh

0 commit comments

Comments
 (0)