diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 18c74c9094..5380612bb6 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -3,8 +3,11 @@ name: Audit on: push: branches: - - master + - main pull_request: + schedule: + # * is a special character in YAML so you have to quote this string + - cron: "0 14 * * *" concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -13,59 +16,15 @@ concurrency: env: # When getting Rust dependencies, retry on network error: CARGO_NET_RETRY: 10 - # Use the local .curlrc - CURL_HOME: . jobs: - build_matrix: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} - steps: - - uses: actions/checkout@v3 - - id: set-matrix - run: echo "matrix=$(scripts/workflows/audit-matrix.py)" >> $GITHUB_OUTPUT - test: - name: audit - runs-on: ${{ matrix.os }} - needs: [ build_matrix ] - strategy: - matrix: ${{fromJson(needs.build_matrix.outputs.matrix)}} - - steps: - - uses: actions/checkout@v3 - with: - path: sdk - - uses: actions/checkout@v3 - with: - repository: 'RustSec/advisory-db' - path: advisory-db - ref: ${{ matrix.advisory-db-rev }} - - - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rust - run: rustup show - - name: Audit - # ignores RUSTSEC-2020-0071 because it is 'only' in a dev dependency (ic-certified-responses -> ic-types -> chrono -> time) - run: | - cd sdk - cargo audit --no-fetch --db "${GITHUB_WORKSPACE}"/advisory-db --ignore RUSTSEC-2020-0071 - env: - RUST_BACKTRACE: 1 - - aggregate: name: audit:required - if: ${{ always() }} - needs: test runs-on: ubuntu-latest + permissions: + contents: read + issues: write + steps: - - name: check step result directly - if: ${{ needs.test.result != 'success' }} - run: exit 1 + - uses: actions/checkout@v4 + - uses: actions-rust-lang/audit@v1 diff --git a/.github/workflows/niv-updater.yml b/.github/workflows/niv-updater.yml deleted file mode 100644 index f8f90fcda6..0000000000 --- a/.github/workflows/niv-updater.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Automatically update niv-managed dependencies -on: - # Manual override, one can start the workflow by running: - # curl -H "Accept: application/vnd.github.everest-preview+json" \ - # -H "Authorization: token " \ - # --request POST \ - # --data '{"event_type": "niv-updater-nudge", "client_payload": {}}' \ - # https://api.github.com/repos/dfinity-lab/sdk/dispatches - # https://help.github.com/en/actions/reference/events-that-trigger-workflows#external-events-repository_dispatch - repository_dispatch: - types: niv-updater-nudge - schedule: - # * is a special character in YAML so you have to quote this string - - cron: '0 16 * * *' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - # When getting Rust dependencies, retry on network error: - CARGO_NET_RETRY: 10 - # Use the local .curlrc - CURL_HOME: . - -jobs: - niv-updater: - name: 'Check for updates' - timeout-minutes: 2 # if this takes more than 2 minutes then something's wrong - runs-on: ubuntu-latest - steps: - - name: niv-updater-action - uses: knl/niv-updater-action@60f23607814cf4f2e80a1e32ee74f8323897d09e - with: - whitelist: 'common,advisory-db,napalm' - title_prefix: 'build: ' - labels: | - automerge-squash - env: - GITHUB_TOKEN: ${{ secrets.NIV_UPDATER_TOKEN }} diff --git a/nix/sources.json b/nix/sources.json index 43a4856d87..412fa9146c 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -1,17 +1,4 @@ { - "advisory-db": { - "branch": "main", - "builtin": false, - "description": "Security advisory database for Rust crates published through crates.io", - "homepage": "https://rustsec.org", - "owner": "RustSec", - "repo": "advisory-db", - "rev": "fbc3b29acacf335c5fced02566d8f86e59eb1d7a", - "sha256": "1bs2ddk14lsqr9sr1ai7qkszpifaaq81c5b1i3bddi5j7kb43zz6", - "type": "tarball", - "url": "https://github.com/RustSec/advisory-db/archive/fbc3b29acacf335c5fced02566d8f86e59eb1d7a.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, "canister_sandbox-x86_64-darwin": { "builtin": false, "description": "The canister_sandbox binary. It must be updated together with the replica binary.", diff --git a/scripts/workflows/audit-matrix.py b/scripts/workflows/audit-matrix.py deleted file mode 100755 index 3816dc53d3..0000000000 --- a/scripts/workflows/audit-matrix.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python3 - -import json - - -def get_cargo_audit_ref(): - with open('nix/sources.json') as json_file: - data = json.load(json_file) - return data[ 'advisory-db']['rev'] - -matrix = { - 'os': [ 'macos-latest', 'ubuntu-latest' ], - 'cargo-audit': [ '0.17.4' ], - 'advisory-db-rev': [ get_cargo_audit_ref() ] -} - -print(json.dumps(matrix)) \ No newline at end of file