From ddf6606fa853b9904c9ae149b71dc518efa8425a Mon Sep 17 00:00:00 2001 From: Amaury Chamayou Date: Fri, 4 Sep 2026 12:45:23 +0100 Subject: [PATCH] Move HTTP runtime session adapters into enclave to break http->enclave/node cycles Relocate src/http/http_session.h, http2_session.h, and http_rpc_context.h into src/enclave/, preserving their http:: namespace and type names. These are internal runtime adapters that bind the HTTP protocol layer to enclave session/RPC machinery and ccf::RpcContextImpl (in src/node), so they belonged with their consumers rather than with the protocol-only http component. Update all in-tree consumers (rpc_sessions.h, forwarder.h, jwt_key_auto_refresh.h) to the new paths, and drop the now-unused http_rpc_context.h include from frontend.h. Make the moved headers self-contained by including enclave/rpc_handler.h and enclave/rpc_map.h directly, and updating relative http/ includes to explicit paths. Clean incidental http -> enclave edges from the remaining protocol headers: http2_parser.h and http_proc.h no longer include enclave/session.h and enclave/tls_session.h respectively (unused), and http_parser.h drops enclave/tls_session.h in favour of a direct ds/internal_logger.h include for the logging macros it actually uses. Extend scripts/source-dependencies.json with the http component's final allowed dependencies (ccf-api, crypto, ds, uv), matching the acyclic policy already enforced for other components. The dependency checker confirms no remaining http -> enclave, http -> host, or http -> node edges. Layer 2 of the acyclic source components stack, based on #8281. Refs #3517. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- scripts/source-dependencies.json | 3 ++- src/{http => enclave}/http2_session.h | 6 +++--- src/{http => enclave}/http_rpc_context.h | 4 +++- src/{http => enclave}/http_session.h | 6 +++--- src/enclave/rpc_sessions.h | 4 ++-- src/http/http2_parser.h | 2 -- src/http/http_parser.h | 2 +- src/http/http_proc.h | 1 - src/node/jwt_key_auto_refresh.h | 2 +- src/node/rpc/forwarder.h | 2 +- src/node/rpc/frontend.h | 1 - 11 files changed, 16 insertions(+), 17 deletions(-) rename src/{http => enclave}/http2_session.h (99%) rename src/{http => enclave}/http_rpc_context.h (99%) rename src/{http => enclave}/http_session.h (98%) diff --git a/scripts/source-dependencies.json b/scripts/source-dependencies.json index 0adc188570e3..5fff4bca0582 100644 --- a/scripts/source-dependencies.json +++ b/scripts/source-dependencies.json @@ -33,6 +33,7 @@ "threading": [], "tls": ["crypto", "ds"], "udp": ["ds"], - "uv": [] + "uv": [], + "http": ["ccf-api", "crypto", "ds", "uv"] } } diff --git a/src/http/http2_session.h b/src/enclave/http2_session.h similarity index 99% rename from src/http/http2_session.h rename to src/enclave/http2_session.h index bffa330d4bfb..55af07e43479 100644 --- a/src/http/http2_session.h +++ b/src/enclave/http2_session.h @@ -4,10 +4,10 @@ #include "ds/internal_logger.h" #include "enclave/rpc_map.h" -#include "error_reporter.h" +#include "http/error_reporter.h" +#include "http/http2_parser.h" #include "http/http2_types.h" -#include "http2_parser.h" -#include "http_responder.h" +#include "http/http_responder.h" #include "http_rpc_context.h" namespace http diff --git a/src/http/http_rpc_context.h b/src/enclave/http_rpc_context.h similarity index 99% rename from src/http/http_rpc_context.h rename to src/enclave/http_rpc_context.h index 5cd297be7993..429b10cb5af1 100644 --- a/src/http/http_rpc_context.h +++ b/src/enclave/http_rpc_context.h @@ -5,7 +5,9 @@ #include "ccf/odata_error.h" #include "ccf/rpc_context.h" #include "ds/actors.h" -#include "http_parser.h" +#include "enclave/rpc_handler.h" +#include "enclave/rpc_map.h" +#include "http/http_parser.h" #include "node/rpc_context_impl.h" namespace http diff --git a/src/http/http_session.h b/src/enclave/http_session.h similarity index 98% rename from src/http/http_session.h rename to src/enclave/http_session.h index 0b22cd89096f..22db6151cc09 100644 --- a/src/http/http_session.h +++ b/src/enclave/http_session.h @@ -5,9 +5,9 @@ #include "ds/internal_logger.h" #include "enclave/rpc_handler.h" #include "enclave/rpc_map.h" -#include "error_reporter.h" -#include "http_parser.h" -#include "http_responder.h" +#include "http/error_reporter.h" +#include "http/http_parser.h" +#include "http/http_responder.h" #include "http_rpc_context.h" namespace http diff --git a/src/enclave/rpc_sessions.h b/src/enclave/rpc_sessions.h index 0a2c452023c8..d5eeacf7e9a1 100644 --- a/src/enclave/rpc_sessions.h +++ b/src/enclave/rpc_sessions.h @@ -8,9 +8,9 @@ #include "ds/serialized.h" #include "enclave/session.h" #include "forwarder_types.h" -#include "http/http2_session.h" #include "http/http_responder.h" -#include "http/http_session.h" +#include "http2_session.h" +#include "http_session.h" #include "node/rpc/custom_protocol_subsystem.h" #include "node/session_metrics.h" #include "rpc_handler.h" diff --git a/src/http/http2_parser.h b/src/http/http2_parser.h index 11eb03bfa84f..551c5e9e8924 100644 --- a/src/http/http2_parser.h +++ b/src/http/http2_parser.h @@ -4,11 +4,9 @@ #include "ccf/ds/nonstd.h" #include "ds/internal_logger.h" -#include "enclave/session.h" #include "http2_callbacks.h" #include "http2_types.h" #include "http_proc.h" -#include "http_rpc_context.h" #include diff --git a/src/http/http_parser.h b/src/http/http_parser.h index 1bfa37afe2aa..ae182397e6e7 100644 --- a/src/http/http_parser.h +++ b/src/http/http_parser.h @@ -5,7 +5,7 @@ #include "ccf/ds/hex.h" #include "ccf/http_configuration.h" #include "ccf/http_query.h" -#include "enclave/tls_session.h" +#include "ds/internal_logger.h" #include "http/http_exceptions.h" #include "http_builder.h" #include "http_proc.h" diff --git a/src/http/http_proc.h b/src/http/http_proc.h index 74e93e3f2c4e..bd933c182d50 100644 --- a/src/http/http_proc.h +++ b/src/http/http_proc.h @@ -2,7 +2,6 @@ // Licensed under the Apache 2.0 License. #pragma once -#include "enclave/tls_session.h" #include "http2_types.h" #include "http_builder.h" diff --git a/src/node/jwt_key_auto_refresh.h b/src/node/jwt_key_auto_refresh.h index f1b67abf575d..87e08ce46c46 100644 --- a/src/node/jwt_key_auto_refresh.h +++ b/src/node/jwt_key_auto_refresh.h @@ -5,9 +5,9 @@ #include "ccf/ds/json.h" #include "ccf/ds/nonstd.h" #include "ccf/service/tables/jwt.h" +#include "enclave/http_rpc_context.h" #include "http/curl.h" #include "http/http_builder.h" -#include "http/http_rpc_context.h" #include "node/rpc/node_frontend.h" #include "tasks/basic_task.h" #include "tasks/task_system.h" diff --git a/src/node/rpc/forwarder.h b/src/node/rpc/forwarder.h index e061a3b66ed4..3fa280bf3882 100644 --- a/src/node/rpc/forwarder.h +++ b/src/node/rpc/forwarder.h @@ -3,8 +3,8 @@ #pragma once #include "enclave/forwarder_types.h" +#include "enclave/http_rpc_context.h" #include "enclave/rpc_map.h" -#include "http/http_rpc_context.h" #include "kv/kv_types.h" #include "node/node_to_node.h" #include "tasks/basic_task.h" diff --git a/src/node/rpc/frontend.h b/src/node/rpc/frontend.h index 88d66e1ddaf5..2dbb18588fb4 100644 --- a/src/node/rpc/frontend.h +++ b/src/node/rpc/frontend.h @@ -17,7 +17,6 @@ #include "enclave/rpc_handler.h" #include "forwarder.h" #include "http/http_jwt.h" -#include "http/http_rpc_context.h" #include "kv/compacted_version_conflict.h" #include "kv/store.h" #include "node/endpoint_context_impl.h"