Repository navigation
security updates #48
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
base: main
Are you sure you want to change the base?
security updates #48
Changes from all commits
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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| version: 2 | ||
| # Dependabot keeps dependencies and GitHub Actions current. | ||
| # cooldown.default-days: 7 => only propose versions that have been public | ||
| # for at least 7 days, mitigating malicious just-published releases. | ||
| # Note: cooldowns delay version updates, but they do not delay security updates | ||
| # (vulnerability fixes still open immediately). | ||
| updates: | ||
| - package-ecosystem: npm | ||
| directory: "/" | ||
| schedule: | ||
| interval: weekly | ||
| timezone: Europe/Berlin | ||
| cooldown: | ||
| default-days: 7 | ||
| - package-ecosystem: github-actions | ||
| directory: "/" | ||
| schedule: | ||
| interval: weekly | ||
| timezone: Europe/Berlin | ||
| cooldown: | ||
| default-days: 7 | ||
| - package-ecosystem: docker | ||
| directory: "/" | ||
| schedule: | ||
| interval: weekly | ||
| timezone: Europe/Berlin | ||
| cooldown: | ||
| default-days: 7 | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,57 +1,102 @@ | ||||||||||||||||||||||||||||||||||
| name: Trigger N8N Security Scan | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| # Triggered by a PR comment containing "/run-security-scan" (NOT by pull_request | ||||||||||||||||||||||||||||||||||
| # events). Hardened: untrusted context values are passed via env and assembled | ||||||||||||||||||||||||||||||||||
| # with jq (no shell/JSON injection), the trigger is gated to trusted commenters, | ||||||||||||||||||||||||||||||||||
| # the job runs with no GITHUB_TOKEN scope, and the webhook call is authenticated | ||||||||||||||||||||||||||||||||||
| # with a bearer token. | ||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||
| issue_comment: | ||||||||||||||||||||||||||||||||||
| types: [created] | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| permissions: {} | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||
| trigger-n8n: | ||||||||||||||||||||||||||||||||||
| if: github.event.issue.pull_request && contains(github.event.comment.body, '/run-security-scan') | ||||||||||||||||||||||||||||||||||
| # Only react to comments on PRs, only when they contain the command, and only | ||||||||||||||||||||||||||||||||||
| # from trusted members/collaborators/owners — never arbitrary commenters. | ||||||||||||||||||||||||||||||||||
| if: > | ||||||||||||||||||||||||||||||||||
| github.event.issue.pull_request && | ||||||||||||||||||||||||||||||||||
| contains(github.event.comment.body, '/run-security-scan') && | ||||||||||||||||||||||||||||||||||
| contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association) | ||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||
| - name: Prepare hybrid payload | ||||||||||||||||||||||||||||||||||
| - name: Prepare payload | ||||||||||||||||||||||||||||||||||
| id: payload | ||||||||||||||||||||||||||||||||||
| # Every value below is untrusted context: it is injected into the | ||||||||||||||||||||||||||||||||||
| # environment (never inlined into the script with ${{ }}) and then | ||||||||||||||||||||||||||||||||||
| # JSON-encoded by jq, so it cannot break out of the shell or the JSON. | ||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||
| HTML_URL: ${{ github.event.issue.html_url }} | ||||||||||||||||||||||||||||||||||
| REPO: ${{ github.repository }} | ||||||||||||||||||||||||||||||||||
| OWNER: ${{ github.repository_owner }} | ||||||||||||||||||||||||||||||||||
| BRANCH: ${{ github.ref_name }} | ||||||||||||||||||||||||||||||||||
| COMMIT: ${{ github.sha }} | ||||||||||||||||||||||||||||||||||
| ACTOR: ${{ github.actor }} | ||||||||||||||||||||||||||||||||||
| BEFORE: ${{ github.event.before || '' }} | ||||||||||||||||||||||||||||||||||
| AFTER: ${{ github.event.after || '' }} | ||||||||||||||||||||||||||||||||||
| PR: ${{ github.event.pull_request.number || 'null' }} | ||||||||||||||||||||||||||||||||||
| PR_ISSUE: ${{ github.event.issue.pull_request.number || 'null' }} | ||||||||||||||||||||||||||||||||||
| HEAD_SHA: ${{ github.event.pull_request.head.sha || '' }} | ||||||||||||||||||||||||||||||||||
| HEAD_REF: ${{ github.event.pull_request.head.ref || '' }} | ||||||||||||||||||||||||||||||||||
| BASE_SHA: ${{ github.event.pull_request.base.sha || '' }} | ||||||||||||||||||||||||||||||||||
| BASE_REF: ${{ github.event.pull_request.base.ref || '' }} | ||||||||||||||||||||||||||||||||||
| CLONE_URL: ${{ github.event.repository.clone_url || '' }} | ||||||||||||||||||||||||||||||||||
| OVERRIDES: ${{ github.event.inputs.overrides || '' }} | ||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||
| echo "Building payload.json" | ||||||||||||||||||||||||||||||||||
| # Ensure overrides is always valid JSON | ||||||||||||||||||||||||||||||||||
| OVERRIDES='${{ github.event.inputs.overrides }}' | ||||||||||||||||||||||||||||||||||
| if [ -z "$OVERRIDES" ]; then | ||||||||||||||||||||||||||||||||||
| OVERRIDES="{}" | ||||||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||||||
| # Ensure overrides is always valid JSON (empty => {}). | ||||||||||||||||||||||||||||||||||
| OVERRIDES_JSON='{}' | ||||||||||||||||||||||||||||||||||
| if [ -n "${OVERRIDES}" ]; then | ||||||||||||||||||||||||||||||||||
| OVERRIDES_JSON="${OVERRIDES}" | ||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| cat <<EOF > payload.json | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| "htmlUrl": "${{ github.event.issue.html_url }}", | ||||||||||||||||||||||||||||||||||
| "repo": "${{ github.repository }}", | ||||||||||||||||||||||||||||||||||
| "owner": "${{ github.repository_owner }}", | ||||||||||||||||||||||||||||||||||
| "branch": "${{ github.ref_name }}", | ||||||||||||||||||||||||||||||||||
| "commit": "${{ github.sha }}", | ||||||||||||||||||||||||||||||||||
| "actor": "${{ github.actor }}", | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| "before": "${{ github.event.before || '' }}", | ||||||||||||||||||||||||||||||||||
| "after": "${{ github.event.after || '' }}", | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| "pr": ${{ github.event.pull_request.number || 'null' }}, | ||||||||||||||||||||||||||||||||||
| "prIssue": ${{ github.event.issue.pull_request.number || 'null' }}, | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| "headSha": "${{ github.event.pull_request.head.sha || '' }}", | ||||||||||||||||||||||||||||||||||
| "headRef": "${{ github.event.pull_request.head.ref || '' }}", | ||||||||||||||||||||||||||||||||||
| "baseSha": "${{ github.event.pull_request.base.sha || '' }}", | ||||||||||||||||||||||||||||||||||
| "baseRef": "${{ github.event.pull_request.base.ref || '' }}", | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| "cloneUrl": "${{ github.event.repository.clone_url || '' }}", | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| "overrides": $OVERRIDES | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| EOF | ||||||||||||||||||||||||||||||||||
| jq -n \ | ||||||||||||||||||||||||||||||||||
| --arg htmlUrl "${HTML_URL}" \ | ||||||||||||||||||||||||||||||||||
| --arg repo "${REPO}" \ | ||||||||||||||||||||||||||||||||||
| --arg owner "${OWNER}" \ | ||||||||||||||||||||||||||||||||||
| --arg branch "${BRANCH}" \ | ||||||||||||||||||||||||||||||||||
| --arg commit "${COMMIT}" \ | ||||||||||||||||||||||||||||||||||
| --arg actor "${ACTOR}" \ | ||||||||||||||||||||||||||||||||||
| --arg before "${BEFORE}" \ | ||||||||||||||||||||||||||||||||||
| --arg after "${AFTER}" \ | ||||||||||||||||||||||||||||||||||
| --argjson pr "${PR:-null}" \ | ||||||||||||||||||||||||||||||||||
| --argjson prIssue "${PR_ISSUE:-null}" \ | ||||||||||||||||||||||||||||||||||
| --arg headSha "${HEAD_SHA}" \ | ||||||||||||||||||||||||||||||||||
| --arg headRef "${HEAD_REF}" \ | ||||||||||||||||||||||||||||||||||
| --arg baseSha "${BASE_SHA}" \ | ||||||||||||||||||||||||||||||||||
| --arg baseRef "${BASE_REF}" \ | ||||||||||||||||||||||||||||||||||
| --arg cloneUrl "${CLONE_URL}" \ | ||||||||||||||||||||||||||||||||||
| --argjson overrides "${OVERRIDES_JSON}" \ | ||||||||||||||||||||||||||||||||||
| '{ | ||||||||||||||||||||||||||||||||||
| htmlUrl: $htmlUrl, | ||||||||||||||||||||||||||||||||||
| repo: $repo, | ||||||||||||||||||||||||||||||||||
| owner: $owner, | ||||||||||||||||||||||||||||||||||
| branch: $branch, | ||||||||||||||||||||||||||||||||||
| commit: $commit, | ||||||||||||||||||||||||||||||||||
| actor: $actor, | ||||||||||||||||||||||||||||||||||
| before: $before, | ||||||||||||||||||||||||||||||||||
| after: $after, | ||||||||||||||||||||||||||||||||||
| pr: $pr, | ||||||||||||||||||||||||||||||||||
| prIssue: $prIssue, | ||||||||||||||||||||||||||||||||||
| headSha: $headSha, | ||||||||||||||||||||||||||||||||||
| headRef: $headRef, | ||||||||||||||||||||||||||||||||||
| baseSha: $baseSha, | ||||||||||||||||||||||||||||||||||
| baseRef: $baseRef, | ||||||||||||||||||||||||||||||||||
| cloneUrl: $cloneUrl, | ||||||||||||||||||||||||||||||||||
| overrides: $overrides | ||||||||||||||||||||||||||||||||||
| }' > payload.json | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| echo "Payload built:" | ||||||||||||||||||||||||||||||||||
| echo "Payload built (values shown are JSON-escaped):" | ||||||||||||||||||||||||||||||||||
| cat payload.json | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - name: Send payload to n8n webhook | ||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||
| N8N_BEARER_TOKEN: ${{ secrets.N8N_BEARER_TOKEN }} | ||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||
| curl -X POST \ | ||||||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||||||
| curl -fsS -X POST \ | ||||||||||||||||||||||||||||||||||
| -H "Content-Type: application/json" \ | ||||||||||||||||||||||||||||||||||
| -H "Authorization: Bearer ${N8N_BEARER_TOKEN}" \ | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+94
to
+100
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. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win Fail fast when If the secret is not created, the request sends an empty bearer token. Proposed fix set -euo pipefail
+ : "${N8N_BEARER_TOKEN:?N8N_BEARER_TOKEN secret is not set}"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| -d @payload.json \ | ||||||||||||||||||||||||||||||||||
| https://pandoras-box.oceanprotocol.io/webhook/66d5c38a-7df7-4106-a8e3-f3070fcb6858 | ||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.