You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2026/09/18 15:21:45 UTC
(unomi) branch drop-public-cors-credentials updated (1068f7de2 -> c0497920f)
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a change to branch drop-public-cors-credentials
in repository https://gitbox.apache.org/repos/asf/unomi.git
discard 1068f7de2 Drop credentialed CORS on the public tracker endpoints.
add 81504c791 UNOMI-978: Gate cross-profile merge and systemProperties writes on a trusted caller
new ecb2b3c82 Write filtered personalization contents back onto the request.
new cdf479c2e Keep personalization fallback when mixed contents include a script value.
new 1ee5c319d Deny public MVEL eval APIs from the scripting class loader.
new c0497920f Drop credentialed CORS on the public tracker endpoints.
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (1068f7de2)
\
N -- N -- N refs/heads/drop-public-cors-credentials (c0497920f)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../test/java/org/apache/unomi/itests/BasicIT.java | 29 +-
.../org/apache/unomi/itests/ContextServletIT.java | 233 ++++++++++++
.../org/apache/unomi/itests/ProfileMergeIT.java | 65 ++++
.../unomi/itests/PropertiesUpdateActionIT.java | 76 ++++
.../mvel-payload-personalization-mixed.json | 32 ++
manual/src/main/asciidoc/configuration.adoc | 7 +-
manual/src/main/asciidoc/samples/login-sample.adoc | 203 +++++++++--
.../main/resources/etc/custom.system.properties | 4 +-
package/src/main/resources/etc/mvel-forbid.json | 2 +-
.../actions/MergeProfilesOnPropertyAction.java | 32 ++
.../baseplugin/actions/UpdatePropertiesAction.java | 71 +++-
.../resources/OSGI-INF/blueprint/blueprint.xml | 1 +
.../actions/MergeProfilesOnPropertyActionTest.java | 136 +++++++
.../actions/UpdatePropertiesActionTest.java | 193 ++++++++++
.../unomi/rest/endpoints/ContextJsonEndpoint.java | 1 +
.../rest/endpoints/ContextJsonEndpointTest.java | 28 ++
samples/login-integration/pom.xml | 44 ++-
samples/login-integration/setup.sh | 299 ++++++++++++++++
.../unomi/samples/login/LoginSampleResources.java | 29 +-
.../apache/unomi/samples/login/LoginServlet.java | 395 +++++++++++++++++++++
.../src/main/resources/static/index.html | 75 ++++
.../resources/static/javascript/login-example.js | 58 +++
.../src/main/webapp/WEB-INF/web.xml | 24 --
.../login-integration/src/main/webapp/index.html | 70 ----
.../src/main/webapp/javascript/login-example.js | 139 --------
.../unomi/samples/login/LoginServletTest.java | 353 ++++++++++++++++++
.../apache/unomi/scripting/ExpressionFilter.java | 15 +-
.../scripting/SecureFilteringClassLoader.java | 122 +++++--
.../unomi/scripting/ExpressionFilterTest.java | 46 +++
.../unomi/scripting/MvelScriptExecutorTest.java | 62 +++-
.../scripting/SecureFilteringClassLoaderTest.java | 91 +++++
31 files changed, 2603 insertions(+), 332 deletions(-)
create mode 100644 itests/src/test/resources/security/mvel-payload-personalization-mixed.json
create mode 100644 plugins/baseplugin/src/test/java/org/apache/unomi/plugins/baseplugin/actions/MergeProfilesOnPropertyActionTest.java
create mode 100644 plugins/baseplugin/src/test/java/org/apache/unomi/plugins/baseplugin/actions/UpdatePropertiesActionTest.java
create mode 100755 samples/login-integration/setup.sh
copy rest/src/main/java/org/apache/unomi/rest/server/RestServerBus.java => samples/login-integration/src/main/java/org/apache/unomi/samples/login/LoginSampleResources.java (59%)
create mode 100644 samples/login-integration/src/main/java/org/apache/unomi/samples/login/LoginServlet.java
create mode 100644 samples/login-integration/src/main/resources/static/index.html
create mode 100644 samples/login-integration/src/main/resources/static/javascript/login-example.js
delete mode 100644 samples/login-integration/src/main/webapp/WEB-INF/web.xml
delete mode 100644 samples/login-integration/src/main/webapp/index.html
delete mode 100644 samples/login-integration/src/main/webapp/javascript/login-example.js
create mode 100644 samples/login-integration/src/test/java/org/apache/unomi/samples/login/LoginServletTest.java
create mode 100644 scripting/src/test/java/org/apache/unomi/scripting/ExpressionFilterTest.java
create mode 100644 scripting/src/test/java/org/apache/unomi/scripting/SecureFilteringClassLoaderTest.java
(unomi) 01/01: Drop credentialed CORS on the public tracker endpoints.
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch drop-public-cors-credentials
in repository https://gitbox.apache.org/repos/asf/unomi.git
commit c0497920fe1e38082a993971eaaacedf37ac23c5
Author: Serge Huber <sh...@apache.org>
AuthorDate: Tue Sep 8 20:35:40 2026 +0200
Drop credentialed CORS on the public tracker endpoints.
Keep any-origin access for browser clients; do not advertise credentials on context, eventcollector, or client.
---
manual/src/main/asciidoc/configuration.adoc | 2 +-
.../unomi/rest/endpoints/ClientEndpoint.java | 2 +-
.../unomi/rest/endpoints/ContextJsonEndpoint.java | 2 +-
.../rest/endpoints/EventsCollectorEndpoint.java | 2 +-
.../rest/endpoints/PublicTrackerCorsTest.java | 52 ++++++++++++++++++++++
5 files changed, 56 insertions(+), 4 deletions(-)
diff --git a/manual/src/main/asciidoc/configuration.adoc b/manual/src/main/asciidoc/configuration.adoc
index c67b8a034..ce7b04dec 100644
--- a/manual/src/main/asciidoc/configuration.adoc
+++ b/manual/src/main/asciidoc/configuration.adoc
@@ -452,7 +452,7 @@ curl -X GET "http://localhost:8181/cxs/tenants" \
Authentication rules (Unomi 3.1):
-1. Public paths (for example `/cxs/context.json`, `/cxs/eventcollector`, `/cxs/client/*`) require a valid **public** API key via `X-Unomi-Api-Key` (unless <<_v2_compatibility_mode,V2 compatibility mode>> is enabled).
+1. Public paths (for example `/cxs/context.json`, `/cxs/eventcollector`, `/cxs/client/*`) require a valid **public** API key via `X-Unomi-Api-Key` (unless <<_v2_compatibility_mode,V2 compatibility mode>> is enabled). Browser clients may call them from any origin; those responses do not include credentialed CORS headers.
2. Private paths accept `tenantId:privateApiKey` Basic auth, or JAAS admin credentials (often with `X-Unomi-Tenant-Id` when a tenant context is required).
3. Tenant administration (`/cxs/tenants`) requires system administrator JAAS credentials.
4. JAAS admin does **not** replace the public API key on public endpoints.
diff --git a/rest/src/main/java/org/apache/unomi/rest/endpoints/ClientEndpoint.java b/rest/src/main/java/org/apache/unomi/rest/endpoints/ClientEndpoint.java
index 6fae685b0..7a8be14df 100644
--- a/rest/src/main/java/org/apache/unomi/rest/endpoints/ClientEndpoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/endpoints/ClientEndpoint.java
@@ -43,7 +43,7 @@ import java.util.Set;
/**
* A servlet filter to serve a context-specific Javascript containing the current request context object.
*/
-@CrossOriginResourceSharing(allowAllOrigins = true, allowCredentials = true)
+@CrossOriginResourceSharing(allowAllOrigins = true, allowCredentials = false)
@Path("/")
@Component(service = ClientEndpoint.class, property = "osgi.jaxrs.resource=true")
public class ClientEndpoint {
diff --git a/rest/src/main/java/org/apache/unomi/rest/endpoints/ContextJsonEndpoint.java b/rest/src/main/java/org/apache/unomi/rest/endpoints/ContextJsonEndpoint.java
index 8fa5d56d3..0531750b8 100644
--- a/rest/src/main/java/org/apache/unomi/rest/endpoints/ContextJsonEndpoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/endpoints/ContextJsonEndpoint.java
@@ -57,7 +57,7 @@ import java.util.stream.Collectors;
* events, evaluate personalization filters, and return consented profile data.
*/
@Consumes(MediaType.APPLICATION_JSON)
-@CrossOriginResourceSharing(allowAllOrigins = true, allowCredentials = true)
+@CrossOriginResourceSharing(allowAllOrigins = true, allowCredentials = false)
@Path("/")
@Component(service = ContextJsonEndpoint.class, property = "osgi.jaxrs.resource=true")
public class ContextJsonEndpoint {
diff --git a/rest/src/main/java/org/apache/unomi/rest/endpoints/EventsCollectorEndpoint.java b/rest/src/main/java/org/apache/unomi/rest/endpoints/EventsCollectorEndpoint.java
index 48e7e5c7f..b6f646e24 100644
--- a/rest/src/main/java/org/apache/unomi/rest/endpoints/EventsCollectorEndpoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/endpoints/EventsCollectorEndpoint.java
@@ -49,7 +49,7 @@ import java.util.List;
*/
@Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8")
@Consumes(MediaType.APPLICATION_JSON)
-@CrossOriginResourceSharing(allowAllOrigins = true, allowCredentials = true)
+@CrossOriginResourceSharing(allowAllOrigins = true, allowCredentials = false)
@Path("/")
@Component(service = EventsCollectorEndpoint.class, property = "osgi.jaxrs.resource=true")
public class EventsCollectorEndpoint {
diff --git a/rest/src/test/java/org/apache/unomi/rest/endpoints/PublicTrackerCorsTest.java b/rest/src/test/java/org/apache/unomi/rest/endpoints/PublicTrackerCorsTest.java
new file mode 100644
index 000000000..d9b0bc594
--- /dev/null
+++ b/rest/src/test/java/org/apache/unomi/rest/endpoints/PublicTrackerCorsTest.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.unomi.rest.endpoints;
+
+import org.apache.cxf.rs.security.cors.CrossOriginResourceSharing;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Public tracker endpoints keep a broad origin policy and do not advertise credentialed CORS.
+ */
+class PublicTrackerCorsTest {
+
+ @Test
+ void contextJsonAllowsAnyOriginWithoutCredentials() {
+ assertPublicTrackerCors(ContextJsonEndpoint.class);
+ }
+
+ @Test
+ void eventsCollectorAllowsAnyOriginWithoutCredentials() {
+ assertPublicTrackerCors(EventsCollectorEndpoint.class);
+ }
+
+ @Test
+ void clientAllowsAnyOriginWithoutCredentials() {
+ assertPublicTrackerCors(ClientEndpoint.class);
+ }
+
+ private static void assertPublicTrackerCors(Class<?> endpoint) {
+ CrossOriginResourceSharing cors = endpoint.getAnnotation(CrossOriginResourceSharing.class);
+ assertNotNull(cors, endpoint.getSimpleName() + " must declare CORS");
+ assertTrue(cors.allowAllOrigins());
+ assertFalse(cors.allowCredentials());
+ }
+}