Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ jobs:
- name: Family layers, redaction, sanitize, signatures, forms, pages, writes and turns
working-directory: backend
run: python -m pytest tests -q -p no:cacheprovider
- name: Third-party notices cover what ships
run: python setup/notices.py --check

window:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -119,6 +121,7 @@ jobs:
run: |
for f in formpdf formpdf_oc_install backend/oc_install backend/boot_backend frontend/oc_install frontend/boot_frontend setup/*; do
case "$f" in *.bat|*.py) continue ;; esac
[ -f "$f" ] || continue
bash -n "$f"
done
- name: No em dash in tracked markdown, no emoji in tracked text
Expand Down
2 changes: 2 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

formpdf is licensed under the Apache License 2.0 (see `LICENSE`). It includes or depends on the following works.

This file is the human ledger: what each component is and why it is there. `THIRD-PARTY-NOTICES.txt` holds the full licence texts (copyright lines, conditions and disclaimers) of everything the app ships: the Python runtime and the PyInstaller bootloader, the Python packages frozen into the engine (text recognition included), the engine's fonts and dictionary, the JavaScript packages built into the window and the Rust crates in the desktop shell. `python3 setup/notices.py` writes it and `python3 setup/notices.py --check` (run in CI) fails when it no longer covers what ships. It ships beside this file in every installer and inside the frozen engine, and Preferences > About shows it.

## Included in this repository

| Work | License | Where |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Code owners are set in [`.github/CODEOWNERS`](.github/CODEOWNERS).

## License

FormPDF is licensed under the Apache License 2.0 ([`LICENSE`](LICENSE), SPDX `Apache-2.0`). Copyright 2026 NodeAgentc, Inc. Third-party notices: [`NOTICE.md`](NOTICE.md).
FormPDF is licensed under the Apache License 2.0 ([`LICENSE`](LICENSE), SPDX `Apache-2.0`). Copyright 2026 NodeAgentc, Inc. Third-party notices: [`NOTICE.md`](NOTICE.md) (what ships and why) and [`THIRD-PARTY-NOTICES.txt`](THIRD-PARTY-NOTICES.txt) (the full licence texts, generated by `setup/notices.py`).

<sub>Screenshot content: CC0 photos from Poly Haven. Hero: a sample travel guide made for the Form family.</sub>

Expand Down
43,775 changes: 43,775 additions & 0 deletions THIRD-PARTY-NOTICES.txt

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions backend/HASHOUT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -931,3 +931,39 @@ The update path. Like entry 134's three places, the two keys enter the HMAC body
`sealNote` is not sealed: written by hand it only shows the note. `POST /api/settings` takes `sealNote` only to clear it, whatever value is sent.

Ran: `tests/test_seal.py` 21 passed (7 of the new tests fail on the code before the change; the Blocked one passes on both and guards the reset); the whole suite 246 passed. With a stand-in keyring kept in a scratch file, a settings file of the earlier shape (agents allowed, a folder and a first message) and the built window: the window showed the note once, the engine then read `seal: ok`, access `ask`, the folder and first message kept and `sealNote` empty, and a reload showed no note.

## 138. The family's finder is 1.1.0, copied whole from FormVis · after _v0.66.0, unreleased, logged 2026-11-29 (services/agent_lookup.py; routers/agentdock.py _agent; setup/agents.py LOOKUP_HASHES; tests/test_agent_start.py; tests/test_agent_lookup_windows.py new; docs/AGENT_LOOKUP.md new)

kind: fix · logged: unreleased · 2026-11-29

The family's copies of `agent_lookup.py` had drifted into several different 1.0.2 files; formpdf's carried its own Windows hardening (`Refused`, `cmd_words`, a single npm shim pattern). 1.1.0 is the one canonical file, taken byte for byte from FormVis (SHA-256 `313fcd40541199c920314516026a0b225aeb4915e9a5dc26bf51d1ba05f1da8e`) and recorded in `LOOKUP_HASHES` beside the earlier versions.

- A `.cmd` or `.bat` is recognised as Windows opens it (any letter case, trailing dots or spaces, a `::$DATA` stream name). npm, pnpm and bun shims start their runner and script, or the `.exe` they name, with the words as an argv list.
- Anything else that still needs `cmd.exe /c` goes through `cmd_safe`: any word, the program path included, with `& | < > ^ ( ) ! % "` or a control character is refused, and a program path with a space may not hold `@` or be followed by a word with a space or an empty word.
- The refusal is now `CommandLineRefused` (still an `OSError`). `_agent` in routers/agentdock.py catches it in place of `Refused` and answers 400 with its message; nothing else in formpdf named the old class or `cmd_words`. `claude_code.wrap` already called `start_argv` alone, so no wrapper was left to remove.
- Two tests in tests/test_agent_start.py were dropped because they held 1.0.2's own shim rules: a shim naming a script with `..` (1.1.0 follows any script the shim's line names that exists) and an npm `_prog` line naming an `.exe` (1.1.0 follows only the `"%dp0%\x.exe" %*` form). tests/test_agent_lookup_windows.py is FormVis's test for 1.1.0, unchanged, and a new test holds the dock's 400.

Ran: `shasum -a 256` on the copy; tests/test_agent_start.py, tests/test_agent_lookup_windows.py and tests/test_agent_manifest.py on macOS. Not run: Windows itself.

## 139. The full licence texts of what ships, generated and checked · after _v0.66.0, unreleased, logged 2026-11-29 (setup/notices.py new; setup/notices_crates.py new; THIRD-PARTY-NOTICES.txt new; core/config.py NOTICES_NAME, notices_path; routers/system.py NOTICES_CAP, notices; setup/freeze_backend, freeze_backend.bat --add-data; src-tauri/tauri.conf.json bundle.resources; .github/workflows/ci.yml test job; tests/test_notices.py new)

kind: feat · logged: unreleased · 2026-11-29

NOTICE.md names each component and why it is there, but the app did not carry the full licence texts most of those licences ask for. THIRD-PARTY-NOTICES.txt at the repository root now holds them, written by `python3 setup/notices.py` on FormDAM's model:

- Python: the names in requirements.txt, requirements_macos.txt and requirements_ocr.txt (the release engine bundles text recognition) and everything they require, with the extras a requirement names followed (`uvicorn[standard]` brings uvloop, httptools, watchfiles, websockets and python-dotenv) and other extras left out. Markers are evaluated with packaging for macOS, Linux and Windows at Python 3.12 and the union is taken. Each package gets every licence, copying, notice, authors, copyright or third-party file its distribution lists, files under a licenses folder included. A package not installed where the file is written keeps its section from the previous file and is named on stderr, so writing on one system does not drop another's packages.
- Runtime: the interpreter's LICENSE.txt, and PyInstaller's COPYING.txt for the bootloader that is the frozen engine's stub (version from requirements_desktop.txt).
- Data: the OFL texts of the engine's Inter, Noto Serif, JetBrains Mono and Liberation fonts and the en_US dictionary's README with its notices, read from backend/app.
- JavaScript: the packages package-lock.json marks neither dev nor optional (the optional ones are pdf.js's Node-only canvas builds, never in the window), with their licence files from node_modules (npm ci first); for pdfjs-dist also the CMap, Foxit font and wasm decoder licences, with a note that its Liberation files are not shipped.
- Rust: every crate Cargo.lock reaches from the formpdf crate, with licence, repository and licence files from `cargo metadata --locked` or, when cargo cannot answer, from the crate's Cargo.toml in the registry cache. A crate that publishes no licence file is listed with its SPDX licence and repository and a note.
- formpdf downloads no binaries, so there is no binary section.

Identical texts are printed once at the end and referred to by number. Written twice in the same environment the file is byte-identical.

`python3 setup/notices.py --check` runs in the CI test job and fails when a pinned requirement's version differs from the listed one, a shipped Python package installed there has no section, the npm or crate list differs from the lock files in either direction, a font or dictionary notice differs from its file, the PyInstaller version differs from its pin, or the runtime is missing. It needs no cargo, node_modules or network. Unpinned packages are checked by name only; regenerate before a release.

The file ships beside LICENSE and NOTICE.md in every installer (bundle.resources) and is frozen into the engine (--add-data), which serves it as text from GET /api/notices (404 when a build lacks it, capped at 16 MiB) for Preferences > About.

Ran: the generator twice (byte-identical), `--check` with the engine venv and with the system Python, tests/test_notices.py. Written on macOS with the OCR packages, PyInstaller and the Windows and Linux only packages (pywinpty, pywin32-ctypes, colorama, tzdata, jeepney, SecretStorage) installed into a scratch folder for the run and removed after.

Forty-one shipped packages publish no licence file (flatbuffers on PyPI and forty crates). Their texts are kept in `setup/licence_texts/<kind>/<name>-<version>/`: the upstream files at the commit or tag the published package names, or, for selectors and sigchld whose repositories hold no licence file, the SPDX standard text with the holders their metadata names. Each folder has a SOURCE.txt with every file's URL and ref. `setup/notices_vendored.py` reads them; the generator uses a folder only when the package itself carries no file, prints the texts plus SOURCE.txt, and writes a note naming the repository and ref, or the reconstruction. `--check` names a kept text the notices do not carry, a notice that differs from its kept text, and a kept folder for a package that no longer ships, so a version bump of one of these packages shows up as work to do.
7 changes: 7 additions & 0 deletions backend/app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ def resource_dir() -> Path:
return Path(getattr(sys, "_MEIPASS", BACKEND_DIR))


NOTICES_NAME = "THIRD-PARTY-NOTICES.txt"


def notices_path() -> Path:
return resource_dir() / NOTICES_NAME if getattr(sys, "frozen", False) else REPO_DIR / NOTICES_NAME


def fonts_dir() -> Path:
bundled = resource_dir() / "fonts"
return bundled if bundled.is_dir() else BACKEND_DIR / "app" / "fonts"
Expand Down
2 changes: 1 addition & 1 deletion backend/app/routers/agentdock.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _agent(fn, *args, **kw):
return fn(*args, **kw)
except AgentError as e:
raise HTTPException(e.status, str(e)) from None
except agent_lookup.Refused as e:
except agent_lookup.CommandLineRefused as e:
raise HTTPException(400, str(e)) from None


Expand Down
15 changes: 15 additions & 0 deletions backend/app/routers/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from app.services.pdf import fontkit, ocr, spell

router = APIRouter()
NOTICES_CAP = 16 * 1024 * 1024
NETWORK = [
{"id": "engine", "name": "The engine and this window", "state": "local", "note": "They talk only on this computer, at 127.0.0.1. PDFs never leave it."},
{"id": "updates", "name": "Update check (desktop app)", "state": "off", "note": "This build has no update key, so it never checks. When one is set, formpdf asks before checking."},
Expand Down Expand Up @@ -48,6 +49,20 @@ def font_file(name: str):
return FileResponse(allowed[name], media_type="font/ttf", headers={"Cache-Control": "public, max-age=31536000, immutable"})


@router.get("/notices")
def notices():
from fastapi.responses import PlainTextResponse

try:
with open(config.notices_path(), encoding="utf-8") as handle:
text = handle.read(NOTICES_CAP + 1)
except OSError:
raise HTTPException(404, "The third-party notices are not in this build") from None
if len(text) > NOTICES_CAP:
raise HTTPException(500, "The third-party notices file is larger than expected")
return PlainTextResponse(text)


@router.get("/capabilities")
def capabilities() -> dict:
return {
Expand Down
Loading
Loading