Skip to content

[Superseded] feat(signing): expose administrative OCS CRUD for external integrations (#9596) - #9660

Closed
vitormattos wants to merge 6 commits into
feat/9596-external-signing-storagefrom
feat/9596-admin-ocs-20261122
Closed

vitormattos wants to merge 6 commits into
feat/9596-external-signing-storagefrom
feat/9596-admin-ocs-20261122

Conversation

@vitormattos

@vitormattos vitormattos commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Superseded by #9611 (consolidated, self-contained PR). The implementation from this draft is now included in #9611, whose branch contains the CSC catalog, persistence and administrative API before CI runs. This draft is closed to prevent redundant reviews and unavoidable CI failures caused by missing dependencies. Original signed commits and this branch are retained. No merge or squash was performed.


Resolves: #9596 (administrative OCS slice; dependent on #9610 and #9611)

📝 Summary

Adds system-administrator-only OCS v1 endpoints for listing, creating, inspecting, updating, enabling, disabling and deleting configured external signing integrations.

Base: feat/9596-external-signing-storage at bdf1d06da54d889c8f704d5b0cd362a19f73431b (PR #9610). This stacked PR only adds the HTTP administration boundary, response definitions, generated API types, and tests. It does not alter either base PR branch or duplicate the catalog. It imports ExternalSigningDriverCatalog provided by #9611; merge/test with that dependency before considering readiness.

⚙️ API / Back-end changes

  • Seven OCS v1 routes under /admin/signing/integrations: paginated GET list, POST create, GET detail, PATCH update, POST enable/disable, DELETE.
  • Only system administrators (not group admins) may call these routes; anonymous 401, other users 403; global experimental_features disabled 404.
  • Integration instances are initially disabled. Enabling an unavailable driver conflicts; global feature flag never implicitly changes per-integration enabled status.
  • Write-only secrets; reads return secretFields: [{ key, isConfigured }] for detail/mutations; list returns redacted summaries. Omitted secrets preserve ciphertext; explicit null can clear optional secrets.
  • Optimistic revision preconditions on every write after creation; stale revision yields 409. Backend errors return stable, sanitized messages.
  • API contracts generated via project composer openapi:spec + npm run typescript:generate, using the current [Superseded] feat(signing): lay groundwork for configured external integrations (#9596) #9610 base (without copying feat(signing): consolidate CSC driver catalog, encrypted configuration and admin OCS API #9611-generated artifacts).

🧪 How to test

  1. Combine the heads of [Superseded] feat(signing): lay groundwork for configured external integrations (#9596) #9610 and feat(signing): consolidate CSC driver catalog, encrypted configuration and admin OCS API #9611 in an isolated worktree; no copying of their classes.
  2. Use an isolated Nextcloud 36 test fixture with migrated external integration table and run:
    • php vendor-bin/phpunit/vendor/bin/phpunit -c tests/php/phpunit.xml tests/php/Unit/Controller/ExternalSigningIntegrationsControllerTest.php --no-coverage
    • php vendor-bin/phpunit/vendor/bin/phpunit -c tests/php/phpunit.xml tests/php/Integration/Controller/ExternalSigningIntegrationsControllerTest.php --no-coverage
    • Existing ExternalIntegrationAdministrationTest, ExternalIntegrationStoreTest and php vendor-bin/phpunit/vendor/bin/phpunit -c tests/php/openapi/phpunit.xml.
  3. Generate OpenAPI/TS with repository tooling and compare artifacts. Test unauthorized users and feature gate, multi-instance CRUD, conflicts, secret redaction and invalid endpoint rejection.

Validation evidence

  • Focused controller unit tests: 24 tests, 86 assertions, passed (PHP 8.5 / Nextcloud 36 fixture).
  • Controller integration: 2 tests, 33 assertions, passed in the complete stack with SignerPHP v0.5.0 on an isolated SQLite fixture (includes a successful enable/disable cycle).
  • Existing administration persistence: 21 tests, 55 assertions, passed on isolated SQLite fixture.
  • Existing store persistence: 48 tests, 127 assertions, passed on isolated SQLite fixture.
  • OpenAPI contract suite on combined worktree: 45 tests, 903 assertions, passed.
  • PHP CS Fixer on new PHP files; syntax checks; official OpenAPI and TypeScript generation; git diff --check.
  • Cross-engine MariaDB/PostgreSQL validation; official migration path (the fixture's CLI did not expose migrations:migrate and the isolated SQLite schema was prepared separately).
  • Confirm catalog/SignerPHP v0.5.0 adapter availability; fixture used SignerPHP 0.4.0, so enabling a live CSC driver and operational signing were not tested. No dependency downgrade was made.
  • Earlier CI run at 08522653d: Psalm failed with 21 errors and PHPUnit failed across SQLite/MySQL/MariaDB/PostgreSQL because ExternalSigningDriverCatalog was absent on the PR base. The remaining DB bootstrap errors were cascading failures; do not rerun them as flakes. Latest 64eec754 CI was queued/pending at the last inspection.

Scope/limits

No CSC signing implementation, no provider-specific endpoints, no UI, no modified base PRs, no merge. The PR intentionally depends on pending #9611: its catalog is not vendored here. Review the combined SHA and DB matrix before merge.

✅ Checklist

  • Scope limited to API/controller/tests/contracts.
  • Six incremental cryptographically verified commits with matching DCO.
  • AI-assisted code generation disclosed.
  • Ready for merge — no, pending dependencies and broader validation.

Stack integration diagnosis — 22 Nov 2026

Cause of persistent red standalone CI: GitHub evaluates this PR against the #9610 branch, which does not contain the catalog from #9611. Therefore static analysis cannot resolve ExternalSigningDriverCatalog, and the full PHPUnit matrix fails while loading the tests. This is a real dependency sequencing issue; the PR must remain draft. Do not solve it by copying catalog classes into this PR, suppressing Psalm errors, weakening tests, or rerunning CI.

Code issues fixed in this PR: response helper now carries generic, checked DataResponse status/data types, authorize and setEnabled have precise typing, the duplicate @param was removed, and OpenAPI/TypeScript artifacts regenerated. In a combined checkout with #9611 present, focused Psalm reports 0 errors on the new controller; the same files pass PHP CS Fixer and focused unit/integration tests.

Actual combined validation (no base PR modifications):

  • Temporarily merged feat(signing): consolidate CSC driver catalog, encrypted configuration and admin OCS API #9611 into the exact [Superseded] feat(signing): expose administrative OCS CRUD for external integrations (#9596) #9660 HEAD 087f5e33 with git merge --no-commit --no-ff; resolved five conflicts locally: lib/ResponseDefinitions.php and four generated API artifacts. Both read models were preserved, and the generated contracts were regenerated with the repository tools. No merge commit or branch-base change was pushed.
  • Locked signerphp/pdf-signer v0.5.0 was verified in the isolated combined vendor tree; no downgrade.
  • Nextcloud 36, PHP 8.5, isolated SQLite: 34 focused controller/catalog tests, 163 assertions, passed (including creating and enabling an available CSC integration, disabling and deleting it, secret replacement/redaction and stale revision rejection).
  • Combined OpenAPI suite: 45 tests, 903 assertions, passed. OpenAPI extractor found 21 administration routes, including driver catalog and integration CRUD.
  • PostgreSQL and MariaDB combined DB matrices, full-project Psalm, and remote CI on the exact combined commit remain NOT RUN; the combined checkout has no pushed commit.

Required integration order: merge/reconcile #9611 first, then bring #9610 onto a base containing that catalog (with the necessary authorization/QA), then validate #9660 on the resulting combined SHA. Until the approved branch integration occurs, standalone CI on #9660 cannot pass. No PR has been merged as part of this work.

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

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

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

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos changed the title feat(signing): expose administrative OCS CRUD for external integrations (#9596) [Superseded] feat(signing): expose administrative OCS CRUD for external integrations (#9596) Nov 22, 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