Skip to content

Commit

Permalink
🔒 feat: Improve security of CI by not running scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Cory authored and Will Cory committed Dec 14, 2023
1 parent 631b6f4 commit 35cb5a8
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
24 changes: 12 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ jobs:
- "node_modules"
- run:
name: Install dependencies
command: pnpm install --frozen-lockfile --offline
command: pnpm install:ci:offline
- run:
name: print forge version
command: forge --version
Expand Down Expand Up @@ -367,7 +367,7 @@ jobs:
# populate node modules from the cache
- run:
name: Install dependencies
command: pnpm install --frozen-lockfile --prefer-offline
command: pnpm install:ci
- run:
name: print forge version
command: forge --version
Expand Down Expand Up @@ -399,7 +399,7 @@ jobs:
# populate node modules from the cache
- run:
name: Install dependencies
command: pnpm install --frozen-lockfile --prefer-offline
command: pnpm install:ci
# Note: this step needs to come first because one of the later steps modifies the cache & forces a contracts rebuild
- run:
name: semver lock
Expand Down Expand Up @@ -493,7 +493,7 @@ jobs:
- attach_workspace: { at: "." }
- run:
name: Install dependencies
command: pnpm install --frozen-lockfile --prefer-offline
command: pnpm install:ci
- check-changed:
patterns: contracts-bedrock
- run:
Expand Down Expand Up @@ -539,7 +539,7 @@ jobs:
# populate node modules from the cache
- run:
name: Install dependencies
command: pnpm install --frozen-lockfile --prefer-offline
command: pnpm install:ci
- run:
name: Lint
command: pnpm lint && git diff --exit-code
Expand Down Expand Up @@ -568,7 +568,7 @@ jobs:
# populate node modules from the cache
- run:
name: Install dependencies
command: pnpm install --frozen-lockfile --prefer-offline
command: pnpm install:ci
- run:
name: Check generated and build
command: pnpm generate:check
Expand All @@ -590,7 +590,7 @@ jobs:
# populate node modules from the cache
- run:
name: Install dependencies
command: pnpm install --frozen-lockfile --prefer-offline
command: pnpm install:ci
- run:
name: anvil-l1
background: true
Expand Down Expand Up @@ -654,7 +654,7 @@ jobs:
npm i pnpm --global
- run:
name: pnpm dev deps
command: pnpm install --frozen-lockfile --prefer-offline
command: pnpm install:ci
- run:
name: specs toc
command: pnpm lint:specs:toc && git diff --exit-code ./specs
Expand All @@ -674,7 +674,7 @@ jobs:
- run:
name: Install node_modules
command: |
pnpm install --frozen-lockfile --prefer-offline
pnpm install:ci
- run:
name: Lint check
command: |
Expand Down Expand Up @@ -859,7 +859,7 @@ jobs:
name: run tests
command: |
mkdir -p /testlogs
export OP_E2E_CANNON_ENABLED="<<parameters.cannon_enabled>>"
# Note: We don't use circle CI test splits because we need to split by test name, not by package. There is an additional
# constraint that gotestsum does not currently (nor likely will) accept files from different pacakges when building.
Expand Down Expand Up @@ -951,7 +951,7 @@ jobs:
working_directory: indexer
- run:
name: Install node_modules
command: pnpm install --frozen-lockfile --prefer-offline
command: pnpm install:ci
working_directory: indexer/api-ts
- run:
name: Install tygo
Expand Down Expand Up @@ -1068,7 +1068,7 @@ jobs:
- run:
name: Install and build
command: |
pnpm install --frozen-lockfile --prefer-offline && pnpm build
pnpm install:ci && pnpm build
- attach_workspace:
at: /tmp/workspace
- run:
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ runs:

- name: Install node dependencies
shell: bash
run: pnpm install --frozen-lockfile
run: pnpm install:ci
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
with:
with:
main-branch-name: "develop"
- run: |
echo "nx using following shas:"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ build-ts: submodules
if [ -n "$$NVM_DIR" ]; then \
. $$NVM_DIR/nvm.sh && nvm use; \
fi
pnpm install
pnpm install:ci
pnpm build
.PHONY: build-ts

Expand Down
2 changes: 1 addition & 1 deletion ops/docker/Dockerfile.packages
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ WORKDIR /opt/optimism
COPY --from=manifests /tmp/manifests ./
COPY *.json ./

RUN pnpm install --frozen-lockfile
RUN pnpm install:ci

COPY ./packages ./packages

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"build": "npx nx run-many --target=build",
"test": "npx nx run-many --target=test",
"issues": "./ops/scripts/todo-checker.sh",
"install:ci": "pnpm install --ignore-scripts --frozen-lockfile && pnpm postinstall && pnpm rebuild nx",
"install:ci:offline": "pnpm install --ignore-scripts --offline --frozen-lockfile && pnpm postinstall && pnpm rebuild nx",
"lint": "npx nx run-many --target=lint",
"test:coverage": "npx nx run-many --target=test:coverage",
"lint:ts:check": "npx nx run-many --target=lint:ts:check",
Expand Down
2 changes: 1 addition & 1 deletion ufm-test-services/metamask/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN if [ "$METAMASK_PLAYWRIGHT_RUN_HEADLESS" != "false" ]; then \

# Copy necessary files and directories
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml /app/
RUN pnpm install --frozen-lockfile
RUN pnpm install --frozen-lockfile --ignore-scripts
COPY tests /app/tests/
COPY playwright.config.ts /app/
COPY start.sh /app/
Expand Down

0 comments on commit 35cb5a8

Please sign in to comment.