pjfanning opened a new pull request, #1477:
URL: https://github.com/apache/poi/pull/1477

   Follow-up to #1472.
   
   - **Result:** when a part's content type differs from the one a signature 
reference was made for, `verifySignature()` threw an 
`EncryptedDocumentException`. Its documented contract is to return whether the 
signature is valid, and other changes made after signing return false. It now 
returns false too, and the mismatch is logged as a warning.
   - **How:** `OOXMLURIDereferencer` throws a package-private 
`URIReferenceException` subclass, `ContentTypeMismatchException`. 
`SignaturePart.validate()` finds it in the cause chain of the 
`XMLSignatureException`. Other dereferencing errors still throw, as before.
   - **Tests:** `contentTypeChangeInvalidatesSignature` now asserts the false 
result instead of a particular exception cause chain. The zip rewriting is 
shared through a `rewriteSignedDocx` helper, which `modifySignedDocx` also uses 
now.
   - **Comment:** the dereferencer comment now says the content type is 
expected as the only query parameter.
   
   The `dsig` tests pass locally, and the content type test fails without the 
change.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to