aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp/auth/authmgr.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-09-04 13:17:25 +0200
committerGitHub Enterprise <[email protected]>2025-09-04 13:17:25 +0200
commit9f575bd416e1f7afbd11d4b221074f34bb89605c (patch)
tree07c87ccdbc01cdaf13015f46dddfaa71fa791d5b /src/zenhttp/auth/authmgr.cpp
parentoplog memory usage reduction (#482) (diff)
downloadzen-9f575bd416e1f7afbd11d4b221074f34bb89605c.tar.xz
zen-9f575bd416e1f7afbd11d4b221074f34bb89605c.zip
add validation of compact binary payloads before reading them (#483)
* add validation of compact binary payloads before reading them
Diffstat (limited to 'src/zenhttp/auth/authmgr.cpp')
-rw-r--r--src/zenhttp/auth/authmgr.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/zenhttp/auth/authmgr.cpp b/src/zenhttp/auth/authmgr.cpp
index 6c1a66a99..209276621 100644
--- a/src/zenhttp/auth/authmgr.cpp
+++ b/src/zenhttp/auth/authmgr.cpp
@@ -5,7 +5,7 @@
#include <zencore/basicfile.h>
#include <zencore/compactbinary.h>
#include <zencore/compactbinarybuilder.h>
-#include <zencore/compactbinaryvalidation.h>
+#include <zencore/compactbinaryutil.h>
#include <zencore/crypto.h>
#include <zencore/filesystem.h>
#include <zencore/logging.h>
@@ -297,15 +297,14 @@ private:
return;
}
- const CbValidateError ValidationError = ValidateCompactBinary(Buffer, CbValidateMode::All);
-
- if (ValidationError != CbValidateError::None)
+ CbValidateError ValidationError;
+ if (CbObject AuthState = ValidateAndReadCompactBinaryObject(std::move(Buffer), ValidationError);
+ ValidationError != CbValidateError::None)
{
- ZEN_WARN("load serialized state FAILED, reason 'Invalid compact binary'");
+ ZEN_WARN("load serialized state FAILED, reason '{}'", ToString(ValidationError));
return;
}
-
- if (CbObject AuthState = LoadCompactBinaryObject(Buffer))
+ else
{
for (CbFieldView ProviderView : AuthState["OpenIdProviders"sv])
{