diff --git a/openframe/openframe_encryption_service.h b/openframe/openframe_encryption_service.h index d37760ab918..25603a3c369 100644 --- a/openframe/openframe_encryption_service.h +++ b/openframe/openframe_encryption_service.h @@ -1,3 +1,12 @@ +/** + * Copyright (c) 2014-present, The osquery authors + * + * This source code is licensed as defined by the LICENSE file found in the + * root directory of this source tree. + * + * SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only) + */ + #pragma once #include @@ -6,7 +15,10 @@ #include #include #include -#include + +#include + +namespace osquery { class OpenframeEncryptionService { public: @@ -16,19 +28,22 @@ class OpenframeEncryptionService { /** * Decrypts data using AES-GCM * @param data Base64 encoded encrypted data - * @return Decrypted data as string - * @throws std::runtime_error if decryption fails + * @param decrypted Output parameter for the decrypted data + * @return Status::success() on success, or an error Status describing + * the failure reason */ - std::string decrypt(const std::string& data); + Status decrypt(const std::string& data, std::string& decrypted); std::vector base64Decode(const std::string& encoded); private: - static constexpr size_t KEY_SIZE = 32; // 256 bits - static constexpr size_t IV_SIZE = 12; // 96 bits for GCM - static constexpr size_t TAG_SIZE = 16; // 128 bits for GCM + static constexpr size_t kKeySize = 32; // 256 bits + static constexpr size_t kIvSize = 12; // 96 bits for GCM + static constexpr size_t kTagSize = 16; // 128 bits for GCM void handleOpenSSLError(); std::string secret_; -}; \ No newline at end of file +}; + +} // namespace osquery diff --git a/openframe/openframe_token_refresher.cpp b/openframe/openframe_token_refresher.cpp index 6e3cf8def86..01e7a4623e4 100644 --- a/openframe/openframe_token_refresher.cpp +++ b/openframe/openframe_token_refresher.cpp @@ -1,3 +1,12 @@ +/** + * Copyright (c) 2014-present, The osquery authors + * + * This source code is licensed as defined by the LICENSE file found in the + * root directory of this source tree. + * + * SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only) + */ + #include "openframe_token_refresher.h" #include "openframe_authorization_manager_provider.h" @@ -68,4 +77,4 @@ void OpenframeTokenRefresher::process() { } } -} // namespace osquery \ No newline at end of file +} // namespace osquery diff --git a/openframe/openframe_token_refresher.h b/openframe/openframe_token_refresher.h index cced8ac5652..764670be2ca 100644 --- a/openframe/openframe_token_refresher.h +++ b/openframe/openframe_token_refresher.h @@ -1,3 +1,12 @@ +/** + * Copyright (c) 2014-present, The osquery authors + * + * This source code is licensed as defined by the LICENSE file found in the + * root directory of this source tree. + * + * SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only) + */ + #pragma once #include @@ -30,4 +39,4 @@ class OpenframeTokenRefresher { std::shared_ptr extractor_; }; -} // namespace osquery \ No newline at end of file +} // namespace osquery diff --git a/tests/integration/tables/extended_attributes.cpp b/tests/integration/tables/extended_attributes.cpp index c55646b9f14..a3eb0b7dba2 100644 --- a/tests/integration/tables/extended_attributes.cpp +++ b/tests/integration/tables/extended_attributes.cpp @@ -27,21 +27,19 @@ TEST_F(extendedAttributes, test_sanity) { auto const data = execute_query("select * from extended_attributes where path = ''"); // 2. Check size before validation - // ASSERT_GE(data.size(), 0ul); - // ASSERT_EQ(data.size(), 1ul); - // ASSERT_EQ(data.size(), 0ul); + ASSERT_EQ(data.size(), 0ul); // 3. Build validation map // See helper.h for available flags // Or use custom DataCheck object - // ValidationMap row_map = { - // {"path", NormalType} - // {"directory", NormalType} - // {"key", NormalType} - // {"value", NormalType} - // {"base64", IntType} - //} + ValidationMap row_map = { + {"path", NormalType}, + {"directory", NormalType}, + {"key", NormalType}, + {"value", NormalType}, + {"base64", IntType}, + }; // 4. Perform validation - // validate_rows(data, row_map); + validate_rows(data, row_map); } } // namespace table_tests