Bug 134041 - "X-WOPI-Proof" generation.
Summary: "X-WOPI-Proof" generation.
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice Online
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.1.0
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-16 13:46 UTC by Damian
Modified: 2020-07-02 10:48 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Damian 2020-06-16 13:46:02 UTC
I think that there is a problem with generating "X-WOPI-Proof" header. It works fine only for the 1st request. Then, it keeps returning the same value each time. I managed to solve it by tweaking the SignProof method (wsd/ProofKey.cpp):

std::string Proof::SignProof(const std::vectorchar>& proof) const
{
    assert(m_pKey);
    static Poco::Crypto::RSADigestEngine digestEngine(*m_pKey, "SHA256");
    digestEngine.reset(); #this line fixed the issue
    digestEngine.update(proof.data(), proof.size()); 
    return BytesToBase64(digestEngine.signature());
} 

I'm unsure if fully understand wopi proof key docs, so instead of creating a merge request, I submit this bug.
Comment 1 Mike Kaganski 2020-06-22 17:51:35 UTC
@Damian: nice catch!

Please file a license statement as per https://wiki.documentfoundation.org/Development/GetInvolved#License_statement. I will prepare the patch for you. Thank you very much for your contribution!
Comment 2 Mike Kaganski 2020-06-22 18:38:17 UTC
https://gerrit.libreoffice.org/c/online/+/96899
Comment 3 Commit Notification 2020-06-23 10:33:16 UTC
Damian committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/online/commit/f160ccf80d46fda857a7cd4d87c036f61ef9df74

tdf#134041: reset engine before next digest computation
Comment 4 Mike Kaganski 2020-06-23 10:37:12 UTC
Damian: thank you!
Comment 5 Commit Notification 2020-07-02 10:48:42 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/online/commit/04709ab7fc37f25b33be54c84fc262bc8e79e646

tdf#134041: add a unit test