Skip to content

Commit 734eabe

Browse files
jespinoona-agenteasyCZ
authored
Pin npm dependencies using yarn --frozen-lockfile (#72)
* Disable npm lifecycle scripts and npx for security - Create Dockerfile with ignore-scripts configuration for npm/yarn - Disable npx with informative error message - Update devcontainer.json to use the new Dockerfile Fixes PDE-183 Co-authored-by: Ona <no-reply@ona.com> * Pin npm dependencies using yarn --frozen-lockfile Use yarn install --frozen-lockfile to ensure dependencies are installed from the lock file. Fixes PDE-190 Co-authored-by: Ona <no-reply@ona.com> --------- Co-authored-by: Ona <no-reply@ona.com> Co-authored-by: Milan Pavlik <pavlik.mil@gmail.com>
1 parent 949f16d commit 734eabe

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

.devcontainer/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM mcr.microsoft.com/devcontainers/typescript-node:latest
2+
3+
# Disable npm/yarn lifecycle scripts for security
4+
RUN npm config set ignore-scripts true --location=user && \
5+
echo 'ignore-scripts true' >> ~/.yarnrc
6+
7+
# Disable npx for security
8+
RUN rm -f /usr/bin/npx /usr/local/bin/npx && \
9+
echo '#!/bin/sh' > /usr/local/bin/npx && \
10+
echo 'echo "npx is disabled for security reasons. Use explicit package installation instead." >&2' >> /usr/local/bin/npx && \
11+
echo 'exit 1' >> /usr/local/bin/npx && \
12+
chmod +x /usr/local/bin/npx

.devcontainer/devcontainer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
33
{
44
"name": "Development",
5-
"image": "mcr.microsoft.com/devcontainers/typescript-node:latest",
5+
"build": {
6+
"dockerfile": "Dockerfile"
7+
},
68
"features": {
79
"ghcr.io/devcontainers/features/node:1": {}
810
},
9-
"postCreateCommand": "yarn install",
11+
"postCreateCommand": "yarn install --frozen-lockfile",
1012
"customizations": {
1113
"vscode": {
1214
"extensions": ["esbenp.prettier-vscode"]

.github/workflows/publish-npm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
- name: Install dependencies
2929
run: |
30-
yarn install --ignore-scripts
30+
yarn install --frozen-lockfile --ignore-scripts
3131
3232
- name: Publish to NPM
3333
run: |

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ $ pnpm link -—global @gitpod/sdk
6868
Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
6969

7070
```sh
71-
$ npx prism mock path/to/your/openapi.yml
71+
$ yarn add -D @stoplight/prism-cli
72+
$ yarn prism mock path/to/your/openapi.yml
7273
```
7374

7475
```sh

0 commit comments

Comments
 (0)