Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔒 feat: Improve security of CI by not running scripts #8626

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 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,8 +951,7 @@ jobs:
working_directory: indexer
- run:
name: Install node_modules
command: pnpm install --frozen-lockfile --prefer-offline
working_directory: indexer/api-ts
command: pnpm install:ci
- run:
name: Install tygo
command: go install github.com/gzuidhof/tygo@latest
Expand Down Expand Up @@ -1068,7 +1067,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