Skip to content

Update to 0.7.0#1723

Closed
ryjones wants to merge 817 commits into
gh-pagesfrom
newdocs
Closed

Update to 0.7.0#1723
ryjones wants to merge 817 commits into
gh-pagesfrom
newdocs

Conversation

@ryjones

@ryjones ryjones commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Checklist

  • A link to the issue/user story that the pull request relates to
  • How to recreate the problem without the fix
  • Design of the fix
  • How to prove that the fix works
  • Automated tests that prove the fix keeps on working
  • Documentation - any JSDoc, website, or Stackoverflow answers?

Issue/User story

Steps to Reproduce

Existing issues

Design of the fix

Validation of the fix

Automated Tests

What documentation has been provided for this pull request

aklenik and others added 30 commits September 22, 2020 12:09
- ConnectorInterface is introduced with pure method declarations
- BlockchainConnector is renamed to ConnectorBase
- ConnectorBase provides sensible default implementations and event utilities
- Lift binding SUT type constraint so 3rd party connectors can be used easier

Signed-off-by: Attila Klenik <a.klenik@gmail.com>
Signed-off-by: D Kelsey <d_kelsey@uk.ibm.com>
Extract default implementation from BlockchainConnector
Identity manager was not waiting for the import call and also had the
parameters in the wrong order.
Also add support to allow for a non existant organization for the
getAliasName api.

Signed-off-by: D Kelsey <d_kelsey@uk.ibm.com>
Signed-off-by: nkl199@yahoo.co.uk <nkl199@yahoo.co.uk>
* Add support for V2 Wallets

Signed-off-by: D Kelsey <d_kelsey@uk.ibm.com>

* Removed whitespace

Signed-off-by: D Kelsey <d_kelsey@uk.ibm.com>
Signed-off-by: nkl199@yahoo.co.uk <nkl199@yahoo.co.uk>
remove ability to bind to broken fabric sdks
Signed-off-by: nkl199@yahoo.co.uk <nkl199@yahoo.co.uk>
Make options robust and add unit tests to prom monitors
Signed-off-by: Attila Klenik <a.klenik@gmail.com>
[Release v0.4.0] Bump version to stable v0.4.0
Signed-off-by: Attila Klenik <a.klenik@gmail.com>
* added wallet support for the v1 connectors

Signed-off-by: RosieMurphy0 <rosie.murphy@ibm.com>

* added wallet support for the v1 connectors

Signed-off-by: RosieMurphy0 <rosie.murphy@ibm.com>

* added wallet support for the v1 connectors

Signed-off-by: RosieMurphy0 <rosie.murphy@ibm.com>
Signed-off-by: nkl199@yahoo.co.uk <nkl199@yahoo.co.uk>
Prevent failures in integration tests
* Added support for Besu private transactions

Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>

* Fix LGTM warning

Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>

* Updated tx count

Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>

* Fix variable name

Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>
Signed-off-by: D Kelsey <d_kelsey@uk.ibm.com>
Signed-off-by: nkl199@yahoo.co.uk <nkl199@yahoo.co.uk>
Signed-off-by: D Kelsey <d_kelsey@uk.ibm.com>
Signed-off-by: nkl199@yahoo.co.uk <nkl199@yahoo.co.uk>
Update txCollector and add unit tests
francescomiliani and others added 27 commits January 23, 2025 15:12
Fix typo

Signed-off-by: francesco.miliani <75777914+francescomiliani@users.noreply.github.com>
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.0.0-20220708220712-1185a9018129 to 0.36.0.
- [Commits](https://github.com/golang/net/commits/v0.36.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.28.0 to 0.36.0.
- [Commits](golang/net@v0.28.0...v0.36.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Dave Kelsey <dkel50@hotmail.com>
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.36.0 to 0.38.0.
- [Commits](golang/net@v0.36.0...v0.38.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.38.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.36.0 to 0.38.0.
- [Commits](golang/net@v0.36.0...v0.38.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.38.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Can still bind to 2.2 and fabric-gateway

Signed-off-by: Dave Kelsey <dkel50@hotmail.com>
- Also delete obsolute and out of date script
- Also improve details on targetPeers and remove documented restriction
of targetOrgansations for new peer gateway connector
fixes #1216

Signed-off-by: Dave Kelsey <dkel50@hotmail.com>
fixes #1418
Signed-off-by: Dave Kelsey <dkel50@hotmail.com>
Signed-off-by: Dave Kelsey <dkel50@hotmail.com>
Signed-off-by: Dave Kelsey <dkel50@hotmail.com>
Update mocha, sinon and nyc so they are at the same levels latest
versions. Also matched chai across all packages but currently not the
latest version as it may not work

Also added in a unit test for connector-interface

Signed-off-by: Dave Kelsey <dkel50@hotmail.com>
Signed-off-by: Dave Kelsey <dkel50@hotmail.com>
Signed-off-by: Dave Kelsey <dkel50@hotmail.com>
fixes #1177

Signed-off-by: Dave Kelsey <dkel50@hotmail.com>
Signed-off-by: Dave Kelsey <dkel50@hotmail.com>
Signed-off-by: Attila Klenik <a.klenik@gmail.com>
Signed-off-by: Attila Klenik <a.klenik@gmail.com>
Signed-off-by: Ry Jones <ry@linux.com>
…ic CI (#1711)

* update node version to 22.x for package, CI and publishing related runs
* add node version 24.x for unit and integration tests
* remove 18.x and 20.x node versions
* consolidate Fabric integration test workload modules through configs
* fix workload module references in Fabric benchmark configurations

Signed-off-by: Attila Klenik <a.klenik@gmail.com>
Signed-off-by: Attila Klenik <a.klenik@gmail.com>
* tell the npm config command explicitly that it does not operate with workspaces
* set root package to private to prevent accidental publishing of monorepo
* updated git repo naming format in package.json files
* remove generator-caliper from integration test and publishing, pending removal of package itself

Signed-off-by: Attila Klenik <a.klenik@gmail.com>
Signed-off-by: Attila Klenik <a.klenik@gmail.com>
)

Signed-off-by: Attila Klenik <a.klenik@gmail.com>
Signed-off-by: Attila Klenik <a.klenik@gmail.com>
Docker Outside of Docker changed something and now we have to explicitly
tell it not to use Moby

Signed-off-by: Dave <d_kelsey@uk.ibm.com>
Co-authored-by: Dave <d_kelsey@uk.ibm.com>
Set default version to 0.7.0 with mike 2.1.2

Signed-off-by: Ry Jones <ry@linux.com>
Comment on lines +8 to +24
name: Coverage Reports
runs-on: ubuntu-latest
strategy:
matrix:
package: [caliper-core, caliper-fabric]
steps:
- uses: actions/checkout@v3
- name: Download coverage reports artifact
uses: actions/download-artifact@v4.1.8
with:
name: coverage-reports
path: packages
- name: Upload coverage reports
uses: codecov/codecov-action@v3.1.0
with:
files: packages/${{ matrix.package }}/coverage/clover.xml
flags: ${{ matrix.package }}

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 10 months ago

To fix this issue, you should explicitly declare the permissions key in the workflow. The preferred method is to set it at the top level (after name: but before on:), so it applies to all jobs and reinforces repository security. The minimal permission almost always required by a workflow that only checks out code and uploads/downloads artifacts is contents: read. The best way to address this is to add:

permissions:
  contents: read

on line 2, pushing the rest of the lines down. No additional methods, imports, or definitions are required for this change since it's a pure YAML configuration edit.


Suggested changeset 1
.github/workflows/coverage.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -1,4 +1,6 @@
 name: Coverage Reports
+permissions:
+  contents: read
 
 on:
   workflow_call:
EOF
@@ -1,4 +1,6 @@
name: Coverage Reports
permissions:
contents: read

on:
workflow_call:
Copilot is powered by AI and may make mistakes. Always verify output.
Comment thread .github/workflows/dci.yml
Comment on lines +9 to +18
name: DCI-Lint
runs-on: ubuntu-latest
steps:
- name: Lint Git Repo
id: lint-git-repo
uses: petermetz/gh-action-dci-lint@v0.6.1
with:
lint-git-repo-request: '{"cloneUrl": "${{ github.server_url }}/${{ github.repository }}.git", "fetchArgs": ["--no-tags", "--prune", "--progress", "--no-recurse-submodules", "--depth=1", "origin" ,"+${{ github.sha }}:${{ github.ref }}"], "checkoutArgs": [ "${{ github.ref }}"], "targetPhrasePatterns": [], "configDefaultsUrl": "https://inclusivenaming.org/json/dci-lint-config-recommended-v1.json" }'
- name: Get the output response
run: echo "${{ steps.lint-git-repo.outputs.lint-git-repo-response }}" No newline at end of file

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 10 months ago

To fix the problem, you should explicitly set the least required permissions for the job to avoid accidentally exposing write privileges to the GITHUB_TOKEN. Since the workflow only clones the repository, fetches commits, and checks out code (all reading operations), it should only need read access to repository contents. Thus, you should add a permissions block at the job (DCI-lint) level granting contents: read. This ensures the job does not have unnecessary write privileges. The change is to insert the following under jobs: DCI-lint: (after line 9, before runs-on): permissions: contents: read.


Suggested changeset 1
.github/workflows/dci.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/dci.yml b/.github/workflows/dci.yml
--- a/.github/workflows/dci.yml
+++ b/.github/workflows/dci.yml
@@ -7,6 +7,8 @@
 jobs:
   DCI-lint:
     name: DCI-Lint
+    permissions:
+      contents: read
     runs-on: ubuntu-latest
     steps:
     - name: Lint Git Repo
EOF
@@ -7,6 +7,8 @@
jobs:
DCI-lint:
name: DCI-Lint
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Lint Git Repo
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +11 to +29
name: Check for changes
runs-on: ubuntu-latest
outputs:
adaptor: ${{ steps.filter.outputs.changes }}
steps:
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
fabric:
- 'packages/caliper-cli/**'
- 'packages/caliper-core/**'
- 'packages/caliper-fabric/**'
- 'packages/caliper-publish/**'
- 'packages/caliper-tests-integration/fabric_tests/**'
- '.github/workflows/integration-tests.yml'
- 'package-lock.json'

integration-tests:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 10 months ago

To fix the problem, add a permissions block to limit the GITHUB_TOKEN's permissions—minimally to read-only unless write privileges are needed. This can be set at the top level of the workflow (affecting all jobs) or per job. Based on the given workflow, no step appears to require modifying repository or pull request content directly; the jobs use dependency installation, caching, and run scripts, but do not interact with GitHub APIs in a way that requires write access. Therefore, the minimal and recommended change is to add, at the top of .github/workflows/integration-tests.yml, immediately after name: Integration Tests, a permissions: block set to contents: read. This approach is explicit and disables unnecessary write permissions.


Suggested changeset 1
.github/workflows/integration-tests.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml
--- a/.github/workflows/integration-tests.yml
+++ b/.github/workflows/integration-tests.yml
@@ -1,4 +1,6 @@
 name: Integration Tests
+permissions:
+  contents: read
 
 on:
   workflow_call:
EOF
@@ -1,4 +1,6 @@
name: Integration Tests
permissions:
contents: read

on:
workflow_call:
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +30 to +78
needs: changes
if: ${{ needs.changes.outputs.adaptor != '[]' && needs.changes.outputs.adaptor != '' }}
name: Integration Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
adaptor: ${{ fromJSON(needs.changes.outputs.adaptor) }}
node-version: [22.x, 24.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install higher version of NPM
run: npm install -g npm@${{ env.NPM_VERSION }}
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
with:
path: |
node_modules
packages/*/node_modules
key: ${{ matrix.node-version }}-npm-cache-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ matrix.node-version }}-npm-cache-
- name: Cache SUT binding
id: cache-sut
uses: actions/cache@v3
with:
path: /tmp/sut/cached
key: ${{ format('{0}-sut-cache-{1}-{2}', matrix.node-version, matrix.adaptor, hashFiles(format('packages/caliper-tests-integration/{0}_tests/run.sh', matrix.adaptor))) }}
restore-keys: |
${{ matrix.node-version }}-sut-cache-${{ matrix.adaptor }}-
- name: Install project dependencies
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci
- name: Create directory to store SUT bindings
if: steps.cache-sut.outputs.cache-hit != 'true'
run: mkdir -p /tmp/sut
- name: Run integration tests
run: ./run-tests.sh
working-directory: ./packages/caliper-tests-integration/
env:
BENCHMARK: ${{ matrix.adaptor }}
CALL_METHOD: "node ${{ github.workspace }}/packages/caliper-cli/caliper.js"
BIND_IN_PACKAGE_DIR: "true"
SUT_DIR: "/tmp/sut"

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 10 months ago

The best way to fix this problem is to explicitly define the permissions: block in the workflow, limiting the permissions granted to the GITHUB_TOKEN as tightly as possible. Since this workflow only needs to read repository content (for code checkout, paths filtering, and possibly caching), we can safely set permissions: contents: read at the root level. This ensures all jobs inherit this restrictive permission unless they individually override it. The top of the workflow file (beneath the name: line) is the appropriate place to insert the permissions: block.


Suggested changeset 1
.github/workflows/integration-tests.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml
--- a/.github/workflows/integration-tests.yml
+++ b/.github/workflows/integration-tests.yml
@@ -1,4 +1,6 @@
 name: Integration Tests
+permissions:
+  contents: read
 
 on:
   workflow_call:
EOF
@@ -1,4 +1,6 @@
name: Integration Tests
permissions:
contents: read

on:
workflow_call:
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +9 to +10
uses: ./.github/workflows/unit-tests.yml
coverage:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 10 months ago

The best way to fix the issue is to add an explicit permissions block to the workflow, either at the top (workflow) level or (if jobs have specific requirements) per job. Adding it at the top level ensures all jobs inherit these settings (unless overridden in the individual job), ensuring the principle of least privilege throughout. Since most CI workflows only require read access to the repository content, set contents: read as a minimal starting point. If specific jobs require more, those jobs can override individually.

File/region to change: .github/workflows/main.yml, directly after the name: (line 1).
Required: Insert the minimal block:

permissions:
  contents: read

No new methods, imports, or definitions are needed.

Suggested changeset 1
.github/workflows/main.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,4 +1,6 @@
 name: CI (Publish)
+permissions:
+  contents: read
 
 on:
   push:
EOF
@@ -1,4 +1,6 @@
name: CI (Publish)
permissions:
contents: read

on:
push:
Copilot is powered by AI and may make mistakes. Always verify output.
Comment thread .github/workflows/pr.yml
Comment on lines +9 to +10
uses: ./.github/workflows/dci.yml
unit-tests:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Comment thread .github/workflows/pr.yml
Comment on lines +11 to +13
uses: ./.github/workflows/unit-tests.yml
needs: dci-lint
coverage:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 10 months ago

To fix the problem, explicitly define a permissions block at the top (root) of .github/workflows/pr.yml to restrict the default permissions granted to GITHUB_TOKEN. The recommended minimum is to set all permissions to read unless you know the jobs require write for specific scopes (which they almost never do for jobs triggered by PRs). Since the workflow only delegates to other workflows, and unless otherwise required, set permissions: read-all, which grants read-only access to all scopes.

Add the following block after the name: and before on:. No changes to existing jobs are required, nor are new imports or definitions needed for this fix.


Suggested changeset 1
.github/workflows/pr.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -1,4 +1,5 @@
 name: CI (PR)
+permissions: read-all
 
 on:
   pull_request:
EOF
@@ -1,4 +1,5 @@
name: CI (PR)
permissions: read-all

on:
pull_request:
Copilot is powered by AI and may make mistakes. Always verify output.
Comment thread .github/workflows/pr.yml
Comment on lines +14 to +16
uses: ./.github/workflows/coverage.yml
needs: unit-tests
integration-tests:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 10 months ago

The best way to fix this issue is to explicitly set the least privileged permissions block at the root level of your workflow file, so that all jobs inherit these permissions unless they override them. In this case, since the workflow primarily coordinates and invokes other composite workflows (via uses), and unless they require broader privileges, the most secure minimal permissions would usually be contents: read. This limits the default GitHub token to minimal access, preventing write or administrative actions. To implement: insert the following block after the name line, before on::

permissions:
  contents: read

If you know that any of the called workflows require additional permissions beyond reading contents, you can extend the block as appropriate; otherwise, start with the most conservative setting.

How to do it:

  • Edit .github/workflows/pr.yml
  • After the name: ... line, add a new line with the permissions: block as shown.

There are no package dependencies to add; it is purely a YAML edit.


Suggested changeset 1
.github/workflows/pr.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -1,4 +1,6 @@
 name: CI (PR)
+permissions:
+  contents: read
 
 on:
   pull_request:
EOF
@@ -1,4 +1,6 @@
name: CI (PR)
permissions:
contents: read

on:
pull_request:
Copilot is powered by AI and may make mistakes. Always verify output.
Comment thread .github/workflows/pr.yml
Comment on lines +17 to +18
uses: ./.github/workflows/integration-tests.yml
needs: unit-tests

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 10 months ago

To fix the problem, you should add a permissions block at the workflow root level in .github/workflows/pr.yml. This will apply least-privilege permissions to all jobs unless overridden by individual jobs or their referenced included workflows. The minimal recommended permissions block is:

permissions:
  contents: read

If your jobs or the included workflows require additional permissions (for example, to create/update pull requests, issues, or more), you may expand the block as needed, but start with least privilege (usually just contents: read for typical CI jobs).

The change must be made at the top level of .github/workflows/pr.yml (just below name: and above on:). No additional imports or code definitions are needed. This change does not affect existing functionality and simply restricts the default permissions inherited by GitHub Actions jobs.

Suggested changeset 1
.github/workflows/pr.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -1,4 +1,6 @@
 name: CI (PR)
+permissions:
+  contents: read
 
 on:
   pull_request:
EOF
@@ -1,4 +1,6 @@
name: CI (PR)
permissions:
contents: read

on:
pull_request:
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +11 to +49
name: Unit Tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x, 24.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install higher version of NPM
run: npm install -g npm@${{ env.NPM_VERSION }}
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
with:
path: |
node_modules
packages/*/node_modules
key: ${{ matrix.node-version }}-npm-cache-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ matrix.node-version }}-npm-cache-
- name: Check correct usage of Caliper package names
run: ./scripts/check-package-names.sh
- name: Install project dependencies
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci
- name: Check the version consistency of subpackages
run: ./packages/caliper-publish/publish.js version check
- name: Run unit tests
run: npm test --workspaces
- name: Upload coverage reports artifact
if: matrix.node-version == '22.x'
uses: actions/upload-artifact@v4.4.0
with:
name: coverage-reports
path: packages/*/coverage/clover.xml
if-no-files-found: warn

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 10 months ago

To fix the problem, explicitly declare the permissions for the relevant job(s) or at the workflow root in .github/workflows/unit-tests.yml, restricting the GitHub token permissions according to the principle of least privilege. For this workflow, basic read access for source code (contents: read) suffices for tasks like checking out code, running tests, and uploading artifacts. If additional write permissions are ever needed (such as uploading comments to pull requests), those can be granted specifically; however, for the provided workflow, contents: read fully suffices.

Specifically, add:

  • At the workflow root (top-level):
    permissions:
      contents: read
    This grants only read access to the repo contents for all jobs in the workflow, and is the minimal starting point recommended by CodeQL.

Edit lines at the top of .github/workflows/unit-tests.yml to insert this block just below name: and above on:.


Suggested changeset 1
.github/workflows/unit-tests.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml
--- a/.github/workflows/unit-tests.yml
+++ b/.github/workflows/unit-tests.yml
@@ -1,4 +1,6 @@
 name: Unit Tests
+permissions:
+  contents: read
 
 on:
   workflow_call:
EOF
@@ -1,4 +1,6 @@
name: Unit Tests
permissions:
contents: read

on:
workflow_call:
Copilot is powered by AI and may make mistakes. Always verify output.
@ryjones ryjones closed this Oct 3, 2025
@ryjones
ryjones deleted the newdocs branch October 3, 2025 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.