-
Notifications
You must be signed in to change notification settings - Fork 88
Use Threshold CI actions and Go Electrum #4329
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
Changes from all commits
871aee6
365277d
66afe9c
808b8d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,9 +48,9 @@ jobs: | |
| run: | ||
| working-directory: ./solidity/random-beacon | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-node@v3 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| # Using fixed version, because 18.16 was sometimes causing issues with | ||
| # artifacts generation during `hardhat compile` - see | ||
|
|
@@ -74,16 +74,16 @@ jobs: | |
| run: | ||
| working-directory: ./solidity/random-beacon | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-node@v3 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| # Using fixed version, because 18.16 was sometimes causing issues with | ||
| # artifacts generation during `hardhat compile` - see | ||
| # https://github.com/NomicFoundation/hardhat/issues/3877 | ||
| node-version: "22.23.1" | ||
|
|
||
| - uses: actions/setup-python@v4 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: 3.10.8 | ||
|
|
||
|
|
@@ -114,9 +114,9 @@ jobs: | |
| run: | ||
| working-directory: ./solidity/random-beacon | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-node@v3 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| # Using fixed version, because 18.16 was sometimes causing issues with | ||
| # artifacts generation during `hardhat compile` - see | ||
|
|
@@ -141,9 +141,9 @@ jobs: | |
| run: | ||
| working-directory: ./solidity/random-beacon | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-node@v3 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| # Using fixed version, because 18.16 was sometimes causing issues with | ||
| # artifacts generation during `hardhat compile` - see | ||
|
|
@@ -174,9 +174,9 @@ jobs: | |
| run: | ||
| working-directory: ./solidity/random-beacon | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-node@v3 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| # Using fixed version, because 18.16 was sometimes causing issues with | ||
| # artifacts generation during `hardhat compile` - see | ||
|
|
@@ -189,7 +189,7 @@ jobs: | |
| working-directory: ./solidity/random-beacon | ||
|
|
||
| - name: Get upstream packages versions | ||
| uses: keep-network/ci/actions/upstream-builds-query@v2 | ||
| uses: threshold-network/ci/actions/upstream-builds-query@86506f8dcdd80179a95ee149cccf4ce9a793ad8d | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
workflow=".github/workflows/contracts-random-beacon.yml"
if rg -n '^[[:space:]]*permissions:' "$workflow"; then
echo "Explicit permissions block found."
else
echo "No explicit permissions block found."
fi
rg -n -C 3 \
'uses: threshold-network/ci/|uses: threshold-network/npm-version-bump|GITHUB_TOKEN|secrets.CI_GITHUB_TOKEN' \
"$workflow"Repository: threshold-network/keep-core Length of output: 2586 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
workflow=".github/workflows/contracts-random-beacon.yml"
printf '%s\n' '--- workflow structure ---'
sed -n '1,80p' "$workflow"
sed -n '180,345p' "$workflow"
printf '%s\n' '--- permissions and token references ---'
rg -n -C 3 '(^|[[:space:]])permissions:|github\.token|GITHUB_TOKEN|CI_GITHUB_TOKEN|actions:|contents:|pull-requests:' "$workflow" || trueRepository: threshold-network/keep-core Length of output: 11115 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
sha="86506f8dcdd80179a95ee149cccf4ce9a793ad8d"
base="https://raw.githubusercontent.com/threshold-network/ci/$sha"
for path in \
actions/upstream-builds-query/action.yml \
actions/npm-version-bump/action.yml \
actions/notify-workflow-completed/action.yml
do
echo "--- $path ---"
curl -fsSL "$base/$path" | sed -n '1,220p'
doneRepository: threshold-network/keep-core Length of output: 2134 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
sha="86506f8dcdd80179a95ee149cccf4ce9a793ad8d"
base="https://raw.githubusercontent.com/threshold-network/ci/$sha"
for path in \
actions/upstream-builds-query/dist/index.js \
actions/npm-version-bump/dist/index.js \
actions/notify-workflow-completed/dist/index.js
do
echo "--- $path: token/API references ---"
curl -fsSL "$base/$path" |
rg -n -o '.{0,100}(GITHUB_TOKEN|github\.getOctokit|Octokit|createDispatch|repos\.|pulls\.|contents\.|packages\.|token).{0,180}' || true
doneRepository: threshold-network/keep-core Length of output: 16454 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
sha="86506f8dcdd80179a95ee149cccf4ce9a793ad8d"
base="https://raw.githubusercontent.com/threshold-network/ci/$sha"
for path in \
actions/upstream-builds-query/dist/index.js \
actions/notify-workflow-completed/dist/index.js
do
echo "--- $path: GitHub client call sites ---"
curl -fsSL "$base/$path" |
rg -n -C 8 'newOctokit\(|octokit\.(request|rest)|createDispatch|repository_dispatch|workflow_dispatch'
doneRepository: threshold-network/keep-core Length of output: 3361 🌐 Web query:
💡 Result: The GITHUB_TOKEN is a unique, ephemeral GitHub App installation access token that GitHub automatically creates for each workflow job to authenticate on behalf of the GitHub App installed on your repository [1][2]. Default Permissions The default permissions for the GITHUB_TOKEN are determined by settings at the enterprise, organization, or repository level [3]. These defaults can be further restricted or granted additional access using the permissions key within your workflow file, which applies at either the workflow or individual job level [3][4]. If you specify any permissions for the GITHUB_TOKEN, all others not explicitly listed are set to none [3]. Note that the metadata scope is always granted read access [5]. Additionally, if a workflow is triggered by a pull request from a forked repository (other than pull_request_target), permissions are automatically downgraded to read-only for security [3]. Accessing the Token You can access the GITHUB_TOKEN through the following methods: 1. Secrets Context: It is automatically included in the secrets context as ${{ secrets.GITHUB_TOKEN }} [6][2]. 2. GitHub Context: Actions can access the token via the github.token context (e.g., github.token) [4][6]. 3. Environment Variables: While the token is available to the workflow, it is not automatically injected as a process environment variable named GITHUB_TOKEN by default [6]. To use it as an environment variable (e.g., for use in a script via process.env.GITHUB_TOKEN), you must explicitly map it in your workflow file [7]: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} Security Best Practices GitHub strongly recommends following the principle of least privilege [8]. You should always explicitly define the minimum required permissions using the permissions key to limit the scope of the token [4][8]. The token expires when the job completes or after 24 hours [2][5]. Citations:
🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
sha="86506f8dcdd80179a95ee149cccf4ce9a793ad8d"
url="https://raw.githubusercontent.com/threshold-network/ci/$sha/actions/upstream-builds-query/dist/index.js"
curl -fsSL "$url" |
rg -n -C 12 'process\.env\.GITHUB_TOKEN|workflowDispatch|workflow-dispatch|run\(|main|upstream-builds|query|actions/workflows'Repository: threshold-network/keep-core Length of output: 50383 Map The pinned action reads Add this mapping to both env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}Set explicit least-privilege permissions after confirming the workflow-dispatch scope required by the action. 🧰 Tools🪛 zizmor (1.29.0)[warning] 1-344: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block (excessive-permissions) [warning] 167-264: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block (excessive-permissions) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
| id: upstream-builds-query | ||
| with: | ||
| upstream-builds: ${{ github.event.inputs.upstream_builds }} | ||
|
|
@@ -224,7 +224,7 @@ jobs: | |
|
|
||
| - name: Bump up package version | ||
| id: npm-version-bump | ||
| uses: keep-network/npm-version-bump@v2 | ||
| uses: threshold-network/ci/actions/npm-version-bump@86506f8dcdd80179a95ee149cccf4ce9a793ad8d | ||
| with: | ||
| work-dir: solidity/random-beacon | ||
| environment: ${{ github.event.inputs.environment }} | ||
|
|
@@ -246,11 +246,11 @@ jobs: | |
| gcrJsonKey: ${{ secrets.KEEP_TEST_GCR_JSON_KEY }} | ||
|
|
||
| - name: Notify CI about completion of the workflow | ||
| uses: keep-network/ci/actions/notify-workflow-completed@v2 | ||
| uses: threshold-network/ci/actions/notify-workflow-completed@86506f8dcdd80179a95ee149cccf4ce9a793ad8d | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} | ||
| with: | ||
| module: "github.com/keep-network/keep-core/random-beacon" | ||
| module: "github.com/threshold-network/keep-core/random-beacon" | ||
| url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
| environment: ${{ github.event.inputs.environment }} | ||
| upstream_builds: ${{ github.event.inputs.upstream_builds }} | ||
|
|
@@ -272,9 +272,9 @@ jobs: | |
| run: | ||
| working-directory: ./solidity/random-beacon | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-node@v3 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| # Using fixed version, because 18.16 was sometimes causing issues with | ||
| # artifacts generation during `hardhat compile` - see | ||
|
|
@@ -287,7 +287,7 @@ jobs: | |
| working-directory: ./solidity/random-beacon | ||
|
|
||
| - name: Get upstream packages versions | ||
| uses: keep-network/ci/actions/upstream-builds-query@v2 | ||
| uses: threshold-network/ci/actions/upstream-builds-query@86506f8dcdd80179a95ee149cccf4ce9a793ad8d | ||
| id: upstream-builds-query | ||
| with: | ||
| upstream-builds: ${{ github.event.inputs.upstream_builds }} | ||
|
|
@@ -309,7 +309,7 @@ jobs: | |
|
|
||
| - name: Bump up package version | ||
| id: npm-version-bump | ||
| uses: keep-network/npm-version-bump@v2 | ||
| uses: threshold-network/ci/actions/npm-version-bump@86506f8dcdd80179a95ee149cccf4ce9a793ad8d | ||
| with: | ||
| work-dir: solidity/random-beacon | ||
| environment: dapp-dev-${{ github.event.inputs.environment }} | ||
|
|
@@ -331,11 +331,11 @@ jobs: | |
| gcrJsonKey: ${{ secrets.KEEP_TEST_GCR_JSON_KEY }} | ||
|
|
||
| - name: Notify CI about completion of the workflow | ||
| uses: keep-network/ci/actions/notify-workflow-completed@v2 | ||
| uses: threshold-network/ci/actions/notify-workflow-completed@86506f8dcdd80179a95ee149cccf4ce9a793ad8d | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} | ||
| with: | ||
| module: "github.com/keep-network/keep-core/random-beacon" | ||
| module: "github.com/threshold-network/keep-core/random-beacon" | ||
| url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
| environment: ${{ github.event.inputs.environment }} | ||
| upstream_builds: ${{ github.event.inputs.upstream_builds }} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: threshold-network/keep-core
Length of output: 12619
🏁 Script executed:
Repository: threshold-network/keep-core
Length of output: 4183
🏁 Script executed:
Repository: threshold-network/keep-core
Length of output: 10054
🏁 Script executed:
Repository: threshold-network/keep-core
Length of output: 11368
🏁 Script executed:
Repository: threshold-network/keep-core
Length of output: 6999
Security Misconfiguration
Reachability: External
Exploitability: Difficult
CWE: CWE-732 — Incorrect Permission Assignment for Critical Resource
Restrict both workflow tokens.
Set explicit least-privilege permissions in all three workflows. The pinned
upstream-builds-queryandnpm-version-bumpimplementations do not need a write-capable automaticGITHUB_TOKEN.notify-workflow-completeddispatches throughsecrets.CI_GITHUB_TOKEN. Workflow permissions do not restrict this secret. Scope it tothreshold-network/ciand the required workflow-dispatch permission.SHA pins do not restrict either token.
🧰 Tools
🪛 zizmor (1.29.0)
[warning] 1-350: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
[warning] 169-268: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
📍 Affects 3 files
.github/workflows/contracts-ecdsa.yml#L194-L194(this comment).github/workflows/npm-ecdsa.yml#L45-L45.github/workflows/npm-random-beacon.yml#L61-L61🤖 Prompt for AI Agents
Source: Linters/SAST tools