Repository navigation
fix(security): hardening fixes from upstream 9.4 - #546
Open
juliusknorr wants to merge 12 commits into
Open
juliusknorr wants to merge 12 commits into
juliusknorr wants to merge 12 commits into
Conversation
GenerateGuid and GenerateInt now read from a mutex-guarded CryptoPP AutoSeededRandomPool instead of rand() seeded with time(). Each GUID group now takes 16 random bits instead of 8. Upstream-Subject: fix bug #81148 (cherry picked from commit d9d7ffe) Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: ClaudeCode:claude-opus-5-5
StarMath2OOXML builds Unit.cpp, which now needs CryptoPP. Follow-up to fix(ooxml): generate GUIDs and random ids from a CSPRNG Upstream-Subject: Fix build (cherry picked from commit c03fd25) Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: ClaudeCode:claude-opus-5-5
Compare lPosInCtlStm and cbBufInCtlStm one at a time against the control stream size before the control data is written, instead of comparing their sum. Upstream-Subject: fix bug #81040 (cherry picked from commit bd3dd15) Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: ClaudeCode:claude-opus-5-5
Build the CryptoPP headers without inline assembly in the projects that compile Unit.cpp. Follow-up to fix(ooxml): generate GUIDs and random ids from a CSPRNG Upstream-Subject: fix bug #81216 (cherry picked from commit 99b31a4) Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: ClaudeCode:claude-opus-5-5
Write the person userId attribute XML-escaped, like displayName and providerId already are. Upstream-Subject: fix bug #81241 (cherry picked from commit 2deb6b8) Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: ClaudeCode:claude-opus-5-5
FontOTWriter's Type 2 charstring random operator now reads from a mutex-guarded CryptoPP pool instead of rand(). Upstream-Subject: Fix bug 81148 (cherry picked from commit 2761614) Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: ClaudeCode:claude-opus-5-5
CreateTempFileWithUniqueName lets the UTF-8 converter allocate the mkstemp template instead of using a fixed MAX_PATH buffer, and returns an empty string when the name can't be built or GetTempFileNameW fails. Upstream-Subject: Fix bug 81149 (cherry picked from commit 5b15d9b) Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: ClaudeCode:claude-opus-5-5
Add OOXML/Base/Rand.h with SecureRandomBytes and RandUInt (BCryptGenRandom or RtlGenRandom, SecRandomCopyBytes, getrandom, then /dev/urandom and std::random_device). Unit.cpp uses RandUInt and drops the CryptoPP pool and the old Rand() helper. Follow-up to fix(ooxml): generate GUIDs and random ids from a CSPRNG Conflict: OOXML/Base/Unit.cpp: took upstream's removal of Rand() and Rand1() over our nullptr cleanup Upstream-Subject: Add security rand function (cherry picked from commit 71a8a22) Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: ClaudeCode:claude-opus-5-5
juliusknorr
marked this pull request as ready for review
December 4, 2026 22:35
juliusknorr
requested review from
Aiiaiiio,
OlhaUshkalenko and
chrip
and removed request for
a team
December 4, 2026 22:35
Upstream added Rand.h after 9.3, so the licence branch removed it and the pick above brought it back without a header. Apply the Rand.h hunk of upstream's header commit. OOXML/Base/Rand.h only Upstream-Subject: [copyright] Update copyright header (cherry picked from commit 76ee07f) Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: ClaudeCode:claude-opus-5-5
Replace the local CryptoPP pool in FontOTWriter with RandUInt from OOXML/Base/Rand.h. Follow-up to fix(pdf): take the CFF random operator value from a CSPRNG Upstream-Subject: Fixes with rand (cherry picked from commit dfe6d30) Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: ClaudeCode:claude-opus-5-5
Link Security into StarMath2OOXML, PdfFile and x2t on mac and iOS for SecRandomCopyBytes, drop the CryptoPP link and define from StarMath2OOXML, and move the Rand.h include and the generators to the end of Unit.cpp. Follow-up to refactor(ooxml): use OS random sources instead of CryptoPP Upstream-Subject: Fix mac|ios build (cherry picked from commit 6a45740) Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: ClaudeCode:claude-opus-5-5
Unit.cpp no longer defines Rand() and nothing calls it. Unit.h gets our modification notice. Follow-up to refactor(ooxml): use OS random sources instead of CryptoPP Signed-off-by: Julius Knorr <jus@bitgrid.net> Assisted-by: ClaudeCode:claude-opus-5-5 No-test: removes an unused declaration, the CI build covers it
juliusknorr
force-pushed
the
upstream-9.4/b1-hardening
branch
from
December 6, 2026 16:56
9c50f78 to
bb56c6d
Compare
This branch was successfully deployed
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.
Brings 10 hardening fixes from ONLYOFFICE/core
upstream/v9.3.1..upstream/v9.4.0(upstream commits from 2026-04-21 to 2026-04-28), picked 1:1 with-x. GUIDs and random ids in OOXML output and the CFF writer now come from the OS random source (newOOXML/Base/Rand.h); XLS ActiveX control data, threaded commentuserIdand temp file names get stricter handling. Two own commits: upstream's header forRand.h(added upstream after 9.3) and dropping the now unusedXmlUtils::Rand()declaration.Unit.cpp: took upstream's removal ofRand()/Rand1()Not picked: 8c2c4060a7 (font thumbnail run limit), already covered by our a045fc5 (#443).
Worth a look:
build(mac)the picks include upstream'sCommon/3dParty/cryptopp/osrng.hpath, which our layout doesn't have. Skip this range when bisecting; merge with rebase, not squashrandomoperator:(RandUInt() + 1) / (RAND_MAX + 1)gives (0, 2] on Linux/mac instead of (0, 1], same as upstream. The value is not written to the outputRandUInt()returns 0 if every random source fails, without an errorCRYPTOPP_DISABLE_ASMstays inOFDFile.proandDocxFormatLib.pro, unused after the switch toRand.hUnit.hgets our notice for a one-line removal; upstream still declaresRand()in 10.0Land before the core pin bumps in DocumentServer and DesktopEditors.
Tests: no new tests (
no-tests-needed): 1:1 upstream picks, tests come with upstream or not at all. Checked on macOS: touched files compile (-fsyntax-only,_MAC),Rand.hsmoke run, 20k GUIDs use 16-bit groups, an 1100-char temp folder no longer overruns the name buffer. Header gate passes on main and on the head. Full builds and ctest in CI.AI-assisted, see Assisted-by trailer.