FFFF feat(documents): harden the anytopdf conversion node and add Check it by adeelahmad · Pull Request #224 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(documents): harden the anytopdf conversion node and add Check it - #224

Merged
adeelahmad merged 2 commits into
mainfrom
claude/project-thread-q1hzy0
Oct 7, 2026
Merged

adeelahmad merged 2 commits into
mainfrom
claude/project-thread-q1hzy0

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: Lens followed a conversion node's redirects with its bearer token attached, read the node's answers and PDF with no size limit, and took whatever bytes came back as the PDF. There was no way to test the node from Settings.

After: a node that redirects is refused, so the token stays at the address set. The address must be http(s) with no user name or password. Job answers are read to 1 MB, the PDF to 2 GB, the job id must look like an id, and a PDF that doesn't start with %PDF- is refused (partial files are cleaned up). Settings › Documents shows a Check it button under the conversion node that asks the node for a job with Lens's token and reports whether it answered and took it (POST /api/v1/settings/documents/node/test).

The threat model gains P-CONVERSION-NODE in threat-model.md, .yaml and .json (prose hash updated; ci/validate_threat_model.py passes), and B3 now names anytopdf.

Motivation and Context

Hardening for the conversion node added in #210 / #220.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (ruff, ruff format, mypy, tsc, eslint, prettier clean).
  • I added or updated tests (a misbehaving node: redirect, oversized answer, odd job id, non-PDF; Check it ok / wrong token / unreachable).
  • My change requires documentation updates, and I have updated docs/ accordingly (docs/configuration.md#anytopdf).
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md.

OpenAPI and the frontend client regenerated with make openapi's commands.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UjMfekKJM7pXVCzm7EVPDy


Generated by Claude Code

Lens no longer follows a redirect from a conversion node (so its bearer
token stays at the address set), refuses an address that isn't plain
http(s), caps the node's job answers at 1 MB and its PDF at 2 GB, checks
the job id and that the PDF starts like one. Settings > Documents gets a
Check it button that asks the node for a job with Lens's token. The
threat model gains P-CONVERSION-NODE in the prose, YAML and JSON.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UjMfekKJM7pXVCzm7EVPDy
@adeelahmad adeelahmad self-assigned this Oct 7, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UjMfekKJM7pXVCzm7EVPDy
@adeelahmad
adeelahmad merged commit de7e030 into main Oct 7, 2026
8 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-q1hzy0 branch October 7, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0