You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by ro...@apache.org on 2026/08/10 14:57:40 UTC
(axis-axis2-c-core) 06/13: Unit-test the response endpoint policy
This is an automated email from the ASF dual-hosted git repository.
robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-c-core.git
commit 50fec7f5b8000150877a504ab306a8500e0e8f1a
Author: Robert Lazarski <ro...@gmail.com>
AuthorDate: Sun Aug 9 12:16:17 2026 -1000
Unit-test the response endpoint policy
Adds the policy cases to the existing addressing suite so they run under
make check rather than living only in an ad-hoc harness.
Two decisions are pinned. Anonymous, none, NULL and empty addresses must stay
allowed, because refusing them would break ordinary in-out messaging rather
than any decoupled case. And nothing non-anonymous is honoured until
allowNonAnonymousResponseEndpoints is turned on, whatever the address is --
public, instance-metadata, or a pivot scheme alike.
A NULL conf_ctx is used deliberately: that path exercises the shipped defaults,
which is what an unconfigured deployment gets.
Co-Authored-By: Claude Fable 5 <no...@anthropic.com>
---
test/core/addr/test_addr.cc | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/test/core/addr/test_addr.cc b/test/core/addr/test_addr.cc
index b58aa6019..dee036739 100644
--- a/test/core/addr/test_addr.cc
+++ b/test/core/addr/test_addr.cc
@@ -23,6 +23,8 @@
#include <axutil_log_default.h>
#include <axutil_error_default.h>
#include <axis2_endpoint_ref.h>
+#include <axis2_core_utils.h>
+#include <axis2_addr.h>
#include <stdio.h>
@@ -114,3 +116,39 @@ TEST_F(TestAddr, test_msg_info_headers)
axis2_msg_info_headers_free(axis2_msg_info_headers, m_env);
}
+
+
+/* ------------------------------------------------------------------------
+ * Response endpoint policy
+ *
+ * A non-anonymous wsa:ReplyTo/FaultTo names the destination of a
+ * server-initiated send, so it is declined unless a deployment opts in.
+ * These cases pin the decisions that policy makes; a NULL conf_ctx exercises
+ * the shipped defaults, which is what an unconfigured deployment gets.
+ * ---------------------------------------------------------------------- */
+
+TEST_F(TestAddr, test_response_endpoint_anonymous_always_allowed)
+{
+ /* Anonymous and none mean "reply on the inbound connection" and drive no
+ * outbound send, so refusing them would break ordinary in-out messaging. */
+ ASSERT_TRUE(axis2_core_utils_is_response_endpoint_allowed(
+ m_env, NULL, AXIS2_WSA_ANONYMOUS_URL));
+ ASSERT_TRUE(axis2_core_utils_is_response_endpoint_allowed(
+ m_env, NULL, AXIS2_WSA_ANONYMOUS_URL_SUBMISSION));
+ ASSERT_TRUE(axis2_core_utils_is_response_endpoint_allowed(
+ m_env, NULL, AXIS2_WSA_NONE_URL));
+ ASSERT_TRUE(axis2_core_utils_is_response_endpoint_allowed(m_env, NULL, NULL));
+ ASSERT_TRUE(axis2_core_utils_is_response_endpoint_allowed(m_env, NULL, ""));
+}
+
+TEST_F(TestAddr, test_response_endpoint_declined_by_default)
+{
+ /* Nothing non-anonymous is honoured until allowNonAnonymousResponseEndpoints
+ * is turned on, whatever the address happens to be. */
+ ASSERT_FALSE(axis2_core_utils_is_response_endpoint_allowed(
+ m_env, NULL, "https://198.51.100.7/callback"));
+ ASSERT_FALSE(axis2_core_utils_is_response_endpoint_allowed(
+ m_env, NULL, "http://169.254.169.254/latest/meta-data/"));
+ ASSERT_FALSE(axis2_core_utils_is_response_endpoint_allowed(
+ m_env, NULL, "file:///etc/passwd"));
+}