From 0859017305d53647205abf9869c4909b0868aea0 Mon Sep 17 00:00:00 2001 From: Vasil Danielov Pashov Date: Wed, 17 Apr 2024 13:07:38 +0300 Subject: [PATCH 1/3] [maint] Remove CMake which is not used (#1488) Remove CMake clang preset as it's not used by CI and it's better to hande it via CMakeUserPresets #### Reference Issues/PRs #### What does this implement or fix? #### Any other comments? #### Checklist
Checklist for code changes... - [ ] Have you updated the relevant docstrings, documentation and copyright notice? - [ ] Is this contribution tested against [all ArcticDB's features](../docs/mkdocs/docs/technical/contributing.md)? - [ ] Do all exceptions introduced raise appropriate [error messages](https://docs.arcticdb.io/error_messages/)? - [ ] Are API changes highlighted in the PR description? - [ ] Is the PR labelled as enhancement or bug so it appears in autogenerated release notes?
Co-authored-by: Vasil Pashov --- cpp/CMakePresets.json | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/cpp/CMakePresets.json b/cpp/CMakePresets.json index 005e3b16be..c2f12e6e55 100644 --- a/cpp/CMakePresets.json +++ b/cpp/CMakePresets.json @@ -112,15 +112,6 @@ "name": "linux-debug", "inherits": ["common_vcpkg", "linux"] }, - { - "name": "linux-debug-clang", - "inherits": ["common_vcpkg", "linux"], - "cacheVariables": { - "CMAKE_C_COMPILER": "clang", - "CMAKE_CXX_COMPILER": "clang++", - "STATIC_LINK_STD_LIB": "OFF" - } - }, { "name": "linux-conda-debug", "inherits": ["common_conda", "linux"] @@ -155,7 +146,6 @@ {"name": "windows-cl-conda-debug", "configurePreset": "windows-cl-conda-debug", "targets": "arcticdb_ext" }, {"name": "windows-cl-conda-release", "configurePreset": "windows-cl-conda-release", "targets": "arcticdb_ext" }, {"name": "linux-debug", "configurePreset": "linux-debug", "targets": "arcticdb_ext" }, - {"name": "linux-debug-clang", "configurePreset": "linux-debug-clang", "targets": "arcticdb_ext" }, {"name": "linux-release", "configurePreset": "linux-release", "targets": "arcticdb_ext" }, {"name": "linux-conda-debug", "configurePreset": "linux-conda-debug", "targets": "arcticdb_ext" }, {"name": "linux-conda-release", "configurePreset": "linux-conda-release", "targets": "arcticdb_ext" }, From 3b52859074ae74ff91271e9373d0621888525ba4 Mon Sep 17 00:00:00 2001 From: Artem Maslov Date: Wed, 10 Apr 2024 14:23:28 +0300 Subject: [PATCH 2/3] fix: updated __repr__ to hide account key for AzureLibraryAdapter Update __repr__ to censor sensitive information. Signed-Off By Artem Maslov maslovartem2012@gmail.com. By including this sign-off line I agree to the terms of the Contributor License Agreement --- python/arcticdb/adapters/azure_library_adapter.py | 3 ++- python/tests/integration/arcticdb/test_arctic.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/python/arcticdb/adapters/azure_library_adapter.py b/python/arcticdb/adapters/azure_library_adapter.py index 1f14717953..05d1eee07e 100644 --- a/python/arcticdb/adapters/azure_library_adapter.py +++ b/python/arcticdb/adapters/azure_library_adapter.py @@ -62,7 +62,8 @@ def __init__(self, uri: str, encoding_version: EncodingVersion, *args, **kwargs) super().__init__(uri, self._encoding_version) def __repr__(self): - return "azure(endpoint=%s, container=%s)" % (self._endpoint, self._container) + censored_endpoint = re.sub(r"AccountKey=.+?;", "AccountKey=...;", self._endpoint) + return "azure(endpoint=%s, container=%s)" % (censored_endpoint, self._container) @property def config_library(self): diff --git a/python/tests/integration/arcticdb/test_arctic.py b/python/tests/integration/arcticdb/test_arctic.py index b5a9703409..5feb38e09d 100644 --- a/python/tests/integration/arcticdb/test_arctic.py +++ b/python/tests/integration/arcticdb/test_arctic.py @@ -351,6 +351,12 @@ def test_delete_date_range(arctic_library): assert lib["symbol"].version == 1 +def test_azure_repr_body_censored(arctic_library): + ac_library_repr = repr(arctic_library) + if "AccountKey=" in ac_library_repr: + assert "AccountKey=..." in ac_library_repr.split(";") + + def _test_mongo_repr_body(mongo_storage: MongoDatabase): # The arctic_uri has the PrefixingLibraryAdapterDecorator logic in it, so use mongo_uri ac = Arctic(f"{mongo_storage.mongo_uri}/?maxPoolSize=10") From 2799e94afe9ff91acb5e053eb95fb7ff2dba934c Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Sajjad <45758804+muhammadhamzasajjad@users.noreply.github.com> Date: Thu, 18 Apr 2024 10:54:15 +0100 Subject: [PATCH 3/3] bugfix/1247:address comments in #1481 (#1503) #### Reference Issues/PRs Addresses @alexowens90's comments in #1481 after that PR was merged. #### What does this implement or fix? #### Any other comments? #### Checklist
Checklist for code changes... - [ ] Have you updated the relevant docstrings, documentation and copyright notice? - [ ] Is this contribution tested against [all ArcticDB's features](../docs/mkdocs/docs/technical/contributing.md)? - [ ] Do all exceptions introduced raise appropriate [error messages](https://docs.arcticdb.io/error_messages/)? - [ ] Are API changes highlighted in the PR description? - [ ] Is the PR labelled as enhancement or bug so it appears in autogenerated release notes?
--- cpp/arcticdb/storage/lmdb/lmdb_storage.cpp | 7 ++++--- cpp/arcticdb/util/name_validation.cpp | 11 +++++------ python/tests/integration/arcticdb/test_lmdb.py | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cpp/arcticdb/storage/lmdb/lmdb_storage.cpp b/cpp/arcticdb/storage/lmdb/lmdb_storage.cpp index db1879cd2a..fa1f3c568d 100644 --- a/cpp/arcticdb/storage/lmdb/lmdb_storage.cpp +++ b/cpp/arcticdb/storage/lmdb/lmdb_storage.cpp @@ -259,8 +259,11 @@ void LmdbStorage::do_iterate_type(KeyType key_type, const IterateTypeVisitor& vi } } -bool LmdbStorage::do_is_path_valid(const std::string_view pathString) const { +bool LmdbStorage::do_is_path_valid(const std::string_view pathString ARCTICDB_UNUSED) const { #ifdef _WIN32 + // Note that \ and / are valid characters as they will create subdirectories which are expected to work. + // The filenames such as COM1, LPT1, AUX, CON etc. are reserved but not strictly disallowed by Windows as directory names. + // Therefore, paths with these names are allowed. std::string_view invalid_win32_chars = "<>:\"|?*"; auto found = pathString.find_first_of(invalid_win32_chars); if (found != std::string::npos) { @@ -270,8 +273,6 @@ bool LmdbStorage::do_is_path_valid(const std::string_view pathString) const { if (!pathString.empty() && (pathString.back() == '.' || std::isspace(pathString.back()))) { return false; } -#else - (void) pathString; // suppress -Werror=unused-parameter #endif return true; } diff --git a/cpp/arcticdb/util/name_validation.cpp b/cpp/arcticdb/util/name_validation.cpp index b066b97595..d6765c50c3 100644 --- a/cpp/arcticdb/util/name_validation.cpp +++ b/cpp/arcticdb/util/name_validation.cpp @@ -121,12 +121,11 @@ void verify_library_path_part(const std::string& library_part, char delim) { void verify_library_path_on_write(const Store* store, const StringId& library_path) { verify_name("library name", library_path, true, UNSUPPORTED_S3_CHARS); - if(!store->is_path_valid(library_path)) { - user_input::raise( - "The library name contains unsupported chars. Library Name: {}", - library_path - ); - } + user_input::check( + store->is_path_valid(library_path), + "The library name contains unsupported chars. Library Name: {}", + library_path + ); } } \ No newline at end of file diff --git a/python/tests/integration/arcticdb/test_lmdb.py b/python/tests/integration/arcticdb/test_lmdb.py index aebf42ad97..f8761795f0 100644 --- a/python/tests/integration/arcticdb/test_lmdb.py +++ b/python/tests/integration/arcticdb/test_lmdb.py @@ -103,7 +103,7 @@ def test_lmdb_malloc_trim(lmdb_storage): lib._nvs.trim() @pytest.mark.skipif(sys.platform != "win32", reason="Non Windows platforms have different file path name restrictions") -@pytest.mark.parametrize("invalid_lib_name", ["lib?1", "lib:1", "lib|1", "lib.", "lib "]) +@pytest.mark.parametrize("invalid_lib_name", ["lib?1", "lib:1", "lib|1", "lib\"1", "lib.", "lib "]) def test_invalid_lmdb_lib_name_windows(lmdb_storage, invalid_lib_name): ac = lmdb_storage.create_arctic() with pytest.raises(UserInputException) as e: