Fix WOPI proof key signing failure#182
Open
delmarguillen wants to merge 1 commit into
Open
Conversation
Author
This was referenced Jun 14, 2026
this doesn't make sense to me. i would have thought the patch by @tiran133 was a proper fix instead. the existing algorithm has been in use since onlyoffice. the root problem being that jq args will treat \n literally and then escape it result in an invalid key. @filerun analysis in #177 is also correct. |
Author
|
Thanks for pointing that out. I updated the PR with the proper fix from #127, the actual issue is the awk line double-escaping newlines before jq handles them. |
The awk command on line 146 flattens the PEM private key by replacing real newlines with literal \n characters. When jq --arg receives this, it treats \n as literal text and escapes it again. The resulting key in local.json has no real newlines, which OpenSSL cannot decode. Replace awk with cat so jq --arg receives the raw PEM with real newlines and encodes them correctly in JSON. Credit to @tiran133 for identifying the fix in Euro-Office#127. Signed-off-by: delmarguillen <168364803+delmarguillen@users.noreply.github.com>
09f9870 to
d810293
Compare
Author
|
Tested the updated fix on a VPS (x86_64, Ubuntu 24.04) and it works correctly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
awkcommand on line 146 ofentrypoint.shflattens the PEM private key by replacing real newlines with literal\ncharacters:WOPI_PRIVATE_KEY_DATA=$(awk '{printf %s\\n, $0}' $WOPI_PRIVATE_KEY)When
jq --argreceives this, it treats\nas literal text and escapes it again. The resulting key inlocal.jsonhas no real newlines, which OpenSSL cannot decode:This breaks any WOPI integration that requires proof key verification. Tested on both x86_64 and ARM64.
Fix
Replace
awkwithcatsojq --argreceives the raw PEM with real newlines and encodes them correctly in JSON.One line change. Credit to @tiran133 for identifying the fix in #127.
How I found this
I built an integration of Euro-Office with ownCloud OCIS (repo). The WOPI
checkFileInfocall failed on every document open.Tested on
ghcr.io/euro-office/documentserver:latest)