Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0394707
WIP
marcocapozzoli Aug 6, 2026
5957630
Merge branch 'masc/1177-atomdb-auth-a' into masc/1177-atomdb-auth-b
marcocapozzoli Aug 6, 2026
92e65cc
implement wrap_is_protected()
marcocapozzoli Aug 6, 2026
a3be60c
Add tests
marcocapozzoli Aug 6, 2026
c9a62f3
add get_backend()
marcocapozzoli Aug 6, 2026
10fa4a1
Merge branch 'masc/1177-atomdb-auth-a' into masc/1177-atomdb-auth-b
marcocapozzoli Aug 6, 2026
604ed25
Remove get_backend()
marcocapozzoli Aug 6, 2026
3b0f08e
Merge branch 'masc/1177-atomdb-auth-a' into masc/1177-atomdb-auth-b
marcocapozzoli Aug 6, 2026
6a4a105
Merge branch 'masc/1177-atomdb-auth-a' into masc/1177-atomdb-auth-b
marcocapozzoli Aug 10, 2026
f205cad
move ProtectedAtomDB
marcocapozzoli Aug 10, 2026
5faaf4c
Merge branch 'masc/1177-atomdb-auth-a' into masc/1177-atomdb-auth-b
marcocapozzoli Aug 11, 2026
1d069b1
fix BUILD
marcocapozzoli Aug 11, 2026
b4c2a49
Add RemoteAtomDB::is_protected()
marcocapozzoli Aug 11, 2026
d193e6d
Merge branch 'masc/1177-atomdb-auth-a' into masc/1177-atomdb-auth-b
marcocapozzoli Aug 11, 2026
ae514ef
Merge branch 'masc/1177-atomdb-auth-a' into masc/1177-atomdb-auth-b
marcocapozzoli Aug 11, 2026
78a4374
Change AtomDB::is_protected() to return ProtectionMode and replace st…
marcocapozzoli Aug 13, 2026
56e647d
Add new test
marcocapozzoli Aug 14, 2026
b032683
Merge branch 'master' into masc/1177-atomdb-auth-b
marcocapozzoli Aug 14, 2026
e97e41f
wip - clean
marcocapozzoli Aug 17, 2026
7f1792e
Merge branch 'masc/1177-atomdb-auth-d' into masc/1177-atomdb-auth-b
marcocapozzoli Aug 17, 2026
a684e7e
Align ProtectedAtomDB and tests with the PublicKey DTO, and reject pr…
marcocapozzoli Aug 17, 2026
774dae5
Merge branch 'masc/1177-atomdb-auth-d' into masc/1177-atomdb-auth-b
marcocapozzoli Aug 17, 2026
14cd6c5
Fix tests
marcocapozzoli Aug 17, 2026
87be6de
Merge branch 'masc/1177-atomdb-auth-d' into masc/1177-atomdb-auth-b
marcocapozzoli Aug 18, 2026
4d87c17
Change AtomDB::is_protected() to AtomDB::get_protection_mode()
marcocapozzoli Aug 18, 2026
0bf0689
Fix tests
marcocapozzoli Aug 18, 2026
47b39ee
Merge branch 'masc/1177-atomdb-auth-d' into masc/1177-atomdb-auth-b
marcocapozzoli Aug 18, 2026
801eb34
Merge branch 'masc/1177-atomdb-auth-d' into masc/1177-atomdb-auth-b
marcocapozzoli Aug 19, 2026
9e88e42
load_protection_mode() during RedisMongoDB initialization
marcocapozzoli Aug 19, 2026
7a62b9d
Update src/atomdb/ProtectedAtomDB.cc
marcocapozzoli Aug 20, 2026
4cdbe6d
Fix Mock::get_protection_mode()
marcocapozzoli Aug 20, 2026
912e546
Add TODO
marcocapozzoli Aug 20, 2026
4f14d04
Merge branch 'master' into masc/1177-atomdb-auth-b
marcocapozzoli Aug 20, 2026
ad2c8c8
Add exception to ProtectedAtomDB; add new check in RedisMongoDB::load…
marcocapozzoli Aug 21, 2026
e2b69d9
Fix test
marcocapozzoli Aug 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/atomdb/AtomDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class AtomDB : public HandleDecoder {

virtual bool allow_nested_indexing() = 0;
virtual bool composite_type_enabled() const = 0;
virtual atomdb_api_types::ProtectionMode get_protection_mode() const = 0;

virtual shared_ptr<Atom> get_atom(const string& handle) = 0; // HandleDecoder interface
virtual shared_ptr<Node> get_node(const string& handle) = 0;
Expand Down
9 changes: 9 additions & 0 deletions src/atomdb/AtomDBAPITypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,14 @@ class AccessPermissionDocument {
}
};

/**
* @brief How an AtomDB participates in protected access.
*
* - UNPROTECTED: no authorization wrapper; open access.
* - PROTECTED: wrap and apply authorization post-processing (filter) after queries.
* - FORWARD: wrap and pass access keys through, but do not post-process locally
*/
enum class ProtectionMode { UNPROTECTED = 0, FORWARD, PROTECTED };

} // namespace atomdb_api_types
} // namespace atomdb
14 changes: 12 additions & 2 deletions src/atomdb/AtomDBFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "AdapterDB.h"
#include "InMemoryDB.h"
#include "MorkDB.h"
#include "ProtectedAtomDB.h"
#include "RedisMongoDB.h"
#include "RemoteAtomDB.h"
#include "Utils.h"
Expand Down Expand Up @@ -103,6 +104,15 @@ shared_ptr<AtomDB> AtomDBFactory::create_composite_atomdb(const JsonConfig& conf
}

shared_ptr<AtomDB> AtomDBFactory::wrap_if_protected(shared_ptr<AtomDB> atomdb) {
// AtomDBFactory::wrap_if_protected() is not implemented yet.
return atomdb;
if (!atomdb) {
RAISE_ERROR("AtomDBFactory::wrap_if_protected() received null atomdb");
}
if (atomdb->get_protection_mode() == atomdb_api_types::ProtectionMode::UNPROTECTED ||
dynamic_pointer_cast<ProtectedAtomDB>(atomdb)) {
return atomdb;
}
// TODO: uncomment this return when the integration with ProtectedDB with authorization is complete
// return make_shared<ProtectedAtomDB>(atomdb);

RAISE_ERROR("Protected AtomDB support is not available");
}
5 changes: 3 additions & 2 deletions src/atomdb/AtomDBFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ namespace atomdb {
class AtomDBFactory {
public:
/**
* @brief Creates a AtomDB and wraps it with ProtectedAtomDB when is applyable.
* @brief Creates a AtomDB and wraps it with ProtectedAtomDB when mode is
* PROTECTED or FORWARD.
*/
static shared_ptr<AtomDB> create(const JsonConfig& config, const string& context = "");

Expand All @@ -40,7 +41,7 @@ class AtomDBFactory {
const string& context = "");

/**
* @brief Wraps an AtomDB with ProtectedAtomDB when protected and not already wrapped.
* @brief Wraps an AtomDB with ProtectedAtomDB when mode is PROTECTED or FORWARD.
*/
static shared_ptr<AtomDB> wrap_if_protected(shared_ptr<AtomDB> atomdb);
};
Expand Down
20 changes: 20 additions & 0 deletions src/atomdb/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ cc_library(
":atomdb_factory",
":atomdb_singleton",
":atomdbutils",
":protected_atomdb",
"//atomdb/adapterdb:adapterdb_lib",
"//atomdb/inmemorydb:inmemorydb_lib",
"//atomdb/morkdb:morkdb_lib",
"//atomdb/redis_mongodb:redis_mongodb_lib",
"//atomdb/remotedb:remotedb_lib",
],
)

Expand All @@ -21,6 +27,7 @@ cc_library(
includes = ["."],
deps = [
":atomdb",
":protected_atomdb",
"//atomdb/adapterdb:adapterdb_lib",
"//atomdb/inmemorydb:inmemorydb_lib",
"//atomdb/morkdb:morkdb_lib",
Expand Down Expand Up @@ -73,3 +80,16 @@ cc_library(
"//commons:commons_lib",
],
)

cc_library(
name = "protected_atomdb",
srcs = ["ProtectedAtomDB.cc"],
hdrs = ["ProtectedAtomDB.h"],
includes = ["."],
deps = [
":atomdb",
":atomdb_api_types",
"//commons:commons_lib",
"//commons/atoms:atoms_lib",
],
)
Loading
Loading