Skip to content

[stable33] feat: integrate pdf-signature-validator for native validation#7872

Merged
vitormattos merged 35 commits into
stable33from
backport/7596/stable33
Jul 7, 2026
Merged

[stable33] feat: integrate pdf-signature-validator for native validation#7872
vitormattos merged 35 commits into
stable33from
backport/7596/stable33

Conversation

@backportbot-libresign

@backportbot-libresign backportbot-libresign Bot commented Jul 7, 2026

Copy link
Copy Markdown

Backport of #7596

Warning, This backport's changes differ from the original and might be incomplete ⚠️

Todo

  • Review and resolve any conflicts
  • Remove all the empty commits

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

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>
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>
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>
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>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
The service's validateFromResource() already returns properly formatted
arrays with id, label, isValid, and reason. The localize* methods were
unnecessarily converting numbers back to enums and then back to numbers.

Now Pkcs12Handler uses the validation results directly without the
circular conversion, eliminating code duplication and improving clarity.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- FileController::fetchPreview: add inline type assertions for RedirectResponse
  to specify exact status code (303) when returning null-checked values
- PdfSignatureValidationService: update docblocks for validateFromResource,
  validateFromString, and mapValidationResults to include the 'raw' field
- Pkcs12Handler::extractNativeSignatureMetadata: change return type from
  list<array> to array<int, array{...}> to match actual implementation

All Psalm errors resolved, unit tests still passing.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Update constructor arguments to match the new signature which includes
PdfSignatureValidationService and PdfSignatureExtractor, and removes
the no-longer-used TempManager. Also use real instance of
PdfSignatureExtractor instead of mock since the class is final and
cannot be mocked.

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>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
phpseclib is already vendored and scoped in the 3rdparty submodule under
OCA\Libresign\Vendor\phpseclib3. Declaring it as a direct composer
dependency caused roave/security-advisories to block the insecure 3.0.52
version locked in composer.lock.

Remove phpseclib/phpseclib, paragonie/constant_time_encoding and
paragonie/random_compat from composer.json require and composer.lock.
Use "provide" to satisfy the transitive dependency declared by
libresign/pdf-signature-validator without installing the package.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
The libresign/pdf-signature-validator package is moved from libresign's
own composer dependencies into the 3rdparty scoped vendor directory so
that php-scoper can prefix both its classes and its phpseclib3 references
with OCA\Libresign\Vendor\.

- Remove libresign/pdf-signature-validator from composer.json + lock
- Remove phpseclib/phpseclib 'provide' declaration (no longer needed)
- Update all use statements: LibreSign\PdfSignatureValidator\... =>
  OCA\Libresign\Vendor\LibreSign\PdfSignatureValidator\...
- Update 3rdparty submodule ref to include the scoped package

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>
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>
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>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
This reverts commit 369487d.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos force-pushed the backport/7596/stable33 branch from 37f3b5a to d6c68ac Compare July 7, 2026 15:39
@vitormattos vitormattos marked this pull request as ready for review July 7, 2026 16:44
@vitormattos vitormattos merged commit ea6f30a into stable33 Jul 7, 2026
68 checks passed
@vitormattos vitormattos deleted the backport/7596/stable33 branch July 7, 2026 16:44
@github-project-automation github-project-automation Bot moved this from 0. Needs triage to 4. to release in Roadmap Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 4. to release

Development

Successfully merging this pull request may close these issues.

1 participant