Skip to content

Commit

Permalink
migrate tokens, npm audit fix (#9)
Browse files Browse the repository at this point in the history
* migrate tokens, npm audit fix

* update cve exceptions
  • Loading branch information
MaxOSullivan authored May 17, 2023
1 parent 51aa7e5 commit f03bd4b
Show file tree
Hide file tree
Showing 6 changed files with 817 additions and 478 deletions.
42 changes: 21 additions & 21 deletions .drone-1.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,41 @@ steps:
- name: install
image: node:16
environment:
NPM_AUTH_USERNAME:
from_secret: npm_auth_username
NPM_AUTH_TOKEN:
from_secret: npm_auth_token
ART_AUTH_TOKEN:
from_secret: art_auth_token
GITHUB_AUTH_TOKEN:
from_secret: github_token
commands:
- npm ci
- name: test
image: node:16
environment:
NPM_AUTH_USERNAME:
from_secret: npm_auth_username
NPM_AUTH_TOKEN:
from_secret: npm_auth_token
ART_AUTH_TOKEN:
from_secret: art_auth_token
GITHUB_AUTH_TOKEN:
from_secret: github_token
commands:
- npm test
- name: audit
image: node:16
environment:
NPM_AUTH_USERNAME:
from_secret: npm_auth_username
NPM_AUTH_TOKEN:
from_secret: npm_auth_token
ART_AUTH_TOKEN:
from_secret: art_auth_token
GITHUB_AUTH_TOKEN:
from_secret: github_token
commands:
- npm run test:audit
- name: docker build
image: docker:dind
environment:
DOCKER_HOST: tcp://docker:2375
DOCKER_BUILDKIT: 1
NPM_AUTH_USERNAME:
from_secret: npm_auth_username
NPM_AUTH_TOKEN:
from_secret: npm_auth_token
ART_AUTH_TOKEN:
from_secret: art_auth_token
GITHUB_AUTH_TOKEN:
from_secret: github_token
commands:
- docker build --secret id=username,env=NPM_AUTH_USERNAME --secret id=token,env=NPM_AUTH_TOKEN -t asl-attachments .
- docker build --secret id=github_token,env=GITHUB_AUTH_TOKEN --secret id=token,env=ART_AUTH_TOKEN -t asl-attachments .
- name: scan-image
image: 340268328991.dkr.ecr.eu-west-2.amazonaws.com/acp/anchore-submission:latest
pull: always
Expand All @@ -52,10 +52,10 @@ steps:
image: docker:dind
environment:
DOCKER_HOST: tcp://docker:2375
NPM_AUTH_USERNAME:
from_secret: npm_auth_username
NPM_AUTH_TOKEN:
from_secret: npm_auth_token
ART_AUTH_TOKEN:
from_secret: art_auth_token
GITHUB_AUTH_TOKEN:
from_secret: github_token
DOCKER_PASSWORD:
from_secret: docker_password
commands:
Expand Down
8 changes: 5 additions & 3 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@asl:registry = https://artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/
@ukhomeoffice:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_AUTH_TOKEN}

//artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/:username=${NPM_AUTH_USERNAME}
//artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/:_password=${NPM_AUTH_TOKEN}
@asl:registry = https://artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/
//artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/:_authToken=${ART_AUTH_TOKEN}
//artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/:always-auth=true
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ COPY package.json /app/package.json
COPY package-lock.json /app/package-lock.json

RUN --mount=type=secret,id=token,uid=999 \
--mount=type=secret,id=username,uid=999 \
NPM_AUTH_USERNAME=`cat /run/secrets/username` \
NPM_AUTH_TOKEN=`cat /run/secrets/token` \
--mount=type=secret,id=github_token,uid=999 \
GITHUB_AUTH_TOKEN=`cat /run/secrets/github_token` \
ART_AUTH_TOKEN=`cat /run/secrets/token` \
npm ci --production --no-optional

COPY . /app
Expand Down
2 changes: 2 additions & 0 deletions cve-exceptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ CVE-2021-27482
CVE-2021-27498
CVE-2022-0323
GHSA-4jv9-3563-23j3
GHSA-rc47-6667-2j5j
CVE-2018-25076
Loading

0 comments on commit f03bd4b

Please sign in to comment.