Giter Site home page Giter Site logo

alulsh / alulsh.github.io Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 10.93 MB

Personal website for Alexandra L. Ulsh

Home Page: https://www.alexandraulsh.com/

License: MIT License

HTML 45.49% Ruby 0.56% SCSS 53.95%
github-pages personal-blog personal-website

alulsh.github.io's People

Contributors

alulsh avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar

alulsh.github.io's Issues

Feedback about 2018 docker npmrc security

Hello ๐Ÿ‘‹

I Really enjoyed reading your blog. Recently at work we have been iterating over our Dockerfile for some nodeJS apps and it was great as a reference to communicate trade-offs.

One of our devops/platform engineers showed me a very cool thing not covered in either this article, or the linked one on secrets; so I wanted to contact you, to tell you about it.

Apparently (automated CI builds have succeeded using this), you can both commit a .npmrc, and maintain security using nothing more than a file with wrote environment expansion, and using ARG not ENV to in a build stage make the secret value available.

Sample npmrc.template
registry=https://your-domain-6438763483.d.codeartifact.eu-west-1.amazonaws.com/npm/team/
@products:registry=https://your-domain-6438763483.d.codeartifact.eu-west-1.amazonaws.com/npm/team/
//your-domain-6438763483.d.codeartifact.eu-west-1.amazonaws.com/npm/team/:_authToken=${NPM_TOKEN}
Sample Dockerfile
FROM node:18-alpine as base
ARG NPM_TOKEN
RUN npm set progress=false
EXPOSE 3000
WORKDIR /usr/src/app
COPY ./path-to/npmrc.template ./npmrc
COPY ./path-to/code /usr/src/app
RUN npm ci --omit=optional --no-audit

# ---- as many other stages as you like / need ----

FROM base AS release
RUN npm prune --omit=optional --no-audit --omit=dev
CMD npm start

  • If someone does steal the .npmrc file, they only know the environment variable you are storing the code in.
  • If (like I will be), you use something with an automated CLI to generate an ephemeral token value, then you may have something like --duration-seconds that you can pass to for example aws codeartifact get-authorization-token, which then can be used to mitigate the token validity through lifetime, in even CI pipelines.
  • if you use npm token create within official or supported environments, you could use --read-only with --cidr based IP pattern restriction. npm token docs

Anyway, I hope this is useful if you did not already know about it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.