Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2b8b08a
Forbid live signature-table access in CCF 8.0
achamayou Oct 2, 2026
63aa90b
Reference the 8.0 signature-table access PR in release notes
achamayou Oct 2, 2026
cc47c22
Fix clang-tidy diagnostics for signature-table access policy
achamayou Oct 2, 2026
2e579e1
Quieten signature-table denial logging and document /node/state avail…
achamayou Oct 2, 2026
4888bf8
Benchmark KV handle acquisition
achamayou Oct 2, 2026
8b88d65
Merge main into signature-table access branch
achamayou Oct 2, 2026
b37f6c7
Fix clang-tidy returns in materialised KV view factories
achamayou Oct 2, 2026
95edadb
Merge main and preserve signature access policy across handler extrac…
achamayou Oct 7, 2026
35c1447
Merge main, trim doc implementation details, and switch to .changes f…
achamayou Nov 25, 2026
b1f15f8
Merge main (std::format migration)
achamayou Nov 25, 2026
260c66f
Trim redundant tests, handle benchmark, and duplicate map-access guard
achamayou Nov 26, 2026
1bdba85
Avoid version_lock contention in rollback_count checks and materialis…
achamayou Nov 26, 2026
69a0fdb
Merge main and update new FollowerFixture to match signature-table po…
achamayou Nov 26, 2026
dd611b6
Merge main (#8789) and pass previous_signed_root in network_identity_…
achamayou Nov 26, 2026
9a5d365
Track globally committed reads in reserved transactions
achamayou Nov 28, 2026
2869332
Reject CommittableTx::commit() on reserved transactions
achamayou Nov 28, 2026
77bec98
Test /node/state pre-readiness progress and narrow snapshot-install d…
achamayou Nov 30, 2026
8cef142
Retry CompactedVersionConflict from process_command_without_kv on rea…
achamayou Nov 30, 2026
1aa9ae6
Keep versioned migration notes in the 7.x to 8.x guide only
achamayou Dec 1, 2026
96c9649
Remove friend class Store by aligning pinned constructor on BaseTx
achamayou Dec 1, 2026
89853f4
Throw MapAccessDenied without logging in BaseTx::check_map_access
achamayou Dec 1, 2026
0fd3b69
Check baseline signature survives at seqno 3 after rollback
achamayou Dec 1, 2026
0e22c34
Capture materialised read state inside BaseTx tag constructor
achamayou Dec 1, 2026
0e84e2a
Name unused MaterialisedReadOnlyTag parameter for clang-tidy
achamayou Dec 1, 2026
4567869
Remove redundant public access specifier in Store
achamayou Dec 1, 2026
b3bc7d8
Clarify Rust vs C++ signature-table access denial in KV docs
achamayou Dec 2, 2026
5780f77
Merge origin/main and resolve migration_7_x_to_8_x.rst conflict
achamayou Dec 3, 2026
5e91d57
Make MapAccessDenied a private non-std::exception handled by RpcFrontend
achamayou Dec 3, 2026
49eeea3
Deduplicate retry response reset in RpcFrontend::process_command_inner
achamayou Dec 3, 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
2 changes: 2 additions & 0 deletions .changes/live-signature-table-access.removed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Live KV access to `public:ccf.internal.signatures`, `public:ccf.internal.cose_signatures` and `public:ccf.internal.tree` has been removed across C++, Rust and JavaScript contexts, and `GET /node/state` is now non-transactional without `x-ms-ccf-transaction-id` while remaining available during recovery.
See the [7.x to 8.x migration guide](doc/releases/migration_7_x_to_8_x.rst#signature-transaction-tables).
20 changes: 18 additions & 2 deletions doc/audit/read_write_restrictions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ CCF ensures that governance audit is possible offline from a ledger, by consider
If this table is moved, make sure the source is updated in-sync.
(Ctrl+Shift+F: read_write_restrictions)

The possible access permissions are elaborated in the table below:
The possible access permissions are elaborated in the table below.
The public internal column excludes the :ref:`signature-transaction tables <audit/read_write_restrictions:Signature-Transaction Tables>` described below.

.. table:: KV permissions in different execution contexts
:widths: auto
Expand All @@ -79,4 +80,19 @@ The possible access permissions are elaborated in the table below:
| Application | Read-only | None | Read-only | None | Read/Write | Read/Write |
+--------------------------+------------+------------+------------+------------+------------+------------+

Any violation of these restrictions (eg - calling ``set`` on a `Read-only` table, or ``has`` on a `None` table) results in an exception being thrown.
Any violation of these restrictions (eg - calling ``set`` on a `Read-only` table, or ``has`` on a `None` table) results in an exception being thrown.

Signature-Transaction Tables
----------------------------

The following public internal tables are inaccessible in current-KV application and governance contexts, including read-only endpoints, ballots and constitution functions, as well as in C++ and Rust transactions:

- ``public:ccf.internal.signatures``
- ``public:ccf.internal.cose_signatures``
- ``public:ccf.internal.tree``

Other public internal tables retain the read-only permissions shown above.
See :doc:`/build_apps/kv/kv_how_to` for the C++ and Rust transaction APIs.

Historical read-only access to these tables, :doc:`receipt APIs </use_apps/rpc_api>` and :doc:`offline ledger parsing </audit/python_library>` remain supported.
For non-transactional progress metadata, use :http:GET:`/node/state`.
11 changes: 11 additions & 0 deletions doc/build_apps/kv/kv_how_to.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,17 @@ If you are only reading from or only writing to a given :cpp:type:`ccf::kv::Map`

Note that, as in the sample above, it is possible to acquire different kinds of handles at different points within your transaction's execution. So if you need to read in one location and write in another you can retrieve multiple distinct handles and get local type-safety, while the resulting transaction correctly handles all reads and writes made.

Signature Metadata
------------------

``public:ccf.internal.signatures``, ``public:ccf.internal.cose_signatures`` and ``public:ccf.internal.tree`` are inaccessible in live transactions.
In C++, acquiring any handle to these tables through ``Tx``, ``ReadOnlyTx`` or ``TxDiff`` (``ro``, ``rw``, ``wo`` or ``diff``) fails the request with an internal framework error.
In Rust, map operations on these tables return ``BridgeError::AccessDenied``; see :ref:`audit/read_write_restrictions:Signature-Transaction Tables` for JavaScript.

For signature data and proofs, use :ref:`historical state <build_apps/example_cpp:Historical Queries>` or :doc:`receipt APIs </use_apps/rpc_api>` instead.
Historical KV views and offline ledger parsing remain supported.
For node progress metadata, use :http:GET:`/node/state`, which is non-transactional: when the KV store is ready it reads ``last_signed_seqno`` from a pinned replicated view rather than the caller's transaction snapshot, and before readiness it falls back to recovery and startup progress.

Removing a key
--------------

Expand Down
9 changes: 9 additions & 0 deletions doc/releases/migration_7_x_to_8_x.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,12 @@ Nodes that join a service never create one.
- Each transaction signed by a service with an ML-DSA identity also has an ML-DSA COSE receipt, returned by ``GET /node/receipt/cose`` with ``identity_type=PQ``, which is trusted across recoveries through the chain of ML-DSA endorsements (see :ref:`use_apps/verify_tx:COSE Receipt Verification`).
Without ``identity_type`` the endpoint returns the classical receipt, but this default may change in a future release.
Clients should set ``identity_type=CLASSICAL`` or ``identity_type=PQ`` explicitly.

Signature-Transaction Tables
----------------------------

From CCF 8.0, ``public:ccf.internal.signatures``, ``public:ccf.internal.cose_signatures`` and ``public:ccf.internal.tree`` are inaccessible in live transactions across C++, Rust and JavaScript application and governance contexts.
Use historical KV views, :doc:`receipt APIs </use_apps/rpc_api>` or :doc:`offline ledger parsing </audit/python_library>` instead; see :ref:`audit/read_write_restrictions:Signature-Transaction Tables` and :ref:`build_apps/kv/kv_how_to:Signature Metadata`.

- Custom constitutions based on releases before 7.0.17 that read ``public:ccf.internal.signatures`` or ``public:ccf.internal.cose_signatures`` when adding or resetting a member must remove those reads and use the :ref:`state-digest update and acknowledgement workflow <governance/adding_member:Activating a New Member>`.
- :http:GET:`/node/state` is now non-transactional: it no longer returns the ``x-ms-ccf-transaction-id`` header, and it is served before the KV store is ready, including during public ledger recovery.
47 changes: 37 additions & 10 deletions include/ccf/kv/tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "ccf/kv/abstract_handle.h"
#include "ccf/tx_id.h"

#include <cstdint>
#include <list>
#include <map>
#include <memory>
Expand Down Expand Up @@ -46,6 +47,14 @@ namespace ccf::kv
class BaseTx
{
protected:
enum class AccessMode : std::uint8_t
{
ReadOnly,
ReadWrite,
WriteOnly,
Diff
};

struct PrivateImpl;
std::unique_ptr<PrivateImpl> pimpl;

Expand All @@ -68,10 +77,16 @@ namespace ccf::kv

void compacted_version_conflict(const std::string& map_name);

void check_map_access(const std::string& map_name, AccessMode access);

template <class THandle>
THandle* get_handle_by_name(
const std::string& map_name, bool track_deletes_on_missing_keys)
const std::string& map_name,
bool track_deletes_on_missing_keys,
AccessMode access)
{
check_map_access(map_name, access);

auto possible_handles = get_possible_handles(map_name);
for (auto* handle : possible_handles)
{
Expand Down Expand Up @@ -110,7 +125,11 @@ namespace ccf::kv
}

public:
struct MaterialisedReadOnlyTag
{};

BaseTx(AbstractStore* store_);
BaseTx(AbstractStore* store_, MaterialisedReadOnlyTag /*tag*/);

// To avoid accidental copies and promote use of pass-by-reference, this is
// non-copyable
Expand All @@ -135,7 +154,8 @@ namespace ccf::kv
template <class M>
typename M::Diff* diff(M& m)
{
return get_handle_by_name<typename M::Diff>(m.get_name(), true);
return get_handle_by_name<typename M::Diff>(
m.get_name(), true, AccessMode::Diff);
}

/** Get a diff by map name. Map type must be specified
Expand All @@ -146,7 +166,8 @@ namespace ccf::kv
template <class M>
typename M::Diff* diff(const std::string& map_name)
{
return get_handle_by_name<typename M::Diff>(map_name, true);
return get_handle_by_name<typename M::Diff>(
map_name, true, AccessMode::Diff);
}
};

Expand All @@ -171,7 +192,8 @@ namespace ccf::kv
// NB: Always creates a (writeable) MapHandle, which is cast to
// ReadOnlyHandle on return. This is so that other calls (before or
// after) can retrieve writeable handles over the same map.
return get_handle_by_name<typename M::Handle>(m.get_name(), false);
return get_handle_by_name<typename M::Handle>(
m.get_name(), false, AccessMode::ReadOnly);
}

/** Get a read-only handle by map name. Map type must be specified
Expand All @@ -182,7 +204,8 @@ namespace ccf::kv
template <class M>
typename M::ReadOnlyHandle* ro(const std::string& map_name)
{
return get_handle_by_name<typename M::Handle>(map_name, false);
return get_handle_by_name<typename M::Handle>(
map_name, false, AccessMode::ReadOnly);
}
};

Expand All @@ -200,7 +223,7 @@ namespace ccf::kv
class Tx : public ReadOnlyTx
{
public:
using ReadOnlyTx::ReadOnlyTx;
Tx(AbstractStore* store_) : ReadOnlyTx(store_) {}

/** Get a read-write handle from a map instance.
*
Expand All @@ -211,7 +234,8 @@ namespace ccf::kv
template <class M>
typename M::Handle* rw(M& m)
{
return get_handle_by_name<typename M::Handle>(m.get_name(), false);
return get_handle_by_name<typename M::Handle>(
m.get_name(), false, AccessMode::ReadWrite);
}

/** Get a read-write handle by map name. Map type must be specified
Expand All @@ -222,7 +246,8 @@ namespace ccf::kv
template <class M>
typename M::Handle* rw(const std::string& map_name)
{
return get_handle_by_name<typename M::Handle>(map_name, false);
return get_handle_by_name<typename M::Handle>(
map_name, false, AccessMode::ReadWrite);
}

/** Get a write-only handle from a map instance.
Expand All @@ -234,7 +259,8 @@ namespace ccf::kv
{
// As with ro, this returns a full-featured Handle
// which is cast to only show its writeable facet.
return get_handle_by_name<typename M::Handle>(m.get_name(), false);
return get_handle_by_name<typename M::Handle>(
m.get_name(), false, AccessMode::WriteOnly);
}

/** Get a write-only handle by map name. Map type must be specified
Expand All @@ -245,7 +271,8 @@ namespace ccf::kv
template <class M>
typename M::WriteOnlyHandle* wo(const std::string& map_name)
{
return get_handle_by_name<typename M::Handle>(map_name, false);
return get_handle_by_name<typename M::Handle>(
map_name, false, AccessMode::WriteOnly);
}
};
}
4 changes: 3 additions & 1 deletion include/ccf/rust_ffi.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ typedef void (*ccf_rust_drop_callback)(void* user_data);
inline constexpr ccf_rust_result CCF_RUST_INVALID_ARGUMENT = 2;
inline constexpr ccf_rust_result CCF_RUST_READ_ONLY = 3;
inline constexpr ccf_rust_result CCF_RUST_INTERNAL_ERROR = 4;
inline constexpr ccf_rust_result CCF_RUST_ACCESS_DENIED = 5;

inline constexpr ccf_rust_auth CCF_RUST_AUTH_NONE = 0;
inline constexpr ccf_rust_auth CCF_RUST_AUTH_USER_CERT = 1;
Expand All @@ -54,7 +55,8 @@ enum
CCF_RUST_NOT_FOUND = 1,
CCF_RUST_INVALID_ARGUMENT = 2,
CCF_RUST_READ_ONLY = 3,
CCF_RUST_INTERNAL_ERROR = 4
CCF_RUST_INTERNAL_ERROR = 4,
CCF_RUST_ACCESS_DENIED = 5
};

enum
Expand Down
24 changes: 24 additions & 0 deletions samples/apps/basic_rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,30 @@ fn register(registry: &mut Registry) -> Result<(), BridgeError> {
)?;
// SNIPPET_END: rust_get_record

registry.read_write(
"/signature-table-access",
"POST",
Auth::None,
|context| -> EndpointResult {
for table in [
"public:ccf.internal.signatures",
"public:ccf.internal.cose_signatures",
"public:ccf.internal.tree",
] {
if context.map(table).get(&[0; 8]) != Err(BridgeError::AccessDenied)
|| context.map(table).put(&[0; 8], b"probe") != Err(BridgeError::AccessDenied)
{
return Err(EndpointError::internal(format!(
"Expected AccessDenied for {table}"
)));
}
}
context.set_status(200)?;
context.set_body(b"denied")?;
Ok(())
},
)?;

registry.read_write("/compaction/marker", "POST", Auth::None, |context| {
COMPACTION_READY.store(false, Ordering::Release);
context.map(COMPACTION_MARKER).put(b"init", b"init")?;
Expand Down
34 changes: 24 additions & 10 deletions src/consensus/aft/test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the Apache 2.0 License.

#include "kv/store.h"
#include "kv/test/stub_consensus.h"
#include "node/commit_callback_subsystem.h"
#include "service/tables/signatures.h"
#include "test_common.h"
Expand Down Expand Up @@ -3444,6 +3445,8 @@ DOCTEST_TEST_CASE(
ccf::Tables::SERIALISED_MERKLE_TREE};

ccf::kv::Store sender_store;
std::shared_ptr<ccf::kv::test::PrimaryStubConsensus> sender_consensus =
std::make_shared<ccf::kv::test::PrimaryStubConsensus>();
std::shared_ptr<ccf::kv::Store> follower_store =
std::make_shared<ccf::kv::Store>();
std::shared_ptr<aft::ChannelStubProxy> follower_channels =
Expand All @@ -3465,6 +3468,7 @@ DOCTEST_TEST_CASE(
{
auto encryptor = std::make_shared<TermPreservingEncryptor>();
sender_store.set_encryptor(encryptor);
sender_store.set_consensus(sender_consensus);
sender_store.initialise_term(1);

follower_store->set_encryptor(encryptor);
Expand Down Expand Up @@ -3494,12 +3498,23 @@ DOCTEST_TEST_CASE(
{
const auto txid = sender_store.next_txid();
auto tx = sender_store.create_reserved_tx(txid);
tx.rw(signatures)->put(ccf::PrimarySignature(primary_id, txid.seqno));
tx.rw(serialised_tree)->put({});
tx.wo(signatures)->put(ccf::PrimarySignature(primary_id, txid.seqno));
tx.wo(serialised_tree)->put({});
auto [rc, data, claims_digest, commit_evidence_digest, tx_hooks] =
tx.commit_reserved();
DOCTEST_REQUIRE(rc == ccf::kv::CommitResult::SUCCESS);
raw_entries.push_back(std::move(data));
DOCTEST_REQUIRE(
sender_store.commit(
txid,
std::make_unique<ccf::kv::MovePendingTx>(
std::move(data),
std::move(claims_digest),
std::move(commit_evidence_digest),
std::move(tx_hooks)),
true) == ccf::kv::CommitResult::SUCCESS);
const auto replicated = sender_consensus->get_latest_data();
DOCTEST_REQUIRE(replicated.has_value());
raw_entries.push_back(*replicated);
return txid.seqno;
}

Expand All @@ -3508,18 +3523,17 @@ DOCTEST_TEST_CASE(
size_t value,
const std::optional<aft::Configuration::Nodes>& new_config = std::nullopt)
{
const auto txid = sender_store.next_txid();
auto tx = sender_store.create_reserved_tx(txid);
auto tx = sender_store.create_tx();
tx.rw(values)->put(key, value);
if (new_config.has_value())
{
tx.rw(configs)->put(0, *new_config);
}
auto [rc, data, claims_digest, commit_evidence_digest, tx_hooks] =
tx.commit_reserved();
DOCTEST_REQUIRE(rc == ccf::kv::CommitResult::SUCCESS);
raw_entries.push_back(std::move(data));
return txid.seqno;
DOCTEST_REQUIRE(tx.commit() == ccf::kv::CommitResult::SUCCESS);
const auto replicated = sender_consensus->get_latest_data();
DOCTEST_REQUIRE(replicated.has_value());
raw_entries.push_back(*replicated);
return tx.commit_version();
}

void deliver(
Expand Down
Loading