diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5cc8e24..a714208 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -141,7 +141,7 @@ jobs: run: | cd crates/markkit-wasm/pkg npm pack --dry-run --json --ignore-scripts > "$RUNNER_TEMP/wasm-pack.json" - node -e 'const files=new Set(require(process.argv[1])[0].files.map(f=>f.path)); for (const f of ["index.js","index.d.ts","markkit_wasm.js","markkit_wasm_bg.wasm","README.md"]) if(!files.has(f)) throw Error("archive lacks "+f)' "$RUNNER_TEMP/wasm-pack.json" + node -e 'const files=new Set(require(process.argv[1])[0].files.map(f=>f.path)); for (const f of ["index.js","index.d.ts","markkit_wasm.js","markkit_wasm_bg.wasm","README.md","LICENSE","NOTICE"]) if(!files.has(f)) throw Error("archive lacks "+f)' "$RUNNER_TEMP/wasm-pack.json" check: name: Check diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index b4170d0..efed3d2 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -39,7 +39,7 @@ jobs: run: | cd crates/markkit-js npm pack --ignore-scripts --json > "$RUNNER_TEMP/markkit-pack.json" - node -e 'const p=require(process.argv[1])[0]; const files=p.files.map(f=>f.path); if(!files.includes("index.js") || !files.some(f=>f.endsWith(".node"))) throw Error("npm package must contain its loader and native binary")' "$RUNNER_TEMP/markkit-pack.json" + node -e 'const p=require(process.argv[1])[0]; const files=p.files.map(f=>f.path); if(!files.includes("index.js") || !files.some(f=>f.endsWith(".node"))) throw Error("npm package must contain its loader and native binary"); for (const f of ["LICENSE","NOTICE"]) if(!files.includes(f)) throw Error("npm package lacks "+f)' "$RUNNER_TEMP/markkit-pack.json" TARBALL=$(node -e 'console.log(require(process.argv[1])[0].filename)' "$RUNNER_TEMP/markkit-pack.json") npm install --prefix "$RUNNER_TEMP/markkit-npm-smoke" --ignore-scripts --audit=false --fund=false "$PWD/$TARBALL" node -e 'const m=require(process.argv[1]); if(m.extractHtmlSync("

Smoke

").trim()!=="# Smoke") throw Error("native extraction smoke failed")' "$RUNNER_TEMP/markkit-npm-smoke/node_modules/@everruns/markkit" diff --git a/.github/workflows/publish-js.yml b/.github/workflows/publish-js.yml index eff2e42..5112fec 100644 --- a/.github/workflows/publish-js.yml +++ b/.github/workflows/publish-js.yml @@ -61,7 +61,7 @@ jobs: run: | cd crates/markkit-js npm pack --ignore-scripts --json > "$RUNNER_TEMP/markkit-pack.json" - node -e 'const p=require(process.argv[1])[0]; const files=p.files.map(f=>f.path); if(!files.includes("index.js") || !files.some(f=>f.endsWith(".node"))) throw Error("npm package must contain its loader and native binary")' "$RUNNER_TEMP/markkit-pack.json" + node -e 'const p=require(process.argv[1])[0]; const files=p.files.map(f=>f.path); if(!files.includes("index.js") || !files.some(f=>f.endsWith(".node"))) throw Error("npm package must contain its loader and native binary"); for (const f of ["LICENSE","NOTICE"]) if(!files.includes(f)) throw Error("npm package lacks "+f)' "$RUNNER_TEMP/markkit-pack.json" TARBALL=$(node -e 'console.log(require(process.argv[1])[0].filename)' "$RUNNER_TEMP/markkit-pack.json") npm install --prefix "$RUNNER_TEMP/markkit-npm-smoke" --ignore-scripts --audit=false --fund=false "$PWD/$TARBALL" node -e 'const m=require(process.argv[1]); if(m.extractHtmlSync("

Smoke

").trim()!=="# Smoke") throw Error("native extraction smoke failed")' "$RUNNER_TEMP/markkit-npm-smoke/node_modules/@everruns/markkit" diff --git a/CHANGELOG.md b/CHANGELOG.md index cd724be..caf37f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/). PyPI project links, keywords and classifiers. - Releases now publish PyPI and npm (native + WASM) together with crates.io. +### Fixed + +- Every published package (crates.io crates, PyPI wheel/sdist, `@everruns/markkit`, + `@everruns/markkit-wasm`) now ships `LICENSE` and `NOTICE`. Python metadata + declares `License-Expression: MIT`. `NOTICE` reproduces the BSD notices for the + PDFium/Foxit fonts and Adobe CMaps embedded by PDF rendering (`pdf-ocr`). +- `SECURITY.md` lists 0.3.x as supported, adds GitHub private vulnerability + reporting, and covers the WASM package and agent tool. + ## [0.3.1] - 2026-11-03 ### Security diff --git a/NOTICE b/NOTICE index a751509..c978571 100644 --- a/NOTICE +++ b/NOTICE @@ -24,16 +24,100 @@ by, or derived from any of the above projects. === Key Dependencies === -Markkit relies on several permissively licensed crates: +Markkit relies on permissively licensed crates, including: -* scraper (MIT) – HTML parsing and CSS selector matching -* html5ever (MIT/Apache-2.0) – HTML5 parsing +* scraper (ISC), html5ever (MIT/Apache-2.0) – HTML parsing * zip (MIT), quick-xml (MIT), calamine (MIT), cfb (MIT) – Office document containers and XML -* reqwest (MIT/Apache-2.0) – HTTP client -* tokio (MIT) – Async runtime -* serde / serde_json (MIT/Apache-2.0) – Serialization +* hayro-syntax / hayro (MIT/Apache-2.0) – PDF parsing and page rendering +* ocrs, rten (MIT/Apache-2.0) – optional Rust OCR backend +* reqwest (MIT/Apache-2.0), rustls (Apache-2.0/ISC/MIT) – optional HTTP client +* tokio (MIT) – async runtime +* serde / serde_json (MIT/Apache-2.0) – serialization +* pyo3 (MIT/Apache-2.0), napi (MIT), wasm-bindgen (MIT/Apache-2.0) – bindings -Full dependency license details are available via `cargo deny check licenses`. +The allowed license set is enforced by `cargo deny check licenses` (deny.toml). +Binary packages (CLI, Python wheels, Node native addon, WebAssembly) statically +link these crates; their license texts and copyright notices are in each +crate's source on crates.io, pinned by Cargo.lock. cssparser and selectors +(via scraper) are MPL-2.0; their unmodified source is available from crates.io. + +=== Bundled Third-Party Data === + +The `pdf-ocr` feature renders PDF pages with hayro, which compiles the +following data into the binary. It is enabled in the CLI, the Python package +and the native Node package (not in the default crate build or WebAssembly). + +--- Standard PDF fonts (hayro-interpret, assets/*.pfb) --- + +Extracted from PDFium. + +Copyright 2014 PDFium Authors. All rights reserved. +Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Google Inc. nor the names of its contributors may be + used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--- Adobe CMap resources (hayro-cmap, assets) --- + +Copyright 1990-2023 Adobe. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Adobe nor the names of its contributors may be + used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--- ICC color profiles (hayro-interpret, assets/*.icc) --- + +CGATS001Compat-v2-micro.icc from saucecontrol/Compact-ICC-Profiles, CC0-1.0. +LAB.icc generated with LCMS2 by the hayro authors. + +=== Not Bundled === + +OCR model weights (CC-BY-SA 4.0), Tesseract and its language data are not +included in any markkit package. `just ocr-models` downloads the pinned models +and writes their license and attribution to target/ocr-models/NOTICE.json. === Public Benchmark Tooling === diff --git a/README.md b/README.md index f92a7d6..2630593 100644 --- a/README.md +++ b/README.md @@ -426,4 +426,6 @@ Markkit is part of the [Everruns](https://everruns.com) ecosystem, alongside ## License -MIT License. See [LICENSE](LICENSE) for details. +MIT License. See [LICENSE](LICENSE) for details. Third-party attributions, +including data embedded by PDF rendering, are in [NOTICE](NOTICE). Report +vulnerabilities privately per [SECURITY.md](SECURITY.md). diff --git a/SECURITY.md b/SECURITY.md index b6f0864..6117810 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,46 +1,89 @@ # Security Policy +Markkit turns untrusted documents into Markdown, often inside AI agents and +services that accept files or URLs from users. We take reports seriously and +appreciate responsible disclosure. + ## Reporting a Vulnerability -**Please do not report security vulnerabilities through public GitHub issues.** +**Do not report security vulnerabilities through public GitHub issues, +discussions or pull requests.** + +Report privately through either channel: -Instead, please report them via email to **security@everruns.com**. +- [GitHub private vulnerability reporting](https://github.com/everruns/markkit/security/advisories/new) + (preferred) +- Email **security@everruns.com** Please include: -- Description of the vulnerability -- Steps to reproduce -- Potential impact -- Suggested fix (if any) +- Affected package(s) and version(s), and the feature flags or binding in use +- Description of the vulnerability and its impact +- Steps to reproduce, ideally a minimal input file (attach it; do not link + public hosting) or a failing test +- Suggested fix (optional) + +Inputs that make markkit panic, hang, exhaust memory past its configured +limits, execute embedded content, or reach a network address the fetch policy +should refuse are all in scope; see the invariants in the +[threat model](knowledge/security/threat-model.md). ## Response Timeline -- **Acknowledgment**: Within 48 hours -- **Initial assessment**: Within 1 week -- **Critical fixes**: Target 30 days +- **Acknowledgment**: within 48 hours +- **Initial assessment**: within 7 days +- **Fix target**: within 30 days for critical issues + +We coordinate disclosure with the reporter, publish a GitHub security advisory +(and a RustSec advisory for the crates) once a fixed release is available, and +credit reporters who wish to be named. ## Supported Versions +Markkit is pre-1.0. Security fixes land on `main` and ship in a new release of +the latest minor line, published in sync to crates.io, PyPI and npm. + | Version | Supported | |---------|-----------| -| 0.1.x | Yes | +| 0.3.x | Yes | +| < 0.3 | No | -## Security Architecture - -Markkit processes untrusted input (HTML, DOCX, spreadsheets) and converts it to markdown. Key security considerations: +## Scope -- **No code execution**: scripts, styles, forms, iframes and SVG are stripped; macros and formulas are never executed; XML entities are never expanded -- **Resource limits**: input size, HTML/XML nesting depth, archive entry count and decompressed size, spreadsheet grid cells, rows and columns -- **Explicit failure**: malformed input returns errors, never panics; unsupported formats fail explicitly -- **URL fetching**: opt-in `http_client` feature (off by default; CLI and Python/Node bindings enable it); http/https only, non-public addresses refused by default (after DNS and on every redirect), optional host allowlist, bounded redirects, body size and fetch time. Behind an environment HTTP proxy, the proxy resolves names, so restrict egress there too +- `markkit` crate (crates.io) +- `markkit-cli` crate and `markkit` command-line tool +- `markkit` Python package (PyPI) +- `@everruns/markkit` Node.js package and `@everruns/markkit-wasm` WebAssembly + package (npm) +- `MarkkitTool` LLM agent tool (`tool` feature) +- Official examples and documentation -Full analysis: [threat model](knowledge/security/threat-model.md). +Out of scope: vulnerabilities in host-installed tools markkit invokes or reads +(Tesseract, OCR model files, language data), host runtimes (CPython, Node, +browsers) and third-party dependencies, unless markkit's use of them creates +the issue. Report those upstream; tell us too if markkit should mitigate them. -## Scope - -The following components are in scope for security reports: +## Security Architecture -- `markkit` core library crate -- `markkit-cli` command-line tool -- Official Python and Node.js bindings -- Published documentation +Key properties, enforced by tests and fuzzing: + +- **No code execution**: scripts, styles, forms, iframes and SVG are stripped; + macros, formulas and PDF JavaScript are never executed; XML entities are + never expanded +- **Resource limits**: input size, HTML/XML nesting depth, archive entry count + and decompressed size, spreadsheet cells/rows/columns, PDF pages/objects/ + stream sizes, output size and processing deadlines (`Limits`) +- **Explicit failure**: malformed input returns errors, never panics; + unsupported formats fail explicitly +- **Output safety**: rendered Markdown neutralizes dangerous link schemes and + raw HTML +- **URL fetching**: opt-in `http_client` feature (off by default; CLI and + Python/Node bindings enable it); http/https only, non-public addresses + refused by default (after DNS and on every redirect), optional host + allowlist, bounded redirects, body size and fetch time. Behind an environment + HTTP proxy, the proxy resolves names, so restrict egress there too + +Full analysis: [security model](knowledge/security/security-model.md), +[threat model](knowledge/security/threat-model.md), +[native dependencies](knowledge/security/native-dependencies.md) and +[fuzzing](knowledge/security/fuzzing.md). diff --git a/crates/markkit-cli/LICENSE b/crates/markkit-cli/LICENSE new file mode 120000 index 0000000..30cff74 --- /dev/null +++ b/crates/markkit-cli/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/markkit-cli/NOTICE b/crates/markkit-cli/NOTICE new file mode 120000 index 0000000..fb376cf --- /dev/null +++ b/crates/markkit-cli/NOTICE @@ -0,0 +1 @@ +../../NOTICE \ No newline at end of file diff --git a/crates/markkit-js/LICENSE b/crates/markkit-js/LICENSE new file mode 100644 index 0000000..40cd13e --- /dev/null +++ b/crates/markkit-js/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024-2026 Everruns + +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/crates/markkit-js/NOTICE b/crates/markkit-js/NOTICE new file mode 100644 index 0000000..c978571 --- /dev/null +++ b/crates/markkit-js/NOTICE @@ -0,0 +1,128 @@ +Markkit +Copyright 2024-2026 Everruns + +Licensed under the MIT License. + +=== Design Inspirations === + +Markkit is an independent implementation. The following projects +inspired aspects of its design: + +* Readability (Apache 2.0) – Mozilla's approach to content extraction + informed our HTML-to-markdown pipeline design. + +* Pandoc (GPL-2.0) – The universal document converter's format + coverage and conversion philosophy inspired our multi-format + architecture. + +* turndown (MIT) – The JavaScript HTML-to-markdown converter's + rule-based approach influenced our conversion engine design. + +Markkit's parser, converter, and extraction pipeline are original +Rust implementations. This project is not affiliated with, endorsed +by, or derived from any of the above projects. + +=== Key Dependencies === + +Markkit relies on permissively licensed crates, including: + +* scraper (ISC), html5ever (MIT/Apache-2.0) – HTML parsing +* zip (MIT), quick-xml (MIT), calamine (MIT), cfb (MIT) – Office document containers and XML +* hayro-syntax / hayro (MIT/Apache-2.0) – PDF parsing and page rendering +* ocrs, rten (MIT/Apache-2.0) – optional Rust OCR backend +* reqwest (MIT/Apache-2.0), rustls (Apache-2.0/ISC/MIT) – optional HTTP client +* tokio (MIT) – async runtime +* serde / serde_json (MIT/Apache-2.0) – serialization +* pyo3 (MIT/Apache-2.0), napi (MIT), wasm-bindgen (MIT/Apache-2.0) – bindings + +The allowed license set is enforced by `cargo deny check licenses` (deny.toml). +Binary packages (CLI, Python wheels, Node native addon, WebAssembly) statically +link these crates; their license texts and copyright notices are in each +crate's source on crates.io, pinned by Cargo.lock. cssparser and selectors +(via scraper) are MPL-2.0; their unmodified source is available from crates.io. + +=== Bundled Third-Party Data === + +The `pdf-ocr` feature renders PDF pages with hayro, which compiles the +following data into the binary. It is enabled in the CLI, the Python package +and the native Node package (not in the default crate build or WebAssembly). + +--- Standard PDF fonts (hayro-interpret, assets/*.pfb) --- + +Extracted from PDFium. + +Copyright 2014 PDFium Authors. All rights reserved. +Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Google Inc. nor the names of its contributors may be + used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--- Adobe CMap resources (hayro-cmap, assets) --- + +Copyright 1990-2023 Adobe. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Adobe nor the names of its contributors may be + used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--- ICC color profiles (hayro-interpret, assets/*.icc) --- + +CGATS001Compat-v2-micro.icc from saucecontrol/Compact-ICC-Profiles, CC0-1.0. +LAB.icc generated with LCMS2 by the hayro authors. + +=== Not Bundled === + +OCR model weights (CC-BY-SA 4.0), Tesseract and its language data are not +included in any markkit package. `just ocr-models` downloads the pinned models +and writes their license and attribution to target/ocr-models/NOTICE.json. + +=== Public Benchmark Tooling === + +scripts/public_benchmarks/vendor includes the Mira Python SDK (Everruns, MIT), +the AgentDocBench scorer (SylphxAI, MIT), and the WCXB scorer (Murrough Foley, +CC-BY-4.0), each with its license. Input documents retain the individual +licenses and attribution in scripts/public_benchmarks/CORPUS-NOTICE and +agentdocbench-corpus.json. The downloaded corpora are not included in packages. diff --git a/crates/markkit-js/README.md b/crates/markkit-js/README.md index 02491d7..f13a6dc 100644 --- a/crates/markkit-js/README.md +++ b/crates/markkit-js/README.md @@ -86,3 +86,8 @@ and carry attribution in the setup script's NOTICE.json. The current Latin model accepts `pdfOcrLanguage: "eng"`. Missing build features/models and other languages fail explicitly. Model files and inference need trusted deployment configuration and host CPU/memory quotas; inference deadlines are cooperative. + +## License + +MIT. See [LICENSE](https://github.com/everruns/markkit/blob/main/LICENSE); third-party notices in +[NOTICE](https://github.com/everruns/markkit/blob/main/NOTICE). diff --git a/crates/markkit-js/package.json b/crates/markkit-js/package.json index fcea608..324576f 100644 --- a/crates/markkit-js/package.json +++ b/crates/markkit-js/package.json @@ -18,7 +18,9 @@ "files": [ "index.js", "index.d.ts", - "*.node" + "*.node", + "LICENSE", + "NOTICE" ], "devDependencies": { "@napi-rs/cli": "^3" diff --git a/crates/markkit-python/README.md b/crates/markkit-python/README.md index 436b39c..dcda087 100644 --- a/crates/markkit-python/README.md +++ b/crates/markkit-python/README.md @@ -145,4 +145,5 @@ platforms pip builds from the source distribution, which needs a Rust toolchain [CLI](https://crates.io/crates/markkit-cli) and an [npm package](https://www.npmjs.com/package/@everruns/markkit) -MIT licensed. +MIT licensed; see [LICENSE](https://github.com/everruns/markkit/blob/main/LICENSE). Third-party notices are in +[NOTICE](https://github.com/everruns/markkit/blob/main/NOTICE). diff --git a/crates/markkit-wasm/README.md b/crates/markkit-wasm/README.md index 6936b4f..5086c35 100644 --- a/crates/markkit-wasm/README.md +++ b/crates/markkit-wasm/README.md @@ -66,7 +66,8 @@ try { ## License -MIT +MIT. See [LICENSE](https://github.com/everruns/markkit/blob/main/LICENSE); third-party notices in +[NOTICE](https://github.com/everruns/markkit/blob/main/NOTICE). ## PDF layout and tables diff --git a/crates/markkit-wasm/package.json b/crates/markkit-wasm/package.json index 31a30df..ea93157 100644 --- a/crates/markkit-wasm/package.json +++ b/crates/markkit-wasm/package.json @@ -21,7 +21,9 @@ "markkit_wasm.d.ts", "markkit_wasm_bg.wasm", "markkit_wasm_bg.wasm.d.ts", - "README.md" + "README.md", + "LICENSE", + "NOTICE" ], "license": "MIT", "repository": { diff --git a/crates/markkit-wasm/scripts/build.sh b/crates/markkit-wasm/scripts/build.sh index 004f6e5..669b91c 100755 --- a/crates/markkit-wasm/scripts/build.sh +++ b/crates/markkit-wasm/scripts/build.sh @@ -37,5 +37,6 @@ fi cp "$CRATE_DIR/js/index.js" "$CRATE_DIR/js/index.d.ts" "$OUT_DIR/" cp "$CRATE_DIR/package.json" "$CRATE_DIR/README.md" "$OUT_DIR/" +cp "$CRATE_DIR/../../LICENSE" "$CRATE_DIR/../../NOTICE" "$OUT_DIR/" echo "==> built $OUT_DIR" ls -lh "$OUT_DIR" diff --git a/crates/markkit/LICENSE b/crates/markkit/LICENSE new file mode 120000 index 0000000..30cff74 --- /dev/null +++ b/crates/markkit/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/markkit/NOTICE b/crates/markkit/NOTICE new file mode 120000 index 0000000..fb376cf --- /dev/null +++ b/crates/markkit/NOTICE @@ -0,0 +1 @@ +../../NOTICE \ No newline at end of file diff --git a/knowledge/log.md b/knowledge/log.md index 1a3731d..d72d257 100644 --- a/knowledge/log.md +++ b/knowledge/log.md @@ -6,6 +6,8 @@ * **Release 0.3.1**: patch release carrying calamine 0.38 (RUSTSEC-2026-0436) and the dependency refresh. No API changes. See `CHANGELOG.md`. * **calamine 0.38**: RUSTSEC-2026-0436 (calamine CFB/OLE2 panic + OOM, fixed in 0.38) broke downstream `cargo audit`. Bumped calamine, cfb 0.16 and the lockfile; XLS pre-scan + own XLSB reader unchanged. Deferred majors: hayro 0.9 (published 2026-11-02, makes SIMD mandatory against the [Native Dependencies](security/native-dependencies.md) review) and mail-parser 1.0 (full rewrite, MSRV 1.98, new unsafe SIMD code); each needs its own review. See [Threat Model](security/threat-model.md). +* **Licensing and security policy**: every published artifact (crates.io, PyPI, both npm packages) now ships `LICENSE` and `NOTICE`; Python metadata is PEP 639 `License-Expression: MIT`. `NOTICE` reproduces the BSD-3 notices for PDFium/Foxit fonts and Adobe CMaps that hayro embeds under `pdf-ocr`. `SECURITY.md` covers 0.3.x, GitHub private reporting and all packages. `scripts/tests/test_licensing.py` enforces it. See [Native Dependencies](security/native-dependencies.md) and [Release Process](operations/release-process.md). + ## 2026-11-01 * **Release 0.3.0**: ships the embeddable CLI library (`markkit_cli::run`) for bashkit's `markkit` builtin. Minor bump: `markkit-cli` URL sources moved behind the default `native-http` feature. See `CHANGELOG.md`. diff --git a/knowledge/operations/release-process.md b/knowledge/operations/release-process.md index eee0da3..1d2ddd3 100644 --- a/knowledge/operations/release-process.md +++ b/knowledge/operations/release-process.md @@ -23,7 +23,9 @@ Releases are agent-driven; CI creates the tag, GitHub Release and crates.io uplo 1. Ask the agent: "Create release v0.X.Y". 2. Agent bumps `version` in root `Cargo.toml`, `crates/markkit-js/package.json` and `crates/markkit-wasm/package.json`, moves `CHANGELOG.md` Unreleased entries - under `## [0.X.Y] - YYYY-MM-DD`, runs `just pre-pr`, and opens a PR titled + under `## [0.X.Y] - YYYY-MM-DD`, on a minor bump updates the `SECURITY.md` + supported-versions table (`test_licensing.py` checks it), runs `just pre-pr`, + and opens a PR titled `chore(release): prepare v0.X.Y`. 3. Merging that PR to `main` (squash keeps the title as the commit subject) runs `release.yml`, which: diff --git a/knowledge/security/native-dependencies.md b/knowledge/security/native-dependencies.md index d28c232..eeb1cee 100644 --- a/knowledge/security/native-dependencies.md +++ b/knowledge/security/native-dependencies.md @@ -28,8 +28,11 @@ nationality, ancestry, residence or affiliations of every contributor, historica contributor or transitive dependency author. No such conclusions are inferred from names. This is a public ownership/location review, not a supply-chain audit. -Use the registry release and committed lockfile, with embedded fonts/CMaps and -optional architecture-specific SIMD disabled. The renderer and its codec/font/ +Use the registry release and committed lockfile, with optional +architecture-specific SIMD disabled. `embed-fonts` and `embed-cmaps` are +enabled: the binary carries PDFium/Foxit standard fonts and Adobe CMaps +(BSD-3-Clause; binary redistribution must reproduce the notices) and CC0 ICC +profiles. Root `NOTICE` reproduces them; see Licensing below. The renderer and its codec/font/ color dependencies are implemented in Rust. It replaces the Poppler executable; Tesseract remains necessary for text recognition. @@ -72,6 +75,24 @@ Reproduce with `cargo metadata --locked --all-features --format-version 1`, trees. Inspect build scripts and active dependency edges, not just names ending in `-sys`. `ldd` on the installed Tesseract describes that host's libraries only. +## Licensing and attribution + +Markkit is MIT. Root `LICENSE` and `NOTICE` are the single source; every +published artifact ships both: crates.io crates via symlinks in +`crates/markkit{,-cli}/` (cargo packages link targets), the native npm package +via byte-identical copies in `crates/markkit-js/` (npm skips symlinks), WASM via +`build.sh` copying into `pkg/`, and Python via PEP 639 `license`/`license-files` +in `pyproject.toml` (wheel `dist-info/licenses/`, `License-Expression: MIT`). +`scripts/tests/test_licensing.py` enforces all of this plus NOTICE coverage of +hayro's embedded assets; CI pack checks assert LICENSE/NOTICE in npm archives. + +`NOTICE` is required, not decorative: the CLI, Python and native Node packages +enable `pdf-ocr` and so embed BSD-3-Clause data. Dependency crates are +permissive (`deny.toml` allowlist); MPL-2.0 crates (cssparser, selectors) are +used unmodified, source on crates.io. OCR model weights (CC-BY-SA 4.0) and +Tesseract are never bundled. When adding a dependency that embeds data or +requires notice reproduction, update `NOTICE` and the test. + ## See also - [Format Support](../formats/format-support.md): OCR support and renderer limits. diff --git a/pyproject.toml b/pyproject.toml index 29b5e92..b995f7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,11 +4,12 @@ build-backend = "maturin" [project] name = "markkit" -dynamic = ["version", "description", "authors", "license"] +dynamic = ["version", "description", "authors"] +license = "MIT" +license-files = ["LICENSE", "NOTICE"] readme = "crates/markkit-python/README.md" keywords = ["markdown", "extraction", "html", "pdf", "docx", "llm"] classifiers = [ - "License :: OSI Approved :: MIT License", "Programming Language :: Rust", "Programming Language :: Python :: 3", "Operating System :: POSIX :: Linux", diff --git a/scripts/tests/test_licensing.py b/scripts/tests/test_licensing.py new file mode 100644 index 0000000..66fa6db --- /dev/null +++ b/scripts/tests/test_licensing.py @@ -0,0 +1,99 @@ +"""Markkit is MIT licensed, and every published artifact must say so and ship +the license text plus NOTICE. + +Decisions: +- One source of truth: root LICENSE and NOTICE. crates.io crates carry + symlinks (cargo packages the target's contents). npm skips symlinks, so the + Node package keeps byte-identical copies; the WASM build copies them into pkg/. +- Python takes `license`/`license-files` statically from pyproject.toml + (PEP 639) so wheels and sdists carry License-Expression and both files. +""" + +import json +import pathlib +import re +import tomllib +import unittest + +REPO = pathlib.Path(__file__).resolve().parents[2] +CRATES_IO = ["markkit", "markkit-cli"] +NPM = ["markkit-js", "markkit-wasm"] +LICENSE_FILES = ["LICENSE", "NOTICE"] + + +def load_toml(path): + with open(path, "rb") as f: + return tomllib.load(f) + + +class LicensingTest(unittest.TestCase): + def test_root_license_is_mit(self): + text = (REPO / "LICENSE").read_text() + self.assertTrue(text.startswith("MIT License\n")) + self.assertRegex(text, r"Copyright \(c\) [0-9-]+ Everruns") + self.assertIn("Licensed under the MIT License.", (REPO / "NOTICE").read_text()) + + def test_workspace_and_every_crate_declare_mit(self): + ws = load_toml(REPO / "Cargo.toml") + self.assertEqual(ws["workspace"]["package"]["license"], "MIT") + for member in ws["workspace"]["members"]: + pkg = load_toml(REPO / member / "Cargo.toml")["package"] + with self.subTest(crate=member): + self.assertEqual(pkg.get("license"), {"workspace": True}) + self.assertNotIn("license-file", pkg) + + def test_crates_io_crates_ship_license_and_notice(self): + for crate in CRATES_IO: + for name in LICENSE_FILES: + path = REPO / "crates" / crate / name + with self.subTest(crate=crate, file=name): + self.assertTrue(path.is_symlink(), f"{path} must link to root {name}") + self.assertEqual(path.resolve(), (REPO / name).resolve()) + + def test_npm_packages_declare_mit_and_ship_files(self): + for crate in NPM: + pkg = json.loads((REPO / "crates" / crate / "package.json").read_text()) + with self.subTest(package=pkg["name"]): + self.assertEqual(pkg["license"], "MIT") + for name in LICENSE_FILES: + self.assertIn(name, pkg["files"]) + + def test_node_package_copies_match_root(self): + for name in LICENSE_FILES: + copy = REPO / "crates" / "markkit-js" / name + with self.subTest(file=name): + self.assertFalse(copy.is_symlink(), "npm pack skips symlinks") + self.assertEqual(copy.read_bytes(), (REPO / name).read_bytes()) + + def test_wasm_build_copies_license_files(self): + script = (REPO / "crates" / "markkit-wasm" / "scripts" / "build.sh").read_text() + self.assertRegex(script, r'cp "\$CRATE_DIR/\.\./\.\./LICENSE" "\$CRATE_DIR/\.\./\.\./NOTICE"') + + def test_python_package_declares_mit_and_ships_files(self): + project = load_toml(REPO / "pyproject.toml")["project"] + self.assertEqual(project["license"], "MIT") + self.assertEqual(project["license-files"], LICENSE_FILES) + self.assertNotIn("license", project.get("dynamic", [])) + # PEP 639: license classifiers conflict with a license expression. + for classifier in project.get("classifiers", []): + self.assertFalse(classifier.startswith("License ::"), classifier) + + def test_notice_covers_hayro_embedded_assets(self): + hayro = load_toml(REPO / "Cargo.toml")["workspace"]["dependencies"]["hayro"] + notice = (REPO / "NOTICE").read_text() + features = hayro.get("features", []) + if "embed-fonts" in features: + self.assertIn("Copyright 2014 PDFium Authors", notice) + self.assertIn("Foxit Software Inc.", notice) + if "embed-cmaps" in features: + self.assertIn("Copyright 1990-2023 Adobe", notice) + + def test_security_policy_lists_current_minor(self): + version = load_toml(REPO / "Cargo.toml")["workspace"]["package"]["version"] + minor = ".".join(version.split(".")[:2]) + policy = (REPO / "SECURITY.md").read_text() + self.assertRegex(policy, rf"\|\s*{re.escape(minor)}\.x\s*\|\s*Yes") + + +if __name__ == "__main__": + unittest.main()