From bacab809a08fa21320d26c33ef7c0b6923c78141 Mon Sep 17 00:00:00 2001 From: AlexMultiAgent Date: Mon, 23 Nov 2026 08:16:20 +0800 Subject: [PATCH] ci: address the OpenSSF Scorecard findings The Scorecard workflow now publishes its results, so the findings it reports have to be fixed instead of deferred. - License: add the MIT LICENSE at the repository root. The VS Code extension already carried one and was left untouched; the Dify plugin had none and got the same file, so the .difypkg carries its license too. - Security-Policy: add SECURITY.md with the private vulnerability reporting route, what counts as a vulnerability in this project, the disclosure timeline and the supported versions (0.5.0, the shared version line of both products). - Token-Permissions: move security-events: write from the workflow level to the CodeQL analyze job, and give each CI job an explicit contents: read. None of the five CI jobs pushes a commit, creates a release or uploads release assets, so they all stay read-only. - Pinned-Dependencies: pin every uses: in ci.yml and codeql.yml to a full commit SHA with the version in a trailing comment. The SHAs are the peeled commit of the tag, not the tag object. - Add the OpenSSF Scorecard badge to the README. Known remaining findings, left for a follow-up: Packaging, Code-Review, Signed-Releases, CII-Best-Practices, Fuzzing, Contributors, SAST. --- .github/workflows/ci.yml | 41 ++++++++++++++++++++---------- .github/workflows/codeql.yml | 17 ++++++++++--- LICENSE | 21 ++++++++++++++++ README.md | 2 ++ SECURITY.md | 48 ++++++++++++++++++++++++++++++++++++ dify-plugin-MD2Docx/LICENSE | 21 ++++++++++++++++ 6 files changed, 133 insertions(+), 17 deletions(-) create mode 100644 LICENSE create mode 100644 SECURITY.md create mode 100644 dify-plugin-MD2Docx/LICENSE diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 182e1c3..15a9385 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,9 +10,16 @@ on: branches: [main] jobs: + # Every job below declares its own `permissions:` block, so the workflow + # token cannot gain write access by accident. None of these jobs pushes a + # commit, creates a release or uploads release assets -- the .difypkg and the + # .vsix leave the workflow as Actions artifacts (the artifact API), not as + # repository contents -- so `contents: read` is enough for all five. dify-plugin: name: Dify plugin tests runs-on: ubuntu-latest + permissions: + contents: read strategy: fail-fast: false matrix: @@ -26,9 +33,9 @@ jobs: run: working-directory: dify-plugin-MD2Docx steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: actions/setup-python@v7 + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.12" @@ -47,7 +54,7 @@ jobs: run: python scripts/package.py --output dist/MD2Docx.difypkg - name: Upload plugin package - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: MD2Docx-dify-plugin-${{ matrix.dify-plugin-version }} path: dify-plugin-MD2Docx/dist/MD2Docx.difypkg @@ -56,13 +63,15 @@ jobs: vsc-plugin: name: VS Code plugin tests runs-on: ubuntu-latest + permissions: + contents: read defaults: run: working-directory: VSC-plugin-MD2Docx-Converter steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: actions/setup-node@v7 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: "24" @@ -82,7 +91,7 @@ jobs: run: npm run package - name: Upload the VSIX - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: mdocx-converter-vsix path: VSC-plugin-MD2Docx-Converter/*.vsix @@ -91,22 +100,26 @@ jobs: template-sync: name: Template sync check runs-on: ubuntu-latest + permissions: + contents: read steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Verify the Dify templates match the VS Code source of truth run: bash scripts/sync-templates.sh --check preset-parity: name: Preset parity check runs-on: ubuntu-latest + permissions: + contents: read steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: actions/setup-python@v7 + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.12" - - uses: actions/setup-node@v7 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: "24" @@ -130,14 +143,16 @@ jobs: dependency-audit: name: Dependency audit runs-on: ubuntu-latest + permissions: + contents: read steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: actions/setup-python@v7 + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.12" - - uses: actions/setup-node@v7 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: "24" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 9ee2972..37dd06a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -10,9 +10,11 @@ name: CodeQL +# Read-only at the workflow level. `security-events: write` is granted to the +# analyze job only -- the workflow token must not be able to write outside the +# job that actually uploads the SARIF results. permissions: contents: read - security-events: write actions: read packages: read @@ -31,6 +33,13 @@ jobs: name: Analyze (${{ matrix.language }}) runs-on: ubuntu-latest timeout-minutes: 30 + # Job-level permissions replace the workflow-level ones, so the read + # permissions are repeated here and only the SARIF upload is writable. + permissions: + contents: read + actions: read + packages: read + security-events: write strategy: fail-fast: false matrix: @@ -40,16 +49,16 @@ jobs: - language: python paths: dify-plugin-MD2Docx steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Initialize CodeQL - uses: github/codeql-action/init@v4 + uses: github/codeql-action/init@1bd86f2fdb4b86187fa4059f16f31a3202acc9ea # v4.39.4 with: languages: ${{ matrix.language }} paths: ${{ matrix.paths }} 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/LICENSE b/LICENSE new file mode 100644 index 0000000..542fac3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 AlexMultiAgent + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index e21c184..f758f61 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # MD2Docx Converter +[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/AlexMultiAgent/mdocx-converter/badge)](https://api.scorecard.dev/projects/github.com/AlexMultiAgent/mdocx-converter) + Tools that convert Markdown to polished Word (`.docx`) documents, with built-in Chinese/English templates, Mermaid diagram rendering, and fine-grained style control. The project ships the same conversion pipeline in two packaging formats — a VS Code extension for local editing and a Dify plugin for workflow automation. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..a0be6e7 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,48 @@ +# Security Policy + +## Reporting a vulnerability + +Report security problems privately through GitHub's private vulnerability reporting: + +**https://github.com/AlexMultiAgent/mdocx-converter/security/advisories/new** + +Please do not open a public issue for a vulnerability. A public report makes the problem known before a fix exists, which leaves every user of the two products exposed. + +## What counts as a vulnerability + +This repository ships two products that convert Markdown into Word documents: + +- the **VS Code extension** in `VSC-plugin-MD2Docx-Converter/` +- the **Dify plugin** in `dify-plugin-MD2Docx/` + +A report counts as a vulnerability when crafted input can make one of the products do something the user did not ask for, or expose data the user did not intend to share. Typical examples: + +- Markdown input that makes a plugin read or write files outside the working directory, or run a command that was never requested +- a way around the Pandoc sandbox or the Mermaid Ink URL filter to pull content from an arbitrary host +- a template, profile or packaging path that allows traversal or injection +- a crash that a crafted document triggers reliably + +Not vulnerabilities: rendering differences in the produced document, missing features, and problems in the third-party services the plugins call (Pandoc, Mermaid Ink, VS Code, Dify). + +## What to expect + +We aim to acknowledge a report within **7 days** and to publish a fix or a security advisory within **90 days**. We will keep you updated while the vulnerability is being investigated, and we will credit you in the advisory unless you prefer to stay anonymous. + +Please include the affected product, its version, the input that reproduces the problem and what you observed. A minimal reproduction is worth more than a long description. + +## Coordinated disclosure + +We follow a coordinated disclosure practice: the reporter receives the fix and the advisory text before any details become public. We ask for a reasonable embargo until that advisory is ready, and we do not publish a vulnerability before the disclosure timeline above has been met. Every disclosure ends with a public advisory on the repository's Security Advisories page. If several vulnerabilities are reported at once, we may publish one advisory that covers all of them. + +Advisories for already fixed vulnerabilities are published on the same page. + +## Supported versions + +Both products share a single version line. The current release is **0.5.0**. + +| Version | Supported | +| --- | --- | +| 0.5.0 | Yes | +| < 0.5.0 | No | + +Security fixes land on the current version line only, so please upgrade to 0.5.0 before testing a report. diff --git a/dify-plugin-MD2Docx/LICENSE b/dify-plugin-MD2Docx/LICENSE new file mode 100644 index 0000000..542fac3 --- /dev/null +++ b/dify-plugin-MD2Docx/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 AlexMultiAgent + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.