Skip to content

[Superseded — not merged] feat(signing): experimental persistent signing sessions (#9600) - #9666

Closed
vitormattos wants to merge 4 commits into
feat/9595-external-provider-catalog-20261121from
feat/9600-persistent-external-signing-sessions-20261122
Closed

vitormattos wants to merge 4 commits into
feat/9595-external-provider-catalog-20261121from
feat/9600-persistent-external-signing-sessions-20261122

Conversation

@vitormattos

@vitormattos vitormattos commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Closed without merge — replaced by the canonical CSC runtime workstream #9659. The implementation on this branch has NOT been incorporated into #9659 or main. Its signed commits, migration, tests and original discussion remain accessible here as historical reference. This draft is not a completed implementation of issue #9600; #9600 remains open. Do not cherry-pick the full prototype blindly.

Why this draft is being retired: the repository documentation file is inconsistent with AGENTS.md (developer documentation belongs to LibreSign/documentation); the migration omits column descriptions; there is no durable uniqueness/idempotency guarantee preventing two concurrent HTTP requests from creating distinct sessions for the same signing attempt; the first current CI run failed PHP-CS; and the session API has not been integrated with authentic provider responses, authorization and exactly-once workflow publication. Real-engine coverage is not established.

Next implementation location: #9659 should implement/reuse only verified session concepts and tests from this preserved branch, after security review, with work for #9599/#9600/#9603 integrated and signed incrementally. No extra PR for this same backend slice.


Summary

Implements the backend-only authoritative, resumable external signing session persistence for #9600 on top of the exact current PR #9611 HEAD. This is a stacked PR targeting feat/9595-external-provider-catalog-20261121, not main.

Base HEAD: 9452c4a2387051c37eba1850cf8e09c97f89d8f5
Head (4 individually OpenPGP-signed, DCO commits): d5165270e6293605cc5e1f11a1f8c7d5e6a223c9
Integration points: #8356 (architecture), #9603 (future workflow orchestration).

Changes

  • Versioned Nextcloud migration: authoritative session metadata, a separately encrypted private continuation table (SAD/tokens/handles), and secrets-free audit events.
  • Explicit lifecycle transitions including interaction/authorization/signing pending, signature received, completion reservation, rejection, expiration, failure and uncertain.
  • Server-side encrypted, versioned JSON reconstruction of actual SignerPHP DTO types: exact payload representation, hash/signature algorithms, encoding and opaque preparation state. No PHP unserialize() of client-controlled state.
  • Opaque random session identifiers, actor/SignRequest/integration-and-revision/credential/X.509 certificate/document-revision-and-hash/expiry binding, with revalidation on resumption.
  • DB compare-and-swap by previous state, revision and actor; one persisted READY_TO_SIGN -> SIGNING_PENDING claim before provider submission. A timeout/crashed PHP worker cannot silently release it for automatic cryptographic retry.
  • Provider result and continuation data protected separately; retained audit contains no document bytes, signature bytes or SAD. Terminal states remove protected signing material. Publication reservation has a distinct SIGNATURE_RECEIVED -> COMPLETING -> COMPLETED path; repeat completion is idempotent.
  • A consumer contract describes exactly what Complete the CSC external signing lifecycle in LibreSign workflows #9603 must authorize and publish.

Verification performed

  • php -l for five new PHP files: pass (PHP 8.4 CLI in isolated Docker container).
  • Focused PHPUnit state machine: 18 tests / 18 assertions, pass (PHP 8.4).
  • Focused integration PHPUnit: 15 tests / 101 assertions, pass in a disposable, separately copied Nextcloud 36 + SQLite development instance (PHP 8.5.12). Includes a second PHP process resuming the persisted prepared record and two simultaneous PHP processes racing for the same signing claim; only one won.
  • No production credentials, live provider requests or shared Nextcloud database were used.
  • Integration PHPUnit 13 emits 15 notices from test mocks with no explicit expectations; zero failed assertions or test warnings in the last run.
  • git diff --check: pass. Compare against PR feat(signing): consolidate CSC driver catalog, encrypted configuration and admin OCS API #9611: 4 commits ahead, 0 behind, exactly 6 new files.
  • Each commit was signed through Git Signing MCP, GitHub verified, and DCO signed off.

Security and integration limits — do not claim production readiness yet

Review focus

Please review the protocol boundary and whether lifecycle persistence safely handles provider ambiguity, encrypted-state size limits, database portability, and terminal-secret erasure before enabling the experimental workflow. This PR is intentionally a draft until the cross-service integration and remaining negative-path coverage are accepted. AI-assisted implementation was used.

…states (#9600)

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…9600)

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…submission (#9600)

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos changed the title feat(signing): persist resumable external signing sessions (#9600) [Superseded — not merged] feat(signing): experimental persistent signing sessions (#9600) Nov 23, 2026
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.

1 participant