From 0e8b3ef61c958c9495457c9730296c81c9ae3960 Mon Sep 17 00:00:00 2001 From: AlexMultiAgent Date: Mon, 23 Nov 2026 08:13:15 +0800 Subject: [PATCH] ci: address the OpenSSF Scorecard findings The Scorecard workflow now publishes its results, so the findings it reports are worth fixing. Add SECURITY.md: the repository had no security policy, so the Security-Policy check scored 0. It points at the GitHub private advisory form as the reporting route, says what counts as a vulnerability, and states the disclosure timeline -- 7 days to acknowledge, 90 days to publish a fix or an advisory. SECURITY.md is repository metadata rather than runtime, so it is added to .difyignore and to the package verifier's forbidden list; a rebuilt .difypkg still holds exactly the 19 runtime files. Move security-events: write from the CodeQL workflow level down to the analyze job. The workflow-level block is read-only now, and only the job that uploads SARIF to code scanning can write. The release job in ci.yml keeps contents: write -- it creates the GitHub Release and uploads the .difypkg as a release asset, so it genuinely writes. Pin every action in ci.yml and codeql.yml to a full commit SHA, with the version in a trailing comment. Each SHA is the peeled commit of its tag, resolved with git ls-remote; annotated tags carry a separate tag-object SHA, which would be the wrong pin. Dependabot's github-actions ecosystem updates the pins in place. Add the OpenSSF Scorecard badge to the README, under the H1. --- .difyignore | 1 + .github/workflows/ci.yml | 15 +++++---- .github/workflows/codeql.yml | 14 ++++++--- README.md | 2 ++ SECURITY.md | 59 ++++++++++++++++++++++++++++++++++++ scripts/verify_package.py | 1 + 6 files changed, 82 insertions(+), 10 deletions(-) create mode 100644 SECURITY.md diff --git a/.difyignore b/.difyignore index b65e48d..928aca6 100644 --- a/.difyignore +++ b/.difyignore @@ -24,3 +24,4 @@ CHANGELOG.md .env.example uv.lock MARKETPLACE_CHECKLIST.md +SECURITY.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b339cb..c467db9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,11 +11,11 @@ jobs: quality: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: "3.12" - - uses: astral-sh/setup-uv@v6 + - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0 with: enable-cache: true - name: Install locked dependencies @@ -58,7 +58,7 @@ jobs: run: uv run python scripts/verify_package.py "myweather-${{ steps.release.outputs.version }}.difypkg" --source-root . - name: Upload release package if: startsWith(github.ref, 'refs/tags/v') - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: plugin-package path: myweather-${{ steps.release.outputs.version }}.difypkg @@ -68,11 +68,14 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') needs: quality runs-on: ubuntu-latest + # `contents: write` is required here: this job creates the GitHub Release + # for the tag and uploads the `.difypkg` as a release asset. No other job + # writes to the repository. permissions: contents: write steps: - - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: name: plugin-package path: release diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 85e5c12..ceaa62b 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -17,25 +17,31 @@ permissions: contents: read actions: read packages: read - security-events: write jobs: analyze: name: Analyze runs-on: ubuntu-latest timeout-minutes: 30 + # `security-events: write` lives on the job, not on the workflow: only + # this job uploads SARIF to code scanning. + permissions: + actions: read + contents: read + packages: read + security-events: write strategy: fail-fast: false matrix: language: ["python"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - name: Initialize CodeQL - uses: github/codeql-action/init@v4 + uses: github/codeql-action/init@1bd86f2fdb4b86187fa4059f16f31a3202acc9ea # v4.39.4 with: languages: ${{ matrix.language }} queries: security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4 + uses: github/codeql-action/analyze@1bd86f2fdb4b86187fa4059f16f31a3202acc9ea # v4.39.4 with: category: "/language:${{ matrix.language }}" diff --git a/README.md b/README.md index f079c67..bcc93f3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # MyWeather +[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/AlexMultiAgent/dify-plugin-myweather/badge)](https://api.scorecard.dev/projects/github.com/AlexMultiAgent/dify-plugin-myweather) + MyWeather is a Dify weather plugin that requires no API key. - Primary source is selectable: `open-meteo` or `wttr` diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..b185147 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,59 @@ +# Security Policy + +## Reporting a vulnerability + +Report suspected vulnerabilities privately through GitHub's private +vulnerability reporting form: + +- https://github.com/AlexMultiAgent/dify-plugin-myweather/security/advisories/new + +The form opens a private advisory that only the maintainers can read. Do not +open a public issue for a vulnerability report. + +If the advisory form is unavailable, the maintainer contact declared in +`manifest.yaml` is `AlexMultiAgent@users.noreply.github.com`. That is a GitHub +noreply address, so prefer the advisory form above. + +## What counts as a vulnerability + +MyWeather is a Python plugin that runs inside the Dify plugin daemon. In scope: + +- A crafted `location` query that makes the plugin read files outside its own + directory, escape the plugin sandbox, or run unexpected code. +- Path traversal or unsafe file handling in the lookup or packaging logic. +- An upstream provider request that is manipulated into returning data the tool + did not document, or into leaking user input to a third party. +- A vulnerable runtime dependency that is reachable from the shipped code. + +Out of scope: + +- Wrong or missing weather data, or a place name that resolves to the wrong + location. +- Unavailability of wttr.in or Open-Meteo. +- Issues in Dify, in the plugin daemon, or in the upstream providers. + +## What to expect + +- We aim to acknowledge a report within 7 days and to publish a fix or an + advisory within 90 days of the acknowledgement. +- We keep the advisory private while the fix is prepared and released. +- We credit the reporter in the advisory unless anonymity is requested. + +## Disclosure + +- Public disclosure happens through a GitHub Security Advisory on this + repository, together with the release that carries the fix. +- The disclosure timeline is 90 days from acknowledgement. If a fix needs + longer, we publish an advisory that explains the delay. +- We ask reporters to keep the details of any vulnerabilities private until + the disclosure date. + +## Supported versions + +| Version | Supported | +| --- | --- | +| 0.1.4 | Yes — current published release | +| 0.1.5 | In development; supported once published | + +Only the latest published release receives fixes; older versions are not +maintained. diff --git a/scripts/verify_package.py b/scripts/verify_package.py index 53846a0..9a5b97e 100644 --- a/scripts/verify_package.py +++ b/scripts/verify_package.py @@ -58,6 +58,7 @@ ".gitignore", "CHANGELOG.md", "MARKETPLACE_CHECKLIST.md", + "SECURITY.md", "uv.lock", } )