Repository navigation
fix(validation): base the validation summary on applied signatures only - #9009
maia-andre wants to merge 2 commits into
Conversation
The validation page showed "This document is valid" for a document that nobody has signed yet, and for an envelope where nobody signed. The summary only returned "No digital signatures were found in this document" when the signer list was empty; a pending signer carries no signature data, so none of the error or warning checks matched and the summary fell through to "valid". The summary now considers only the signers who have signed (a signing date or signature validation data). When nobody has signed, it shows the existing "No digital signatures were found" note; otherwise the current checks run on the signed signers only. Fixes LibreSign#8967 Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: André Maia <andrefnkmm@gmail.com>
| } | ||
|
|
||
| function hasAppliedSignature(signer: ValidationDisplaySigner) { | ||
| return Boolean(signer.signed) || signer.signature_validation !== undefined |
There was a problem hiding this comment.
hasAppliedSignature doesn't consider status, but isCurrentSignerSigned (line 1064) does: !!signer?.signed || Number(signer?.status) === SIGN_REQUEST_STATUS.SIGNED.
CertificateSignersMergeService sets status = 2 on every signer read from the PDF (line 195), even when the signature has no signingTime and no certificate chain could be extracted (then there is no signature_validation either). In that case the summary says "No digital signatures were found" while the signer list below shows the signer as signed.
Could you include the status in the predicate, so the file uses a single definition of "signed"?
function hasAppliedSignature(signer: ValidationDisplaySigner) {
return Boolean(signer.signed)
|| Number(signer.status) === SIGN_REQUEST_STATUS.SIGNED
|| signer.signature_validation !== undefined
}And please add a test with { status: 2 } (no signed, no signature_validation) to cover it.
There was a problem hiding this comment.
Thanks @YvesCesar, confirmed: CertificateSignersMergeService sets status = 2 for every signer read from the PDF, so a signature without signingTime or an extractable chain was dropped from the summary. In d02d24b hasAppliedSignature now also accepts Number(signer.status) === SIGN_REQUEST_STATUS.SIGNED, matching isCurrentSignerSigned, and I added a { status: 2 } case (no signed, no signature_validation) to the summary tests.
|
|
||
| function getDocumentValidationSummary(validationDocument: ValidationDocumentState): DocumentValidationSummary { | ||
| const signers = getValidationDocumentSigners(validationDocument) | ||
| // Pending signers carry no signature data, so they must not count towards a "valid" verdict |
There was a problem hiding this comment.
Could you drop this comment? There are no other inline comments in this file, and the function name plus the PR description already explain the intent.
…e summary Signed-off-by: André Maia <andrefnkmm@gmail.com>
Resolves: #8967
📝 Summary
The validation page showed "This document is valid" for a document nobody has signed yet, and for an envelope where nobody signed.
getDocumentValidationSummary()insrc/views/Validation.vueonly returned "No digital signatures were found in this document" when the signer list was empty. A pending signer carries nosignature_validation,modification_validationordocument_modification_state, so none of the error or warning checks matched and the summary fell through to "valid".The summary now considers only the signers who have signed, meaning a signer with a signing date or with signature validation data:
The same function feeds the header note for single files and envelopes, so both are covered. No new strings.
🧪 How to test
/apps/libresign/p/validation/<uuid>(logged out is fine).🎨 UI changes
Signed document, unchanged:
Vitest cases in
src/tests/views/Validation.spec.ts: nobody signed, envelope where nobody signed, only signed signers are evaluated, and a signer with a signing date but no cryptographic details. Local runs:npx vitest run src/tests/views/Validation.spec.ts src/tests/views/DocumentValidationLogic.spec.ts(116 passed),npm run ts:check, eslint on the changed files.Backport
The same logic is on
stable33,stable34andstable35, and the commit cherry-picks cleanly onto them.stable32has older code that sets "This document is valid" unconditionally, so this change does not apply there as is.✅ Checklist
🤖 AI (if applicable)