From 2981b234d9cb3fe666858f95c3771534ba9a929e Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Sat, 14 Nov 2026 23:32:23 +0000 Subject: [PATCH 01/11] refactor: remove proprietary signing callbacks from development API Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- lib/AppInfo/Application.php | 2 -- lib/Controller/RequestSignatureController.php | 12 ++++--- lib/Db/File.php | 4 --- lib/Db/IdDocsMapper.php | 3 -- lib/Listener/SignedCallbackListener.php | 35 ------------------- lib/ResponseDefinitions.php | 1 - lib/Service/RequestSignatureService.php | 6 +--- .../RequestSignatureWorkflowService.php | 2 -- lib/Service/SignFileService.php | 30 ---------------- .../RequestSignatureControllerTest.php | 30 ++++++++++++++++ .../RequestSignatureControllerTest.php | 26 +++++++++++++- .../RequestSignatureWorkflowServiceTest.php | 7 ---- .../php/Unit/Service/SignFileServiceTest.php | 15 -------- 13 files changed, 64 insertions(+), 109 deletions(-) delete mode 100644 lib/Listener/SignedCallbackListener.php diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 7f756eba53..a39c0636fb 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -22,7 +22,6 @@ use OCA\Libresign\Listener\MailNotifyListener; use OCA\Libresign\Listener\NotificationListener; use OCA\Libresign\Listener\RevokeClickToSignCertificateListener; -use OCA\Libresign\Listener\SignedCallbackListener; use OCA\Libresign\Listener\TwofactorGatewayListener; use OCA\Libresign\Listener\UserDeletedListener; use OCA\Libresign\Middleware\GlobalInjectionMiddleware; @@ -67,7 +66,6 @@ public function register(IRegistrationContext $context): void { $context->registerEventListener(LoadSidebar::class, TemplateLoader::class); $context->registerEventListener(BeforeNodeDeletedEvent::class, BeforeNodeDeletedListener::class); $context->registerEventListener(CacheEntryRemovedEvent::class, BeforeNodeDeletedListener::class); - $context->registerEventListener(SignedEvent::class, SignedCallbackListener::class); // Files newFile listener $context->registerEventListener('OCA\\Files\\Event\\LoadAdditionalScriptsEvent', LoadAdditionalListener::class); diff --git a/lib/Controller/RequestSignatureController.php b/lib/Controller/RequestSignatureController.php index 6e538af3c0..a0fea33912 100644 --- a/lib/Controller/RequestSignatureController.php +++ b/lib/Controller/RequestSignatureController.php @@ -65,7 +65,6 @@ public function __construct( * @param LibresignFolderSettings $settings Settings to define how and where the file should be stored * @param LibresignNewFile $file File object. Supports nodeId (a non-negative integer or its canonical decimal string, as Nextcloud node ids can exceed a JavaScript number), url, base64 or path. * @param list $files Multiple files to create an envelope (optional, use either file or files). Each file supports nodeId, url, base64 or path. - * @param string|null $callback URL that will receive a POST after the document is signed * @param integer|null $status Numeric code of status * 0 - no signers * 1 - signed * 2 - pending * @param LibresignRequestPolicy|null $policy Structured policy payload with request-level overrides and active context. * @return DataResponse|DataResponse @@ -84,11 +83,11 @@ public function requestSignature( array $settings = [], array $file = [], array $files = [], - ?string $callback = null, ?int $status = 1, ?array $policy = null, ): DataResponse { try { + $this->rejectLegacyCallbackParameter(); $user = $this->userSession->getUser(); $result = $this->requestSignatureWorkflowService->createRequest( $user, @@ -98,7 +97,6 @@ public function requestSignature( $settings, $signers, $status, - $callback, $policy, ); @@ -163,6 +161,7 @@ public function updateSignatureRequest( array $files = [], ): DataResponse { try { + $this->rejectLegacyCallbackParameter(); $user = $this->userSession->getUser(); $signers = is_array($signers) ? $signers : []; $file = is_array($file) ? $file : []; @@ -176,7 +175,6 @@ public function updateSignatureRequest( $settings, $signers, $status, - null, $policy, $visibleElements ); @@ -209,6 +207,12 @@ public function updateSignatureRequest( } } + private function rejectLegacyCallbackParameter(): void { + if (array_key_exists('callback', $this->request->getParams())) { + throw new LibresignException($this->l10n->t('Per-request callbacks have been removed. Configure Nextcloud Webhook Listeners.')); + } + } + /** * Delete sign request * diff --git a/lib/Db/File.php b/lib/Db/File.php index 1f56a3a21c..c7d51f3e11 100644 --- a/lib/Db/File.php +++ b/lib/Db/File.php @@ -31,8 +31,6 @@ * @method \DateTime getCreatedAt() * @method void setName(string $name) * @method non-falsy-string getName() - * @method void setCallback(string $callback) - * @method ?string getCallback() * @method void setStatus(int $status) * @method int getStatus() * @method void setMetadata(array $metadata) @@ -57,7 +55,6 @@ class File extends Entity { protected ?string $userId = null; protected ?int $signedNodeId = null; protected ?string $signedHash = null; - protected ?string $callback = null; protected ?array $metadata = null; protected int $modificationStatus = 0; protected int $signatureFlow = SignatureFlow::NUMERIC_NONE; @@ -79,7 +76,6 @@ public function __construct() { $this->addType('uuid', Types::STRING); $this->addType('createdAt', Types::DATETIME); $this->addType('name', Types::STRING); - $this->addType('callback', Types::STRING); $this->addType('status', Types::INTEGER); $this->addType('metadata', Types::JSON); $this->addType('modificationStatus', Types::SMALLINT); diff --git a/lib/Db/IdDocsMapper.php b/lib/Db/IdDocsMapper.php index a2a23cafa0..21c6dc45ff 100644 --- a/lib/Db/IdDocsMapper.php +++ b/lib/Db/IdDocsMapper.php @@ -162,7 +162,6 @@ private function getQueryBuilder(array $filter = [], bool $count = false): IQuer 'f.id', 'f.uuid', 'f.name', - 'f.callback', 'f.status', 'f.node_id', 'f.user_id', @@ -217,7 +216,6 @@ private function getQueryBuilder(array $filter = [], bool $count = false): IQuer 'f.id', 'f.uuid', 'f.name', - 'f.callback', 'f.status', 'f.node_id', 'f.user_id', @@ -314,7 +312,6 @@ private function formatListRow(array $row, string $url): array { 'signedNodeId' => (int)$row['node_id'], 'url' => $url . $row['uuid'], ], - 'callback' => $row['callback'], 'uuid' => $row['uuid'], 'signers' => [], ], diff --git a/lib/Listener/SignedCallbackListener.php b/lib/Listener/SignedCallbackListener.php deleted file mode 100644 index d3f54339d2..0000000000 --- a/lib/Listener/SignedCallbackListener.php +++ /dev/null @@ -1,35 +0,0 @@ - */ -class SignedCallbackListener implements IEventListener { - public function __construct( - private SignFileService $signFileService, - ) { - } - - #[\Override] - public function handle(Event $event): void { - /** @var SignedEvent */ - if (!($event instanceof SignedEvent)) { - return; - } - - $updatedFields = $event->getLibreSignFile()->getUpdatedFields(); - if (isset($updatedFields['signed']) && $updatedFields['signed'] === true) { - $this->signFileService->notifyCallback($event->getSignedFile()); - } - } -} diff --git a/lib/ResponseDefinitions.php b/lib/ResponseDefinitions.php index 462e7847b1..81fe277cdf 100644 --- a/lib/ResponseDefinitions.php +++ b/lib/ResponseDefinitions.php @@ -827,7 +827,6 @@ * signedNodeId: non-negative-int, * url: string, * }, - * callback: ?string, * uuid: string, * signers: list, * }, diff --git a/lib/Service/RequestSignatureService.php b/lib/Service/RequestSignatureService.php index 1379a77638..e5b72ca239 100644 --- a/lib/Service/RequestSignatureService.php +++ b/lib/Service/RequestSignatureService.php @@ -412,8 +412,7 @@ private function createFileForEnvelope( * userManager?: IUser, * signRequest?: SignRequestEntity, * name?: string, - * callback?: string, - * uuid?: ?string, + * uuid?: ?string, * status?: int, * parentFileId?: int, * file?: array{fileId?: int, nodeId?: int, fileNode?: Node}, @@ -481,9 +480,6 @@ private function persistFile(array $data, ?Node $createdNode = null): array { } $file->setName($this->removeExtensionFromName($name, $metadata)); $file->setMetadata($metadata); - if (!empty($data['callback'])) { - $file->setCallback($data['callback']); - } if (isset($data['status'])) { $file->setStatus($data['status']); } else { diff --git a/lib/Service/RequestSignatureWorkflowService.php b/lib/Service/RequestSignatureWorkflowService.php index cf65e87e82..c39d70c33b 100644 --- a/lib/Service/RequestSignatureWorkflowService.php +++ b/lib/Service/RequestSignatureWorkflowService.php @@ -59,7 +59,6 @@ public function createRequest( array $settings, array $signers, ?int $status, - ?string $callback, ?array $policy = null, ?array $visibleElements = null, ): array { @@ -75,7 +74,6 @@ public function createRequest( 'file' => $file, 'name' => $name, 'signers' => $signers, - 'callback' => $callback, 'userManager' => $user, 'policyOverrides' => $resolvedPolicy['policyOverrides'], 'policyActiveContext' => $resolvedPolicy['policyActiveContext'], diff --git a/lib/Service/SignFileService.php b/lib/Service/SignFileService.php index ad7852b129..36ab9348ce 100644 --- a/lib/Service/SignFileService.php +++ b/lib/Service/SignFileService.php @@ -63,7 +63,6 @@ use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\File; use OCP\Files\NotPermittedException; -use OCP\Http\Client\IClientService; use OCP\IAppConfig; use OCP\IDateTimeZone; use OCP\IL10N; @@ -105,7 +104,6 @@ public function __construct( private IdDocsMapper $idDocsMapper, private FooterHandler $footerHandler, protected FolderService $folderService, - private IClientService $client, protected LoggerInterface $logger, private IAppConfig $appConfig, protected IdentityDocumentValidator $identityDocumentValidator, @@ -179,34 +177,6 @@ public function canDeleteRequestSignature(array $data): void { }); } - public function notifyCallback(File $file): void { - $uri = $this->libreSignFile->getCallback(); - if (!$uri) { - $uri = $this->appConfig->getValueString(Application::APP_ID, 'webhook_sign_url'); - if (!$uri) { - return; - } - } - $options = [ - 'multipart' => [ - [ - 'name' => 'uuid', - 'contents' => $this->libreSignFile->getUuid(), - ], - [ - 'name' => 'status', - 'contents' => $this->libreSignFile->getStatus(), - ], - [ - 'name' => 'file', - 'contents' => $file->fopen('r'), - 'filename' => $file->getName() - ] - ] - ]; - $this->client->newClient()->post($uri, $options); - } - /** * @return static */ diff --git a/tests/php/Api/Controller/RequestSignatureControllerTest.php b/tests/php/Api/Controller/RequestSignatureControllerTest.php index 341d5edcbf..c77b7f9c09 100644 --- a/tests/php/Api/Controller/RequestSignatureControllerTest.php +++ b/tests/php/Api/Controller/RequestSignatureControllerTest.php @@ -46,6 +46,36 @@ public function testPostRegisterWithValidationFailure():void { $this->assertEquals('You are not allowed to create signature requests', $body['ocs']['data']['errors'][0]['message']); } + /** + * @runInSeparateProcess + */ + public function testRequestRejectsRemovedLegacyCallback(): void { + $this->createAccount('callbackmanager', 'password', 'testGroup'); + $this->getMockAppConfig()->setValueString( + Application::APP_ID, 'groups_request_sign', + '{"allowGroups":["admin","testGroup"],"denyGroups":[]}', + ); + + $this->request + ->withMethod('POST') + ->withPath('/api/v1/request-signature') + ->withRequestHeader([ + 'Authorization' => 'Basic ' . base64_encode('callbackmanager:password'), + 'Content-Type' => 'application/json', + ]) + ->withRequestBody([ + 'name' => 'no-legacy-callback.pdf', + 'callback' => 'https://example.test/legacy', + 'file' => ['base64' => base64_encode(file_get_contents(__DIR__ . '/../../fixtures/pdfs/small_valid.pdf'))], + 'signers' => [], + ]) + ->expectStatus(422); + + $response = $this->assertRequest(); + $data = json_decode($response->getBody()->getContents(), true); + $this->assertStringContainsString('Per-request callbacks have been removed', json_encode($data)); + } + /** * @runInSeparateProcess */ diff --git a/tests/php/Unit/Controller/RequestSignatureControllerTest.php b/tests/php/Unit/Controller/RequestSignatureControllerTest.php index 73e8d5280c..061dea3cdb 100644 --- a/tests/php/Unit/Controller/RequestSignatureControllerTest.php +++ b/tests/php/Unit/Controller/RequestSignatureControllerTest.php @@ -87,6 +87,31 @@ protected function setUp(): void { ); } + #[DataProvider('legacyCallbackPayloadScenarios')] + public function testLegacyCallbackParameterFailsBeforeSaving(bool $isPatch): void { + $this->request->method('getParams')->willReturn(['callback' => 'https://example.test/legacy']); + $this->requestSignatureService->expects($this->never())->method('validateNewRequestToFile'); + $this->requestSignatureService->expects($this->never())->method('save'); + $this->signingRequestValidator->expects($this->never())->method('validateExistingFile'); + + $response = $isPatch + ? $this->controller->updateSignatureRequest(uuid: '11111111-2222-3333-4444-555555555555') + : $this->controller->requestSignature(file: ['nodeId' => 12]); + + $this->assertSame(Http::STATUS_UNPROCESSABLE_ENTITY, $response->getStatus()); + $this->assertSame( + ['message' => 'Per-request callbacks have been removed. Configure Nextcloud Webhook Listeners.'], + $response->getData(), + ); + } + + public static function legacyCallbackPayloadScenarios(): array { + return [ + 'POST create' => [false], + 'PATCH update' => [true], + ]; + } + #[DataProvider('statusPayloadScenarios')] public function testRequestStatusPropagation(?int $status, bool $expectStatusKey): void { $file = new FileEntity(); @@ -130,7 +155,6 @@ public function testRequestStatusPropagation(?int $status, bool $expectStatusKey settings: [], file: ['nodeId' => 12], files: [], - callback: null, status: $status, ); diff --git a/tests/php/Unit/Service/RequestSignatureWorkflowServiceTest.php b/tests/php/Unit/Service/RequestSignatureWorkflowServiceTest.php index 03aadebd32..3e5330472c 100644 --- a/tests/php/Unit/Service/RequestSignatureWorkflowServiceTest.php +++ b/tests/php/Unit/Service/RequestSignatureWorkflowServiceTest.php @@ -85,7 +85,6 @@ public function testCreateRequestThrowsWhenFileAndFilesAreMissing(): void { [], [], 1, - null, ); } @@ -114,7 +113,6 @@ public function testCreateRequestMapsPolicyAndFallsBackToFileSettings(): void { [], [['identifyMethods' => [['method' => 'email', 'value' => 'user@example.test']]]], 1, - null, [ 'overrides' => ['signature_flow' => 'parallel'], 'activeContext' => ['type' => 'group', 'id' => 'board'], @@ -157,7 +155,6 @@ public function testCreateRequestUsesEnvelopeSaveFilesAndReturnsProvidedChildren [['identifyMethods' => [['method' => 'email', 'value' => 'user@example.test']]]], 0, null, - null, [['fileId' => 31]], ); @@ -190,7 +187,6 @@ public function testCreateRequestNormalizesTheStringNodeIdOnceAtTheBoundary(): v [], [['identifyMethods' => [['method' => 'email', 'value' => 'user@example.test']]]], 1, - null, ); $this->assertSame($fileEntity, $result['file']); @@ -216,7 +212,6 @@ public function testCreateRequestKeepsAnIntegerNodeIdAsItIs(): void { [], [['identifyMethods' => [['method' => 'email', 'value' => 'user@example.test']]]], 1, - null, ); } @@ -248,7 +243,6 @@ public function testCreateRequestNormalizesTheNodeIdOfEachEnvelopeFile(): void { [], [['identifyMethods' => [['method' => 'email', 'value' => 'user@example.test']]]], 0, - null, ); } @@ -267,7 +261,6 @@ public function testCreateRequestRejectsAnInvalidNodeIdBeforeAnyService(): void [], [['identifyMethods' => [['method' => 'email', 'value' => 'user@example.test']]]], 1, - null, ); } diff --git a/tests/php/Unit/Service/SignFileServiceTest.php b/tests/php/Unit/Service/SignFileServiceTest.php index ffd2cf76de..25e7d950e5 100644 --- a/tests/php/Unit/Service/SignFileServiceTest.php +++ b/tests/php/Unit/Service/SignFileServiceTest.php @@ -74,7 +74,6 @@ use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; -use OCP\Http\Client\IClientService; use OCP\IAppConfig; use OCP\IDateTimeZone; use OCP\IL10N; @@ -95,7 +94,6 @@ final class SignFileServiceTest extends \OCA\Libresign\Tests\Unit\TestCase { private SignRequestMapper&MockObject $signRequestMapper; private \OCA\Libresign\Db\NotificationDeliveryMapper&MockObject $notificationDeliveries; private IdDocsMapper&MockObject $idDocsMapper; - private IClientService&MockObject $clientService; private FolderService&MockObject $folderService; private LoggerInterface&MockObject $logger; private IAppConfig $appConfig; @@ -150,7 +148,6 @@ public function setUp(): void { $this->notificationDeliveries = $this->createMock(\OCA\Libresign\Db\NotificationDeliveryMapper::class); $this->idDocsMapper = $this->createMock(IdDocsMapper::class); $this->footerHandler = $this->createMock(FooterHandler::class); - $this->clientService = $this->createMock(IClientService::class); $this->folderService = $this->createMock(FolderService::class); $this->logger = $this->createMock(LoggerInterface::class); $this->appConfig = $this->getMockAppConfigWithReset(); @@ -506,7 +503,6 @@ private function getService(array $methods = []): SignFileService|MockObject { $this->idDocsMapper, $this->footerHandler, $this->folderService, - $this->clientService, $this->logger, $this->appConfig, $this->identityDocumentValidator, @@ -556,7 +552,6 @@ private function getService(array $methods = []): SignFileService|MockObject { $this->idDocsMapper, $this->footerHandler, $this->folderService, - $this->clientService, $this->logger, $this->appConfig, $this->identityDocumentValidator, @@ -640,16 +635,6 @@ public function testCanDeleteRequestSignatureWhenNoSignatureWasRequested():void ]); } - public function testNotifyCallback():void { - $libreSignFile = new \OCA\Libresign\Db\File(); - $libreSignFile->setCallback('https://test.coop'); - $service = $this->getService(); - $service->setLibreSignFile($libreSignFile); - $file = $this->createMock(\OCP\Files\File::class); - $actual = $service->notifyCallback($file); - $this->assertNull($actual); - } - public function testSignWithFileNotFound():void { $this->expectExceptionMessage('File not found'); From 5fb64c4da5c0453d6e57ca292b89357b29c0f686 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Sat, 14 Nov 2026 23:32:49 +0000 Subject: [PATCH 02/11] refactor: drop legacy callback storage and configuration on upgrade Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .../Version19005Date20261109110000.php | 52 ++++++++++++++++ .../Version19005Date20261109110000Test.php | 59 +++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 lib/Migration/Version19005Date20261109110000.php create mode 100644 tests/php/Unit/Migration/Version19005Date20261109110000Test.php diff --git a/lib/Migration/Version19005Date20261109110000.php b/lib/Migration/Version19005Date20261109110000.php new file mode 100644 index 0000000000..c8929f0293 --- /dev/null +++ b/lib/Migration/Version19005Date20261109110000.php @@ -0,0 +1,52 @@ +hasTable('libresign_file')) { + return null; + } + + $table = $schema->getTable('libresign_file'); + if (!$table->hasColumn('callback')) { + return null; + } + + $table->dropColumn('callback'); + return $schema; + } + + /** @param Closure(): ISchemaWrapper $schemaClosure */ + #[\Override] + public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { + if (in_array('webhook_sign_url', $this->appConfig->getKeys(Application::APP_ID), true)) { + $this->appConfig->deleteKey(Application::APP_ID, 'webhook_sign_url'); + } + } +} diff --git a/tests/php/Unit/Migration/Version19005Date20261109110000Test.php b/tests/php/Unit/Migration/Version19005Date20261109110000Test.php new file mode 100644 index 0000000000..ba214547fc --- /dev/null +++ b/tests/php/Unit/Migration/Version19005Date20261109110000Test.php @@ -0,0 +1,59 @@ +addColumn('callback', 'string', ['notnull' => false]); + $schema = $this->createMock(ISchemaWrapper::class); + $schema->method('hasTable')->with('libresign_file')->willReturn(true); + $schema->method('getTable')->with('libresign_file')->willReturn($table); + $output = $this->createMock(IOutput::class); + $migration = new Version19005Date20261109110000($this->createMock(IAppConfig::class)); + + $this->assertSame($schema, $migration->changeSchema($output, static fn (): ISchemaWrapper => $schema, [])); + $this->assertFalse($table->hasColumn('callback')); + $this->assertNull($migration->changeSchema($output, static fn (): ISchemaWrapper => $schema, [])); + } + + public function testSkipsMissingFileTable(): void { + $schema = $this->createMock(ISchemaWrapper::class); + $schema->method('hasTable')->with('libresign_file')->willReturn(false); + $migration = new Version19005Date20261109110000($this->createMock(IAppConfig::class)); + + $this->assertNull($migration->changeSchema($this->createMock(IOutput::class), static fn (): ISchemaWrapper => $schema, [])); + } + + public function testRemovesOnlyConfiguredLegacyWebhookUrl(): void { + $config = $this->createMock(IAppConfig::class); + $config->method('getKeys')->with(Application::APP_ID)->willReturn(['webhook_sign_url', 'signature_engine']); + $config->expects($this->once())->method('deleteKey')->with(Application::APP_ID, 'webhook_sign_url'); + $migration = new Version19005Date20261109110000($config); + + $migration->postSchemaChange($this->createMock(IOutput::class), static fn (): ISchemaWrapper => throw new \LogicException('Schema unused'), []); + } + + public function testLeavesConfigUntouchedWhenLegacyKeyIsMissing(): void { + $config = $this->createMock(IAppConfig::class); + $config->method('getKeys')->with(Application::APP_ID)->willReturn(['signature_engine']); + $config->expects($this->never())->method('deleteKey'); + $migration = new Version19005Date20261109110000($config); + + $migration->postSchemaChange($this->createMock(IOutput::class), static fn (): ISchemaWrapper => throw new \LogicException('Schema unused'), []); + } +} From 17041cd703c2a4059454a590e85d1e6d0c7c48d5 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Sat, 14 Nov 2026 23:33:17 +0000 Subject: [PATCH 03/11] test: align removed callback with Nextcloud schema mocks and TypeScript fixtures Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- lib/Service/RequestSignatureService.php | 2 +- lib/Service/SignFileService.php | 1 - src/tests/views/Documents/IdDocsValidation.spec.ts | 2 -- .../Migration/Version19005Date20261109110000Test.php | 9 +++++---- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/Service/RequestSignatureService.php b/lib/Service/RequestSignatureService.php index e5b72ca239..484bf57c52 100644 --- a/lib/Service/RequestSignatureService.php +++ b/lib/Service/RequestSignatureService.php @@ -412,7 +412,7 @@ private function createFileForEnvelope( * userManager?: IUser, * signRequest?: SignRequestEntity, * name?: string, - * uuid?: ?string, + * uuid?: ?string, * status?: int, * parentFileId?: int, * file?: array{fileId?: int, nodeId?: int, fileNode?: Node}, diff --git a/lib/Service/SignFileService.php b/lib/Service/SignFileService.php index 36ab9348ce..05f653c6c4 100644 --- a/lib/Service/SignFileService.php +++ b/lib/Service/SignFileService.php @@ -13,7 +13,6 @@ use Exception; use InvalidArgumentException; use OC\AppFramework\Http as AppFrameworkHttp; -use OCA\Libresign\AppInfo\Application; use OCA\Libresign\BackgroundJob\SignSingleFileJob; use OCA\Libresign\DataObjects\VisibleElementAssoc; use OCA\Libresign\Db\File as FileEntity; diff --git a/src/tests/views/Documents/IdDocsValidation.spec.ts b/src/tests/views/Documents/IdDocsValidation.spec.ts index 0f1ac27396..639e6386cc 100644 --- a/src/tests/views/Documents/IdDocsValidation.spec.ts +++ b/src/tests/views/Documents/IdDocsValidation.spec.ts @@ -135,7 +135,6 @@ describe('IdDocsValidation.vue', () => { signedNodeId: 10, url: '/files/alice-passport.pdf', }, - callback: null, signers: [{ description: null, displayName: 'Approver', @@ -177,7 +176,6 @@ describe('IdDocsValidation.vue', () => { signedNodeId: 11, url: '/files/bob-license.pdf', }, - callback: null, signers: [], }, } diff --git a/tests/php/Unit/Migration/Version19005Date20261109110000Test.php b/tests/php/Unit/Migration/Version19005Date20261109110000Test.php index ba214547fc..aa5c9c3476 100644 --- a/tests/php/Unit/Migration/Version19005Date20261109110000Test.php +++ b/tests/php/Unit/Migration/Version19005Date20261109110000Test.php @@ -8,18 +8,20 @@ namespace OCA\Libresign\Tests\Unit\Migration; -use Doctrine\DBAL\Schema\Table; use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Migration\Version19005Date20261109110000; use OCP\DB\ISchemaWrapper; +use OCP\DB\Schema\ITable; use OCP\IAppConfig; use OCP\Migration\IOutput; use PHPUnit\Framework\TestCase; final class Version19005Date20261109110000Test extends TestCase { public function testDropsCallbackColumnOnlyOnce(): void { - $table = new Table('libresign_file'); - $table->addColumn('callback', 'string', ['notnull' => false]); + $table = $this->createMock(ITable::class); + $table->expects($this->exactly(2))->method('hasColumn')->with('callback') + ->willReturnOnConsecutiveCalls(true, false); + $table->expects($this->once())->method('dropColumn')->with('callback'); $schema = $this->createMock(ISchemaWrapper::class); $schema->method('hasTable')->with('libresign_file')->willReturn(true); $schema->method('getTable')->with('libresign_file')->willReturn($table); @@ -27,7 +29,6 @@ public function testDropsCallbackColumnOnlyOnce(): void { $migration = new Version19005Date20261109110000($this->createMock(IAppConfig::class)); $this->assertSame($schema, $migration->changeSchema($output, static fn (): ISchemaWrapper => $schema, [])); - $this->assertFalse($table->hasColumn('callback')); $this->assertNull($migration->changeSchema($output, static fn (): ISchemaWrapper => $schema, [])); } From 9b9f8b4944cd4d366a799c88410c7ed8120eeac1 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Sat, 14 Nov 2026 23:33:29 +0000 Subject: [PATCH 04/11] test: align callback rejection tests with OpenAPI contract Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .../RequestSignatureControllerTest.php | 30 ------------------- .../RequestSignatureControllerTest.php | 12 +++++--- 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/tests/php/Api/Controller/RequestSignatureControllerTest.php b/tests/php/Api/Controller/RequestSignatureControllerTest.php index c77b7f9c09..341d5edcbf 100644 --- a/tests/php/Api/Controller/RequestSignatureControllerTest.php +++ b/tests/php/Api/Controller/RequestSignatureControllerTest.php @@ -46,36 +46,6 @@ public function testPostRegisterWithValidationFailure():void { $this->assertEquals('You are not allowed to create signature requests', $body['ocs']['data']['errors'][0]['message']); } - /** - * @runInSeparateProcess - */ - public function testRequestRejectsRemovedLegacyCallback(): void { - $this->createAccount('callbackmanager', 'password', 'testGroup'); - $this->getMockAppConfig()->setValueString( - Application::APP_ID, 'groups_request_sign', - '{"allowGroups":["admin","testGroup"],"denyGroups":[]}', - ); - - $this->request - ->withMethod('POST') - ->withPath('/api/v1/request-signature') - ->withRequestHeader([ - 'Authorization' => 'Basic ' . base64_encode('callbackmanager:password'), - 'Content-Type' => 'application/json', - ]) - ->withRequestBody([ - 'name' => 'no-legacy-callback.pdf', - 'callback' => 'https://example.test/legacy', - 'file' => ['base64' => base64_encode(file_get_contents(__DIR__ . '/../../fixtures/pdfs/small_valid.pdf'))], - 'signers' => [], - ]) - ->expectStatus(422); - - $response = $this->assertRequest(); - $data = json_decode($response->getBody()->getContents(), true); - $this->assertStringContainsString('Per-request callbacks have been removed', json_encode($data)); - } - /** * @runInSeparateProcess */ diff --git a/tests/php/Unit/Controller/RequestSignatureControllerTest.php b/tests/php/Unit/Controller/RequestSignatureControllerTest.php index 061dea3cdb..588537e081 100644 --- a/tests/php/Unit/Controller/RequestSignatureControllerTest.php +++ b/tests/php/Unit/Controller/RequestSignatureControllerTest.php @@ -88,8 +88,8 @@ protected function setUp(): void { } #[DataProvider('legacyCallbackPayloadScenarios')] - public function testLegacyCallbackParameterFailsBeforeSaving(bool $isPatch): void { - $this->request->method('getParams')->willReturn(['callback' => 'https://example.test/legacy']); + public function testLegacyCallbackParameterFailsBeforeSaving(bool $isPatch, mixed $callback): void { + $this->request->method('getParams')->willReturn(['callback' => $callback]); $this->requestSignatureService->expects($this->never())->method('validateNewRequestToFile'); $this->requestSignatureService->expects($this->never())->method('save'); $this->signingRequestValidator->expects($this->never())->method('validateExistingFile'); @@ -107,8 +107,12 @@ public function testLegacyCallbackParameterFailsBeforeSaving(bool $isPatch): voi public static function legacyCallbackPayloadScenarios(): array { return [ - 'POST create' => [false], - 'PATCH update' => [true], + 'POST create with URL' => [false, 'https://example.test/legacy'], + 'POST create with null' => [false, null], + 'POST create with empty string' => [false, ''], + 'PATCH update with URL' => [true, 'https://example.test/legacy'], + 'PATCH update with null' => [true, null], + 'PATCH update with empty string' => [true, ''], ]; } From a005e8fbccae23d395034977d108fd7e0dcd3235 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Sat, 14 Nov 2026 23:33:42 +0000 Subject: [PATCH 05/11] fix(migration): preserve legacy callback destinations before removal Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .../Version19005Date20261109110000.php | 84 +++++++++- .../Version19005Date20261109110000Test.php | 154 +++++++++++++++++- 2 files changed, 228 insertions(+), 10 deletions(-) diff --git a/lib/Migration/Version19005Date20261109110000.php b/lib/Migration/Version19005Date20261109110000.php index c8929f0293..53a6e406fb 100644 --- a/lib/Migration/Version19005Date20261109110000.php +++ b/lib/Migration/Version19005Date20261109110000.php @@ -11,18 +11,98 @@ use Closure; use OCA\Libresign\AppInfo\Application; use OCP\DB\ISchemaWrapper; +use OCP\Files\AppData\IAppDataFactory; +use OCP\Files\IAppData; use OCP\IAppConfig; +use OCP\IDBConnection; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; /** - * Remove obsolete direct callback destinations when upgrading to native - * Nextcloud webhook subscriptions. Existing signing files are unaffected. + * Remove legacy callback destinations after preserving any configured values. */ final class Version19005Date20261109110000 extends SimpleMigrationStep { + private const FILE_BACKUP = 'backup-table-libresign_file_callback_Version19005Date20261109110000.csv'; + private const CONFIG_BACKUP = 'backup-config-webhook_sign_url_Version19005Date20261109110000.json'; + + private IAppData $appData; + public function __construct( private IAppConfig $appConfig, + private IDBConnection $connection, + IAppDataFactory $appDataFactory, ) { + $this->appData = $appDataFactory->get(Application::APP_ID); + } + + /** @param Closure(): ISchemaWrapper $schemaClosure */ + #[\Override] + public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { + $schema = $schemaClosure(); + if ($schema->hasTable('libresign_file') && $schema->getTable('libresign_file')->hasColumn('callback')) { + $this->backupFileCallbacks(); + } + + $this->backupLegacyWebhookUrl(); + } + + private function backupFileCallbacks(): void { + $query = $this->connection->getQueryBuilder(); + $query->select('id', 'uuid', 'callback') + ->from('libresign_file') + ->where($query->expr()->isNotNull('callback')) + ->andWhere($query->expr()->neq('callback', $query->createNamedParameter(''))) + ->orderBy('id'); + + $result = $query->executeQuery(); + try { + $row = $result->fetchAssociative(); + if ($row === false) { + return; + } + + $folder = $this->appData->getFolder('/'); + $file = $folder->newFile(self::FILE_BACKUP); + $handle = $file->write(); + if (!is_resource($handle)) { + throw new \RuntimeException('Could not open LibreSign callback backup for writing'); + } + + try { + if (fputcsv($handle, ['id', 'uuid', 'callback'], ',', '"', '') === false) { + throw new \RuntimeException('Could not write LibreSign callback backup header'); + } + + do { + if (fputcsv($handle, [$row['id'], $row['uuid'], $row['callback']], ',', '"', '') === false) { + throw new \RuntimeException('Could not write LibreSign callback backup row'); + } + } while (($row = $result->fetchAssociative()) !== false); + } finally { + if (!fclose($handle)) { + throw new \RuntimeException('Could not close LibreSign callback backup'); + } + } + } finally { + $result->closeCursor(); + } + } + + private function backupLegacyWebhookUrl(): void { + if (!in_array('webhook_sign_url', $this->appConfig->getKeys(Application::APP_ID), true)) { + return; + } + + $url = $this->appConfig->getValueString(Application::APP_ID, 'webhook_sign_url'); + if ($url === '') { + return; + } + + $folder = $this->appData->getFolder('/'); + $folder->newFile( + self::CONFIG_BACKUP, + json_encode(['webhook_sign_url' => $url], JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), + ); } /** @param Closure(): ISchemaWrapper $schemaClosure */ diff --git a/tests/php/Unit/Migration/Version19005Date20261109110000Test.php b/tests/php/Unit/Migration/Version19005Date20261109110000Test.php index aa5c9c3476..bce4a2ef43 100644 --- a/tests/php/Unit/Migration/Version19005Date20261109110000Test.php +++ b/tests/php/Unit/Migration/Version19005Date20261109110000Test.php @@ -10,9 +10,17 @@ use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Migration\Version19005Date20261109110000; +use OCP\DB\IResult; use OCP\DB\ISchemaWrapper; +use OCP\DB\QueryBuilder\IExpressionBuilder; +use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\Schema\ITable; +use OCP\Files\AppData\IAppDataFactory; +use OCP\Files\IAppData; +use OCP\Files\SimpleFS\ISimpleFile; +use OCP\Files\SimpleFS\ISimpleFolder; use OCP\IAppConfig; +use OCP\IDBConnection; use OCP\Migration\IOutput; use PHPUnit\Framework\TestCase; @@ -26,7 +34,7 @@ public function testDropsCallbackColumnOnlyOnce(): void { $schema->method('hasTable')->with('libresign_file')->willReturn(true); $schema->method('getTable')->with('libresign_file')->willReturn($table); $output = $this->createMock(IOutput::class); - $migration = new Version19005Date20261109110000($this->createMock(IAppConfig::class)); + $migration = $this->migration($this->createMock(IAppConfig::class)); $this->assertSame($schema, $migration->changeSchema($output, static fn (): ISchemaWrapper => $schema, [])); $this->assertNull($migration->changeSchema($output, static fn (): ISchemaWrapper => $schema, [])); @@ -35,26 +43,156 @@ public function testDropsCallbackColumnOnlyOnce(): void { public function testSkipsMissingFileTable(): void { $schema = $this->createMock(ISchemaWrapper::class); $schema->method('hasTable')->with('libresign_file')->willReturn(false); - $migration = new Version19005Date20261109110000($this->createMock(IAppConfig::class)); - $this->assertNull($migration->changeSchema($this->createMock(IOutput::class), static fn (): ISchemaWrapper => $schema, [])); + $this->assertNull($this->migration($this->createMock(IAppConfig::class))->changeSchema( + $this->createMock(IOutput::class), + static fn (): ISchemaWrapper => $schema, + [], + )); + } + + public function testBacksUpOnlyConfiguredCallbacksBeforeDroppingColumn(): void { + $rows = [ + ['id' => '12', 'uuid' => 'abc', 'callback' => 'https://example.test/a?a=1,b=2'], + ['id' => '47', 'uuid' => 'def', 'callback' => 'https://example.test/ç?x="quoted"'], + ]; + $path = tempnam(sys_get_temp_dir(), 'libresign-callback-test-'); + $this->assertNotFalse($path); + try { + $file = $this->createMock(ISimpleFile::class); + $file->method('write')->willReturnCallback(static fn () => fopen($path, 'wb')); + $folder = $this->createMock(ISimpleFolder::class); + $folder->expects($this->once()) + ->method('newFile') + ->with('backup-table-libresign_file_callback_Version19005Date20261109110000.csv') + ->willReturn($file); + $appData = $this->createMock(IAppData::class); + $appData->method('getFolder')->with('/')->willReturn($folder); + $factory = $this->createMock(IAppDataFactory::class); + $factory->method('get')->with(Application::APP_ID)->willReturn($appData); + $migration = $this->migration($this->createMock(IAppConfig::class), $factory, $this->connectionForRows($rows)); + $this->runPreSchema($migration, true); + + $fp = fopen($path, 'rb'); + $this->assertSame(['id', 'uuid', 'callback'], fgetcsv($fp, 0, ',', '"', '')); + $this->assertSame(array_values($rows[0]), fgetcsv($fp, 0, ',', '"', '')); + $this->assertSame(array_values($rows[1]), fgetcsv($fp, 0, ',', '"', '')); + $this->assertFalse(fgetcsv($fp, 0, ',', '"', '')); + fclose($fp); + } finally { + unlink($path); + } + } + + public function testCallbackBackupFailureStopsMigrationWithoutRemovingData(): void { + $folder = $this->createMock(ISimpleFolder::class); + $folder->expects($this->once())->method('newFile') + ->willThrowException(new \RuntimeException('Backup file already exists')); + $appData = $this->createMock(IAppData::class); + $appData->method('getFolder')->willReturn($folder); + $factory = $this->createMock(IAppDataFactory::class); + $factory->method('get')->willReturn($appData); + $config = $this->createMock(IAppConfig::class); + $config->expects($this->never())->method('deleteKey'); + $migration = $this->migration($config, $factory, $this->connectionForRows([ + ['id' => '4', 'uuid' => 'test', 'callback' => 'https://example.test/callback'], + ])); + + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Backup file already exists'); + $this->runPreSchema($migration, true); + } + + public function testNoBackupFileWhenAllCallbacksAreEmpty(): void { + $appData = $this->createMock(IAppData::class); + $appData->expects($this->never())->method('getFolder'); + $factory = $this->createMock(IAppDataFactory::class); + $factory->method('get')->willReturn($appData); + $migration = $this->migration($this->createMock(IAppConfig::class), $factory, $this->connectionForRows([])); + $this->runPreSchema($migration, true); + } + + public function testBacksUpGlobalCallbackEvenWhenColumnIsAbsent(): void { + $config = $this->createMock(IAppConfig::class); + $config->method('getKeys')->willReturn(['webhook_sign_url']); + $config->method('getValueString')->with(Application::APP_ID, 'webhook_sign_url') + ->willReturn('https://example.test/callback?secret=abc'); + $folder = $this->createMock(ISimpleFolder::class); + $folder->expects($this->once())->method('newFile') + ->with( + 'backup-config-webhook_sign_url_Version19005Date20261109110000.json', + "{\n \"webhook_sign_url\": \"https://example.test/callback?secret=abc\"\n}", + ); + $appData = $this->createMock(IAppData::class); + $appData->method('getFolder')->with('/')->willReturn($folder); + $factory = $this->createMock(IAppDataFactory::class); + $factory->method('get')->willReturn($appData); + + $this->runPreSchema($this->migration($config, $factory), false); + } + + public function testDoesNotDeleteConfigWhenBackupFails(): void { + $config = $this->createMock(IAppConfig::class); + $config->method('getKeys')->willReturn(['webhook_sign_url']); + $config->method('getValueString')->willReturn('https://example.test/callback'); + $config->expects($this->never())->method('deleteKey'); + $folder = $this->createMock(ISimpleFolder::class); + $folder->method('newFile')->willThrowException(new \RuntimeException('AppData unavailable')); + $appData = $this->createMock(IAppData::class); + $appData->method('getFolder')->willReturn($folder); + $factory = $this->createMock(IAppDataFactory::class); + $factory->method('get')->willReturn($appData); + + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('AppData unavailable'); + $this->runPreSchema($this->migration($config, $factory), false); } public function testRemovesOnlyConfiguredLegacyWebhookUrl(): void { $config = $this->createMock(IAppConfig::class); $config->method('getKeys')->with(Application::APP_ID)->willReturn(['webhook_sign_url', 'signature_engine']); $config->expects($this->once())->method('deleteKey')->with(Application::APP_ID, 'webhook_sign_url'); - $migration = new Version19005Date20261109110000($config); - - $migration->postSchemaChange($this->createMock(IOutput::class), static fn (): ISchemaWrapper => throw new \LogicException('Schema unused'), []); + $this->migration($config)->postSchemaChange($this->createMock(IOutput::class), static fn (): ISchemaWrapper => throw new \LogicException('Schema unused'), []); } public function testLeavesConfigUntouchedWhenLegacyKeyIsMissing(): void { $config = $this->createMock(IAppConfig::class); $config->method('getKeys')->with(Application::APP_ID)->willReturn(['signature_engine']); $config->expects($this->never())->method('deleteKey'); - $migration = new Version19005Date20261109110000($config); + $this->migration($config)->postSchemaChange($this->createMock(IOutput::class), static fn (): ISchemaWrapper => throw new \LogicException('Schema unused'), []); + } + + private function runPreSchema(Version19005Date20261109110000 $migration, bool $columnExists): void { + $table = $this->createMock(ITable::class); + $table->method('hasColumn')->with('callback')->willReturn($columnExists); + $schema = $this->createMock(ISchemaWrapper::class); + $schema->method('hasTable')->with('libresign_file')->willReturn(true); + $schema->method('getTable')->willReturn($table); + $migration->preSchemaChange($this->createMock(IOutput::class), static fn (): ISchemaWrapper => $schema, []); + } + + private function connectionForRows(array $rows): IDBConnection { + $result = $this->createMock(IResult::class); + $result->method('fetchAssociative')->willReturnOnConsecutiveCalls(...[...$rows, false]); + $result->expects($this->once())->method('closeCursor'); + $expr = $this->createMock(IExpressionBuilder::class); + $expr->method('isNotNull')->willReturn('callback IS NOT NULL'); + $expr->method('neq')->willReturn('callback <> :empty'); + $query = $this->createMock(IQueryBuilder::class); + foreach (['select', 'from', 'where', 'andWhere', 'orderBy'] as $method) { + $query->method($method)->willReturnSelf(); + } + $query->method('expr')->willReturn($expr); + $query->method('createNamedParameter')->willReturn(':empty'); + $query->method('executeQuery')->willReturn($result); + $connection = $this->createMock(IDBConnection::class); + $connection->method('getQueryBuilder')->willReturn($query); + return $connection; + } - $migration->postSchemaChange($this->createMock(IOutput::class), static fn (): ISchemaWrapper => throw new \LogicException('Schema unused'), []); + private function migration(IAppConfig $config, ?IAppDataFactory $factory = null, ?IDBConnection $connection = null): Version19005Date20261109110000 { + $factory ??= $this->createMock(IAppDataFactory::class); + $connection ??= $this->createMock(IDBConnection::class); + return new Version19005Date20261109110000($config, $connection, $factory); } } From f3ff1b0e68b193ccbe657341ad3abb7ec267c71d Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Sat, 14 Nov 2026 23:33:58 +0000 Subject: [PATCH 06/11] refactor(api): remove redundant legacy callback rejection Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- lib/Controller/RequestSignatureController.php | 8 ----- .../RequestSignatureControllerTest.php | 29 ------------------- 2 files changed, 37 deletions(-) diff --git a/lib/Controller/RequestSignatureController.php b/lib/Controller/RequestSignatureController.php index a0fea33912..4d27495eca 100644 --- a/lib/Controller/RequestSignatureController.php +++ b/lib/Controller/RequestSignatureController.php @@ -87,7 +87,6 @@ public function requestSignature( ?array $policy = null, ): DataResponse { try { - $this->rejectLegacyCallbackParameter(); $user = $this->userSession->getUser(); $result = $this->requestSignatureWorkflowService->createRequest( $user, @@ -161,7 +160,6 @@ public function updateSignatureRequest( array $files = [], ): DataResponse { try { - $this->rejectLegacyCallbackParameter(); $user = $this->userSession->getUser(); $signers = is_array($signers) ? $signers : []; $file = is_array($file) ? $file : []; @@ -207,12 +205,6 @@ public function updateSignatureRequest( } } - private function rejectLegacyCallbackParameter(): void { - if (array_key_exists('callback', $this->request->getParams())) { - throw new LibresignException($this->l10n->t('Per-request callbacks have been removed. Configure Nextcloud Webhook Listeners.')); - } - } - /** * Delete sign request * diff --git a/tests/php/Unit/Controller/RequestSignatureControllerTest.php b/tests/php/Unit/Controller/RequestSignatureControllerTest.php index 588537e081..237a05183a 100644 --- a/tests/php/Unit/Controller/RequestSignatureControllerTest.php +++ b/tests/php/Unit/Controller/RequestSignatureControllerTest.php @@ -87,35 +87,6 @@ protected function setUp(): void { ); } - #[DataProvider('legacyCallbackPayloadScenarios')] - public function testLegacyCallbackParameterFailsBeforeSaving(bool $isPatch, mixed $callback): void { - $this->request->method('getParams')->willReturn(['callback' => $callback]); - $this->requestSignatureService->expects($this->never())->method('validateNewRequestToFile'); - $this->requestSignatureService->expects($this->never())->method('save'); - $this->signingRequestValidator->expects($this->never())->method('validateExistingFile'); - - $response = $isPatch - ? $this->controller->updateSignatureRequest(uuid: '11111111-2222-3333-4444-555555555555') - : $this->controller->requestSignature(file: ['nodeId' => 12]); - - $this->assertSame(Http::STATUS_UNPROCESSABLE_ENTITY, $response->getStatus()); - $this->assertSame( - ['message' => 'Per-request callbacks have been removed. Configure Nextcloud Webhook Listeners.'], - $response->getData(), - ); - } - - public static function legacyCallbackPayloadScenarios(): array { - return [ - 'POST create with URL' => [false, 'https://example.test/legacy'], - 'POST create with null' => [false, null], - 'POST create with empty string' => [false, ''], - 'PATCH update with URL' => [true, 'https://example.test/legacy'], - 'PATCH update with null' => [true, null], - 'PATCH update with empty string' => [true, ''], - ]; - } - #[DataProvider('statusPayloadScenarios')] public function testRequestStatusPropagation(?int $status, bool $expectStatusKey): void { $file = new FileEntity(); From 35ebfb223bb3e50220ae9ec4419fba79e8c9b23a Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Sat, 14 Nov 2026 23:34:10 +0000 Subject: [PATCH 07/11] fix(migration): back up only populated callback values and row IDs Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- lib/Migration/Version19005Date20261109110000.php | 6 +++--- .../Version19005Date20261109110000Test.php | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/Migration/Version19005Date20261109110000.php b/lib/Migration/Version19005Date20261109110000.php index 53a6e406fb..a35aec0cf9 100644 --- a/lib/Migration/Version19005Date20261109110000.php +++ b/lib/Migration/Version19005Date20261109110000.php @@ -48,7 +48,7 @@ public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $ private function backupFileCallbacks(): void { $query = $this->connection->getQueryBuilder(); - $query->select('id', 'uuid', 'callback') + $query->select('id', 'callback') ->from('libresign_file') ->where($query->expr()->isNotNull('callback')) ->andWhere($query->expr()->neq('callback', $query->createNamedParameter(''))) @@ -69,12 +69,12 @@ private function backupFileCallbacks(): void { } try { - if (fputcsv($handle, ['id', 'uuid', 'callback'], ',', '"', '') === false) { + if (fputcsv($handle, ['id', 'callback'], ',', '"', '') === false) { throw new \RuntimeException('Could not write LibreSign callback backup header'); } do { - if (fputcsv($handle, [$row['id'], $row['uuid'], $row['callback']], ',', '"', '') === false) { + if (fputcsv($handle, [$row['id'], $row['callback']], ',', '"', '') === false) { throw new \RuntimeException('Could not write LibreSign callback backup row'); } } while (($row = $result->fetchAssociative()) !== false); diff --git a/tests/php/Unit/Migration/Version19005Date20261109110000Test.php b/tests/php/Unit/Migration/Version19005Date20261109110000Test.php index bce4a2ef43..345eca41fb 100644 --- a/tests/php/Unit/Migration/Version19005Date20261109110000Test.php +++ b/tests/php/Unit/Migration/Version19005Date20261109110000Test.php @@ -53,8 +53,8 @@ public function testSkipsMissingFileTable(): void { public function testBacksUpOnlyConfiguredCallbacksBeforeDroppingColumn(): void { $rows = [ - ['id' => '12', 'uuid' => 'abc', 'callback' => 'https://example.test/a?a=1,b=2'], - ['id' => '47', 'uuid' => 'def', 'callback' => 'https://example.test/ç?x="quoted"'], + ['id' => '12', 'callback' => 'https://example.test/a?a=1,b=2'], + ['id' => '47', 'callback' => 'https://example.test/ç?x="quoted"'], ]; $path = tempnam(sys_get_temp_dir(), 'libresign-callback-test-'); $this->assertNotFalse($path); @@ -74,7 +74,7 @@ public function testBacksUpOnlyConfiguredCallbacksBeforeDroppingColumn(): void { $this->runPreSchema($migration, true); $fp = fopen($path, 'rb'); - $this->assertSame(['id', 'uuid', 'callback'], fgetcsv($fp, 0, ',', '"', '')); + $this->assertSame(['id', 'callback'], fgetcsv($fp, 0, ',', '"', '')); $this->assertSame(array_values($rows[0]), fgetcsv($fp, 0, ',', '"', '')); $this->assertSame(array_values($rows[1]), fgetcsv($fp, 0, ',', '"', '')); $this->assertFalse(fgetcsv($fp, 0, ',', '"', '')); @@ -95,7 +95,7 @@ public function testCallbackBackupFailureStopsMigrationWithoutRemovingData(): vo $config = $this->createMock(IAppConfig::class); $config->expects($this->never())->method('deleteKey'); $migration = $this->migration($config, $factory, $this->connectionForRows([ - ['id' => '4', 'uuid' => 'test', 'callback' => 'https://example.test/callback'], + ['id' => '4', 'callback' => 'https://example.test/callback'], ])); $this->expectException(\RuntimeException::class); @@ -179,7 +179,10 @@ private function connectionForRows(array $rows): IDBConnection { $expr->method('isNotNull')->willReturn('callback IS NOT NULL'); $expr->method('neq')->willReturn('callback <> :empty'); $query = $this->createMock(IQueryBuilder::class); - foreach (['select', 'from', 'where', 'andWhere', 'orderBy'] as $method) { + $query->expects($this->once())->method('select')->with('id', 'callback')->willReturnSelf(); + $query->expects($this->once())->method('where')->with('callback IS NOT NULL')->willReturnSelf(); + $query->expects($this->once())->method('andWhere')->with('callback <> :empty')->willReturnSelf(); + foreach (['from', 'orderBy'] as $method) { $query->method($method)->willReturnSelf(); } $query->method('expr')->willReturn($expr); From 7c10024c8a9b461cf66ecc1dcb335e5e566922ed Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Sat, 14 Nov 2026 23:34:22 +0000 Subject: [PATCH 08/11] fix(migration): preserve callback backups across databases and verify writes Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .../Version19005Date20261109110000.php | 53 +++++++++++++------ 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/lib/Migration/Version19005Date20261109110000.php b/lib/Migration/Version19005Date20261109110000.php index a35aec0cf9..9621e9ceb3 100644 --- a/lib/Migration/Version19005Date20261109110000.php +++ b/lib/Migration/Version19005Date20261109110000.php @@ -40,18 +40,17 @@ public function __construct( public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $schema = $schemaClosure(); if ($schema->hasTable('libresign_file') && $schema->getTable('libresign_file')->hasColumn('callback')) { - $this->backupFileCallbacks(); + $this->backupFileCallbacks($output); } - $this->backupLegacyWebhookUrl(); + $this->backupLegacyWebhookUrl($output); } - private function backupFileCallbacks(): void { + private function backupFileCallbacks(IOutput $output): void { $query = $this->connection->getQueryBuilder(); $query->select('id', 'callback') ->from('libresign_file') - ->where($query->expr()->isNotNull('callback')) - ->andWhere($query->expr()->neq('callback', $query->createNamedParameter(''))) + ->where($query->expr()->nonEmptyString('callback')) ->orderBy('id'); $result = $query->executeQuery(); @@ -61,11 +60,11 @@ private function backupFileCallbacks(): void { return; } - $folder = $this->appData->getFolder('/'); - $file = $folder->newFile(self::FILE_BACKUP); - $handle = $file->write(); - if (!is_resource($handle)) { - throw new \RuntimeException('Could not open LibreSign callback backup for writing'); + // Build the CSV before creating AppData, so CSV write failures cannot + // persist a partial backup and leave the migration free to drop data. + $handle = fopen('php://temp', 'w+'); + if ($handle === false) { + throw new \RuntimeException('Could not open LibreSign callback backup buffer'); } try { @@ -78,17 +77,32 @@ private function backupFileCallbacks(): void { throw new \RuntimeException('Could not write LibreSign callback backup row'); } } while (($row = $result->fetchAssociative()) !== false); - } finally { - if (!fclose($handle)) { - throw new \RuntimeException('Could not close LibreSign callback backup'); + + $bytes = ftell($handle); + if ($bytes === false || !rewind($handle)) { + throw new \RuntimeException('Could not prepare LibreSign callback backup for storage'); + } + + // Supplying the populated resource writes synchronously. In contrast, + // newFile() without content defers persistence until stream close. + $folder = $this->appData->getFolder('/'); + $file = $folder->newFile(self::FILE_BACKUP, $handle); + if ($file->getSize() != $bytes) { + throw new \RuntimeException('Could not verify LibreSign callback backup size'); } + $output->info( + 'Legacy callback destinations saved to appdata_/libresign/' + . self::FILE_BACKUP . ' (may contain credentials; restrict access).', + ); + } finally { + fclose($handle); } } finally { $result->closeCursor(); } } - private function backupLegacyWebhookUrl(): void { + private function backupLegacyWebhookUrl(IOutput $output): void { if (!in_array('webhook_sign_url', $this->appConfig->getKeys(Application::APP_ID), true)) { return; } @@ -98,10 +112,15 @@ private function backupLegacyWebhookUrl(): void { return; } + $content = json_encode(['webhook_sign_url' => $url], JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); $folder = $this->appData->getFolder('/'); - $folder->newFile( - self::CONFIG_BACKUP, - json_encode(['webhook_sign_url' => $url], JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), + $file = $folder->newFile(self::CONFIG_BACKUP, $content); + if ($file->getSize() != strlen($content)) { + throw new \RuntimeException('Could not verify LibreSign webhook URL backup size'); + } + $output->info( + 'Legacy webhook URL saved to appdata_/libresign/' + . self::CONFIG_BACKUP . ' (may contain credentials; restrict access).', ); } From c01bf25540fa5b579561e9f573b78708c4f7a8cb Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Sat, 14 Nov 2026 23:34:34 +0000 Subject: [PATCH 09/11] test(migration): cover synchronous backup storage and truncation Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .../Version19005Date20261109110000Test.php | 126 +++++++++++++----- 1 file changed, 94 insertions(+), 32 deletions(-) diff --git a/tests/php/Unit/Migration/Version19005Date20261109110000Test.php b/tests/php/Unit/Migration/Version19005Date20261109110000Test.php index 345eca41fb..857b1061c5 100644 --- a/tests/php/Unit/Migration/Version19005Date20261109110000Test.php +++ b/tests/php/Unit/Migration/Version19005Date20261109110000Test.php @@ -56,31 +56,46 @@ public function testBacksUpOnlyConfiguredCallbacksBeforeDroppingColumn(): void { ['id' => '12', 'callback' => 'https://example.test/a?a=1,b=2'], ['id' => '47', 'callback' => 'https://example.test/ç?x="quoted"'], ]; - $path = tempnam(sys_get_temp_dir(), 'libresign-callback-test-'); - $this->assertNotFalse($path); + $csvContent = ''; + $file = $this->createMock(ISimpleFile::class); + $file->expects($this->never())->method('write'); + $file->method('getSize')->willReturnCallback(static function () use (&$csvContent): int { + return strlen($csvContent); + }); + $folder = $this->createMock(ISimpleFolder::class); + $folder->expects($this->once()) + ->method('newFile') + ->with( + 'backup-table-libresign_file_callback_Version19005Date20261109110000.csv', + $this->callback(static function ($stream) use (&$csvContent): bool { + if (!is_resource($stream)) { + return false; + } + $csvContent = stream_get_contents($stream); + return $csvContent !== false; + }), + )->willReturn($file); + $appData = $this->createMock(IAppData::class); + $appData->method('getFolder')->with('/')->willReturn($folder); + $factory = $this->createMock(IAppDataFactory::class); + $factory->method('get')->with(Application::APP_ID)->willReturn($appData); + $output = $this->createMock(IOutput::class); + $output->expects($this->once())->method('info') + ->with($this->stringContains('backup-table-libresign_file_callback_')); + $migration = $this->migration($this->createMock(IAppConfig::class), $factory, $this->connectionForRows($rows)); + $this->runPreSchema($migration, true, $output); + + $fp = fopen('php://temp', 'w+'); + $this->assertIsResource($fp); try { - $file = $this->createMock(ISimpleFile::class); - $file->method('write')->willReturnCallback(static fn () => fopen($path, 'wb')); - $folder = $this->createMock(ISimpleFolder::class); - $folder->expects($this->once()) - ->method('newFile') - ->with('backup-table-libresign_file_callback_Version19005Date20261109110000.csv') - ->willReturn($file); - $appData = $this->createMock(IAppData::class); - $appData->method('getFolder')->with('/')->willReturn($folder); - $factory = $this->createMock(IAppDataFactory::class); - $factory->method('get')->with(Application::APP_ID)->willReturn($appData); - $migration = $this->migration($this->createMock(IAppConfig::class), $factory, $this->connectionForRows($rows)); - $this->runPreSchema($migration, true); - - $fp = fopen($path, 'rb'); + fwrite($fp, $csvContent); + rewind($fp); $this->assertSame(['id', 'callback'], fgetcsv($fp, 0, ',', '"', '')); $this->assertSame(array_values($rows[0]), fgetcsv($fp, 0, ',', '"', '')); $this->assertSame(array_values($rows[1]), fgetcsv($fp, 0, ',', '"', '')); $this->assertFalse(fgetcsv($fp, 0, ',', '"', '')); - fclose($fp); } finally { - unlink($path); + fclose($fp); } } @@ -103,13 +118,37 @@ public function testCallbackBackupFailureStopsMigrationWithoutRemovingData(): vo $this->runPreSchema($migration, true); } + public function testTruncatedCallbackBackupAbortsMigration(): void { + $file = $this->createMock(ISimpleFile::class); + $file->method('getSize')->willReturn(1); + $folder = $this->createMock(ISimpleFolder::class); + $folder->expects($this->once())->method('newFile')->willReturn($file); + $appData = $this->createMock(IAppData::class); + $appData->method('getFolder')->willReturn($folder); + $factory = $this->createMock(IAppDataFactory::class); + $factory->method('get')->willReturn($appData); + $config = $this->createMock(IAppConfig::class); + $config->expects($this->never())->method('deleteKey'); + $output = $this->createMock(IOutput::class); + $output->expects($this->never())->method('info'); + $migration = $this->migration($config, $factory, $this->connectionForRows([ + ['id' => '4', 'callback' => 'https://example.test/callback'], + ])); + + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Could not verify LibreSign callback backup size'); + $this->runPreSchema($migration, true, $output); + } + public function testNoBackupFileWhenAllCallbacksAreEmpty(): void { $appData = $this->createMock(IAppData::class); $appData->expects($this->never())->method('getFolder'); $factory = $this->createMock(IAppDataFactory::class); $factory->method('get')->willReturn($appData); $migration = $this->migration($this->createMock(IAppConfig::class), $factory, $this->connectionForRows([])); - $this->runPreSchema($migration, true); + $output = $this->createMock(IOutput::class); + $output->expects($this->never())->method('info'); + $this->runPreSchema($migration, true, $output); } public function testBacksUpGlobalCallbackEvenWhenColumnIsAbsent(): void { @@ -117,18 +156,23 @@ public function testBacksUpGlobalCallbackEvenWhenColumnIsAbsent(): void { $config->method('getKeys')->willReturn(['webhook_sign_url']); $config->method('getValueString')->with(Application::APP_ID, 'webhook_sign_url') ->willReturn('https://example.test/callback?secret=abc'); + $expectedJson = "{\n \"webhook_sign_url\": \"https://example.test/callback?secret=abc\"\n}"; + $file = $this->createMock(ISimpleFile::class); + $file->method('getSize')->willReturn(strlen($expectedJson)); $folder = $this->createMock(ISimpleFolder::class); $folder->expects($this->once())->method('newFile') - ->with( - 'backup-config-webhook_sign_url_Version19005Date20261109110000.json', - "{\n \"webhook_sign_url\": \"https://example.test/callback?secret=abc\"\n}", - ); + ->with('backup-config-webhook_sign_url_Version19005Date20261109110000.json', $expectedJson) + ->willReturn($file); $appData = $this->createMock(IAppData::class); $appData->method('getFolder')->with('/')->willReturn($folder); $factory = $this->createMock(IAppDataFactory::class); $factory->method('get')->willReturn($appData); + $output = $this->createMock(IOutput::class); + $output->expects($this->once())->method('info')->with($this->callback(static function (string $message): bool { + return str_contains($message, 'backup-config-webhook_sign_url_') && !str_contains($message, 'secret=abc'); + })); - $this->runPreSchema($this->migration($config, $factory), false); + $this->runPreSchema($this->migration($config, $factory), false, $output); } public function testDoesNotDeleteConfigWhenBackupFails(): void { @@ -148,6 +192,25 @@ public function testDoesNotDeleteConfigWhenBackupFails(): void { $this->runPreSchema($this->migration($config, $factory), false); } + public function testTruncatedConfigBackupDoesNotDeleteLegacyValue(): void { + $config = $this->createMock(IAppConfig::class); + $config->method('getKeys')->willReturn(['webhook_sign_url']); + $config->method('getValueString')->willReturn('https://example.test/callback'); + $config->expects($this->never())->method('deleteKey'); + $file = $this->createMock(ISimpleFile::class); + $file->method('getSize')->willReturn(1); + $folder = $this->createMock(ISimpleFolder::class); + $folder->method('newFile')->willReturn($file); + $appData = $this->createMock(IAppData::class); + $appData->method('getFolder')->willReturn($folder); + $factory = $this->createMock(IAppDataFactory::class); + $factory->method('get')->willReturn($appData); + + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Could not verify LibreSign webhook URL backup size'); + $this->runPreSchema($this->migration($config, $factory), false); + } + public function testRemovesOnlyConfiguredLegacyWebhookUrl(): void { $config = $this->createMock(IAppConfig::class); $config->method('getKeys')->with(Application::APP_ID)->willReturn(['webhook_sign_url', 'signature_engine']); @@ -162,13 +225,13 @@ public function testLeavesConfigUntouchedWhenLegacyKeyIsMissing(): void { $this->migration($config)->postSchemaChange($this->createMock(IOutput::class), static fn (): ISchemaWrapper => throw new \LogicException('Schema unused'), []); } - private function runPreSchema(Version19005Date20261109110000 $migration, bool $columnExists): void { + private function runPreSchema(Version19005Date20261109110000 $migration, bool $columnExists, ?IOutput $output = null): void { $table = $this->createMock(ITable::class); $table->method('hasColumn')->with('callback')->willReturn($columnExists); $schema = $this->createMock(ISchemaWrapper::class); $schema->method('hasTable')->with('libresign_file')->willReturn(true); $schema->method('getTable')->willReturn($table); - $migration->preSchemaChange($this->createMock(IOutput::class), static fn (): ISchemaWrapper => $schema, []); + $migration->preSchemaChange($output ?? $this->createMock(IOutput::class), static fn (): ISchemaWrapper => $schema, []); } private function connectionForRows(array $rows): IDBConnection { @@ -176,17 +239,16 @@ private function connectionForRows(array $rows): IDBConnection { $result->method('fetchAssociative')->willReturnOnConsecutiveCalls(...[...$rows, false]); $result->expects($this->once())->method('closeCursor'); $expr = $this->createMock(IExpressionBuilder::class); - $expr->method('isNotNull')->willReturn('callback IS NOT NULL'); - $expr->method('neq')->willReturn('callback <> :empty'); + $expr->expects($this->once())->method('nonEmptyString')->with('callback') + ->willReturn('portable non-empty callback predicate'); $query = $this->createMock(IQueryBuilder::class); $query->expects($this->once())->method('select')->with('id', 'callback')->willReturnSelf(); - $query->expects($this->once())->method('where')->with('callback IS NOT NULL')->willReturnSelf(); - $query->expects($this->once())->method('andWhere')->with('callback <> :empty')->willReturnSelf(); + $query->expects($this->once())->method('where')->with('portable non-empty callback predicate')->willReturnSelf(); + $query->expects($this->never())->method('andWhere'); foreach (['from', 'orderBy'] as $method) { $query->method($method)->willReturnSelf(); } $query->method('expr')->willReturn($expr); - $query->method('createNamedParameter')->willReturn(':empty'); $query->method('executeQuery')->willReturn($result); $connection = $this->createMock(IDBConnection::class); $connection->method('getQueryBuilder')->willReturn($query); From 661fe46544eb795542a6a27af8219b6346848a1d Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Sat, 14 Nov 2026 23:34:52 +0000 Subject: [PATCH 10/11] fix: avoid double-closing callback backup stream Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- lib/Migration/Version19005Date20261109110000.php | 11 ++++++++--- .../Migration/Version19005Date20261109110000Test.php | 8 ++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/Migration/Version19005Date20261109110000.php b/lib/Migration/Version19005Date20261109110000.php index 9621e9ceb3..8c30f4e971 100644 --- a/lib/Migration/Version19005Date20261109110000.php +++ b/lib/Migration/Version19005Date20261109110000.php @@ -83,10 +83,15 @@ private function backupFileCallbacks(IOutput $output): void { throw new \RuntimeException('Could not prepare LibreSign callback backup for storage'); } - // Supplying the populated resource writes synchronously. In contrast, - // newFile() without content defers persistence until stream close. + $csv = stream_get_contents($handle); + if ($csv === false || strlen($csv) !== $bytes) { + throw new \RuntimeException('Could not read LibreSign callback backup buffer'); + } + + // Nextcloud closes resources passed to newFile(); pass a string instead + // so this method retains ownership of the buffer until finally. $folder = $this->appData->getFolder('/'); - $file = $folder->newFile(self::FILE_BACKUP, $handle); + $file = $folder->newFile(self::FILE_BACKUP, $csv); if ($file->getSize() != $bytes) { throw new \RuntimeException('Could not verify LibreSign callback backup size'); } diff --git a/tests/php/Unit/Migration/Version19005Date20261109110000Test.php b/tests/php/Unit/Migration/Version19005Date20261109110000Test.php index 857b1061c5..0830aecec8 100644 --- a/tests/php/Unit/Migration/Version19005Date20261109110000Test.php +++ b/tests/php/Unit/Migration/Version19005Date20261109110000Test.php @@ -67,12 +67,12 @@ public function testBacksUpOnlyConfiguredCallbacksBeforeDroppingColumn(): void { ->method('newFile') ->with( 'backup-table-libresign_file_callback_Version19005Date20261109110000.csv', - $this->callback(static function ($stream) use (&$csvContent): bool { - if (!is_resource($stream)) { + $this->callback(static function ($content) use (&$csvContent): bool { + if (!is_string($content)) { return false; } - $csvContent = stream_get_contents($stream); - return $csvContent !== false; + $csvContent = $content; + return true; }), )->willReturn($file); $appData = $this->createMock(IAppData::class); From 70ae26b4bb421be6223038496eab7eb3600de74f Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Sat, 14 Nov 2026 23:37:15 +0000 Subject: [PATCH 11/11] chore(openapi): regenerate callback-free API contracts on current main Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- openapi-full.json | 11 ----------- openapi.json | 11 ----------- src/types/openapi/openapi-full.ts | 6 ------ src/types/openapi/openapi.ts | 6 ------ 4 files changed, 34 deletions(-) diff --git a/openapi-full.json b/openapi-full.json index a1af7f85f0..c7c79e3450 100644 --- a/openapi-full.json +++ b/openapi-full.json @@ -1238,7 +1238,6 @@ "statusText", "created_at", "file", - "callback", "uuid", "signers" ], @@ -1291,10 +1290,6 @@ } } }, - "callback": { - "type": "string", - "nullable": true - }, "uuid": { "type": "string" }, @@ -12281,12 +12276,6 @@ "$ref": "#/components/schemas/NewFile" } }, - "callback": { - "type": "string", - "nullable": true, - "default": null, - "description": "URL that will receive a POST after the document is signed" - }, "status": { "type": "integer", "format": "int64", diff --git a/openapi.json b/openapi.json index f52dbe1baa..6b4e635e67 100644 --- a/openapi.json +++ b/openapi.json @@ -911,7 +911,6 @@ "statusText", "created_at", "file", - "callback", "uuid", "signers" ], @@ -964,10 +963,6 @@ } } }, - "callback": { - "type": "string", - "nullable": true - }, "uuid": { "type": "string" }, @@ -11544,12 +11539,6 @@ "$ref": "#/components/schemas/NewFile" } }, - "callback": { - "type": "string", - "nullable": true, - "default": null, - "description": "URL that will receive a POST after the document is signed" - }, "status": { "type": "integer", "format": "int64", diff --git a/src/types/openapi/openapi-full.ts b/src/types/openapi/openapi-full.ts index c2cde313ad..a37db13462 100644 --- a/src/types/openapi/openapi-full.ts +++ b/src/types/openapi/openapi-full.ts @@ -1701,7 +1701,6 @@ export type components = { signedNodeId: number; url: string; }; - callback: string | null; uuid: string; signers: components["schemas"]["SignerDetail"][]; }; @@ -5987,11 +5986,6 @@ export interface operations { * @default [] */ files?: components["schemas"]["NewFile"][]; - /** - * @description URL that will receive a POST after the document is signed - * @default null - */ - callback?: string | null; /** * Format: int64 * @description Numeric code of status * 0 - no signers * 1 - signed * 2 - pending diff --git a/src/types/openapi/openapi.ts b/src/types/openapi/openapi.ts index 095259b876..9fd7aa8f47 100644 --- a/src/types/openapi/openapi.ts +++ b/src/types/openapi/openapi.ts @@ -1287,7 +1287,6 @@ export type components = { signedNodeId: number; url: string; }; - callback: string | null; uuid: string; signers: components["schemas"]["SignerDetail"][]; }; @@ -5425,11 +5424,6 @@ export interface operations { * @default [] */ files?: components["schemas"]["NewFile"][]; - /** - * @description URL that will receive a POST after the document is signed - * @default null - */ - callback?: string | null; /** * Format: int64 * @description Numeric code of status * 0 - no signers * 1 - signed * 2 - pending