Repository navigation
feat: simplify self-signing and add one-call PDF signing API - #9280
vitormattos wants to merge 33 commits into
Conversation
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>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…irmation Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…provider 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>
Avoid a double slash before remote.php when WebDAV fixture upload precedes the first OCS request in a scenario. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Require direct WebDAV responses in the Behat helper, keeping failing HTTP redirects visible rather than following malformed Location targets during fixture upload. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
YvesCesar
left a comment
There was a problem hiding this comment.
I made a few revisions. Could you take a look?
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>
YvesCesar
left a comment
There was a problem hiding this comment.
I made a few more revisions.
…tion Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
| }) | ||
|
|
||
| for (const [, file] of Object.entries(allFiles)) { | ||
| if (String(file.nodeId) !== String(nodeId)) { |
There was a problem hiding this comment.
This check breaks the sidebar for signed copies. The record of a signed PDF keeps the nodeId of the original file, so file/list returns the right record for nodeIds[]=<signed copy>, but this condition discards it.
I reproduced it in the browser: after signing, opening *.signed_N.pdf in the LibreSign tab shows an empty sidebar with Add signer, instead of the signer and Validation info. Saving a signer there returns 422, "A completed signer cannot be removed."
Could you remove this check? !files.value[fileId] below is enough for the case I raised. Without these three lines, the signed copy shows correctly again, and the six Sign myself cases and the file switch case keep passing.
The test does not select a different file returned by a filtered refresh would need to go too, or could be replaced by one that opens a signed copy whose record has a different nodeId.
| * @return array<string, mixed> | ||
| */ | ||
| private function resolveDirectSigningSource(IUser $user, array $source): array { | ||
| if (isset($source['base64'])) { |
There was a problem hiding this comment.
isset($source['base64']) is true for an empty string, but validateInput() ignores empty values, so {"base64": "", "nodeId": 123} passes validation and skips every check below. I reproduced it on this branch:
- Shared PDF, including read-only: the 403 is bypassed. The document is signed, and the call returns 409.
- The user's own file, failed preflight:
isset($file['base64'])on line 98 is true, so the cleanup deletes the original file and the folder if it becomes empty. base64: 123or an array: returns 500.
Could you only treat base64 as selected when it isn't empty, and reject non-string values?
if (($source['base64'] ?? '') !== '') {
return ['base64' => $source['base64']];
}
unset($source['base64']);if (isset($file['base64']) && !is_string($file['base64'])) {
throw new LibresignException('Provide exactly one PDF as file.base64, file.nodeId, or file.path.', Http::STATUS_BAD_REQUEST);
}With this change, the shared cases return 403, the user's file is kept, and non-string values return 400. Please add tests for an empty base64 combined with nodeId and with path.
|
I made a few more revisions. I forgot to mention it in the general last review comment. |
Summary
Simplifies self-signing (#4005) while keeping the standard signing lifecycle and policies.
User journeys
UI comparisons
Visual comparisons: real Playwright screenshots (main vs PR)
main)Immediate signing confirmation (appears after selecting a PDF via Sign PDF now, unless dismissed):
Prepare signing from Sign PDF now: real Playwright screenshot of the standard sidebar after selecting Prepare signing, showing the account signer, signature-position editor, and Sign document action.
Regular ready-to-sign sidebars (Sign myself; separate from direct signing):
API regression coverage (Behat + PHPUnit)
Content-Type: application/pdf, attachment filename,Cache-Control: no-store, document UUID header and the embedded PDF/ByteRange.Validation