This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch CAMEL-27722-postman-served-collection-masking in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3b710170825dd43f7dd8614fb231c9664d70b2e1 Author: Claus Ibsen <[email protected]> AuthorDate: Fri Nov 27 19:37:53 2026 +0100 CAMEL-27722: camel-rest-postman - the served collection keeps credentials in headers, variables and URLs PostmanRedactor removed the auth blocks and masked variables of type secret, but served literal credential header values, default-type variables named as credentials, cookies, credential form fields, the userinfo password and credential query parameters (raw and structured URL) as they were. These are now masked with *** too. A value that is only a Postman variable reference, such as {{apiKey}} or Bearer {{token}}, is left as it is. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../camel/catalog/docs/rest-postman-component.adoc | 22 ++- .../src/main/docs/rest-postman-component.adoc | 22 ++- .../rest/postman/support/PostmanRedactor.java | 200 ++++++++++++++++++- .../rest/postman/support/PostmanRedactorTest.java | 214 +++++++++++++++++++++ .../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 9 + 5 files changed, 454 insertions(+), 13 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/rest-postman-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/rest-postman-component.adoc index 5ac4a19597f4..db7c29c7ff37 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/rest-postman-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/rest-postman-component.adoc @@ -396,7 +396,25 @@ On the consumer side the collection's auth block describes what a client must pr === Serving the collection document -When `apiContextPath` is set, the collection is served on that path with every `auth` block removed and the value of -every variable of type `secret` replaced. This redaction is unconditional. +When `apiContextPath` is set, the collection is served on that path with the credentials removed or masked with `+***+`. +This redaction is unconditional: + +* every `auth` block is removed +* the value of every variable of type `secret` is masked, and so is the value of any other variable whose name marks a +credential, such as `apiKey`, `password` or `accessToken` +* the value of a header whose name marks a credential is masked, in the requests and in the example responses: for +example `Authorization`, `Proxy-Authorization`, `x-api-key`, `api-key`, `Cookie`, `Set-Cookie` and any header whose name +contains `token`, `password` or `secret`. The same applies to the `urlencoded` and `formdata` body fields. +* the value of every cookie of an example response is masked +* in a URL, the password of the userinfo (`+https://user:password@host+`) and the value of a query parameter whose name +marks a credential (such as `api_key`, `apikey`, `token`, `access_token`, `password` or `secret`) are masked, in the +`raw` URL as well as in the `host` and `query` parts of a structured URL, and in a variable that holds a URL + +A name marks a credential when Camel treats it as sensitive (see `SensitiveUtils.isSensitiveHeader`, which also covers +names such as `user` and `clientId`), or when it contains `token`, `password` or `secret`. + +A value that is only a Postman variable reference, such as `+{{apiKey}}+` or `+Bearer {{token}}+`, is a placeholder and +is served as it is, so a client can see which variable to provide. The variable it refers to is masked where the +collection defines it, when it holds a literal value. include::spring-boot:partial$starter.adoc[] diff --git a/components/camel-rest-postman/src/main/docs/rest-postman-component.adoc b/components/camel-rest-postman/src/main/docs/rest-postman-component.adoc index 5ac4a19597f4..db7c29c7ff37 100644 --- a/components/camel-rest-postman/src/main/docs/rest-postman-component.adoc +++ b/components/camel-rest-postman/src/main/docs/rest-postman-component.adoc @@ -396,7 +396,25 @@ On the consumer side the collection's auth block describes what a client must pr === Serving the collection document -When `apiContextPath` is set, the collection is served on that path with every `auth` block removed and the value of -every variable of type `secret` replaced. This redaction is unconditional. +When `apiContextPath` is set, the collection is served on that path with the credentials removed or masked with `+***+`. +This redaction is unconditional: + +* every `auth` block is removed +* the value of every variable of type `secret` is masked, and so is the value of any other variable whose name marks a +credential, such as `apiKey`, `password` or `accessToken` +* the value of a header whose name marks a credential is masked, in the requests and in the example responses: for +example `Authorization`, `Proxy-Authorization`, `x-api-key`, `api-key`, `Cookie`, `Set-Cookie` and any header whose name +contains `token`, `password` or `secret`. The same applies to the `urlencoded` and `formdata` body fields. +* the value of every cookie of an example response is masked +* in a URL, the password of the userinfo (`+https://user:password@host+`) and the value of a query parameter whose name +marks a credential (such as `api_key`, `apikey`, `token`, `access_token`, `password` or `secret`) are masked, in the +`raw` URL as well as in the `host` and `query` parts of a structured URL, and in a variable that holds a URL + +A name marks a credential when Camel treats it as sensitive (see `SensitiveUtils.isSensitiveHeader`, which also covers +names such as `user` and `clientId`), or when it contains `token`, `password` or `secret`. + +A value that is only a Postman variable reference, such as `+{{apiKey}}+` or `+Bearer {{token}}+`, is a placeholder and +is served as it is, so a client can see which variable to provide. The variable it refers to is masked where the +collection defines it, when it holds a literal value. include::spring-boot:partial$starter.adoc[] diff --git a/components/camel-rest-postman/src/main/java/org/apache/camel/component/rest/postman/support/PostmanRedactor.java b/components/camel-rest-postman/src/main/java/org/apache/camel/component/rest/postman/support/PostmanRedactor.java index 1426b9c22639..92f4a654c8ad 100644 --- a/components/camel-rest-postman/src/main/java/org/apache/camel/component/rest/postman/support/PostmanRedactor.java +++ b/components/camel-rest-postman/src/main/java/org/apache/camel/component/rest/postman/support/PostmanRedactor.java @@ -18,7 +18,11 @@ package org.apache.camel.component.rest.postman.support; import java.util.ArrayList; import java.util.List; +import java.util.Locale; +import java.util.Set; +import java.util.regex.Pattern; +import org.apache.camel.util.SensitiveUtils; import org.apache.camel.util.json.JsonArray; import org.apache.camel.util.json.JsonObject; @@ -26,19 +30,44 @@ import org.apache.camel.util.json.JsonObject; * Removes credentials from a collection document before it is served over HTTP. * <p> * Serving the collection publishes route-author configuration to whoever can reach the API context path, and a real - * collection routinely carries live tokens in its {@code auth} blocks and in variables marked as secret. Redaction is - * therefore unconditional rather than an option. + * collection routinely carries live tokens in its {@code auth} blocks, in its variables, in header values and in + * request URLs. Redaction is therefore unconditional rather than an option: + * <ul> + * <li>every {@code auth} block is removed</li> + * <li>the value of a variable of type {@code secret} is masked, and so is the value of any other variable whose name + * marks a credential (such as {@code apiKey} or {@code password})</li> + * <li>the value of a header (in requests and in example responses) whose name marks a credential, such as + * {@code Authorization}, {@code x-api-key}, {@code Cookie} or any name that contains {@code token}, is masked, and so + * are the {@code urlencoded} and {@code formdata} body fields whose name marks a credential</li> + * <li>the value of every cookie of an example response is masked</li> + * <li>in a URL, the password of the userinfo ({@code user:password@host}) and the value of a query parameter whose name + * marks a credential (such as {@code api_key} or {@code access_token}) are masked, in the {@code raw} URL as well as in + * the structured {@code host} and {@code query} parts</li> + * </ul> + * A value that is only a Postman variable reference, such as <code>{{apiKey}}</code> or <code>Bearer {{token}}</code>, + * is a placeholder rather than a credential and is left as it is, so the served collection still shows which variable a + * client must provide. The variable it refers to is masked where it is defined, when it holds a literal credential. */ public final class PostmanRedactor { private static final String REDACTED = "***"; + // the lists of {key, value} objects whose value is masked when the key marks a credential + private static final Set<String> KEY_VALUE_LISTS = Set.of("header", "query", "urlencoded", "formdata"); + + // words that mark a credential anywhere in a name (in lower case without dashes and underscores), in addition to + // the names that SensitiveUtils.isSensitiveHeader detects, such as X-Token-Id + private static final String[] SENSITIVE_WORDS = { "token", "password", "secret" }; + + // a variable reference, optionally after an auth scheme, such as {{apiKey}} or Bearer {{token}} + private static final Pattern PLACEHOLDER = Pattern.compile("(?:[A-Za-z][A-Za-z0-9-]*\\s+)?\\{\\{[^{}]+}}"); + private PostmanRedactor() { } /** - * Returns a deep copy of the document with every {@code auth} block removed and the value of every variable of type - * {@code secret} replaced. + * Returns a deep copy of the document with every {@code auth} block removed and the credentials in variables, + * headers, body fields, cookies and URLs masked. */ public static JsonObject redact(JsonObject document) { return (JsonObject) redactNode(document, null); @@ -56,26 +85,179 @@ public final class PostmanRedactor { } answer.put(name, redactNode(entry.getValue(), name)); } + if ("url".equals(key)) { + redactUrlObject(answer); + } return answer; } if (node instanceof List<?> list) { List<Object> answer = new ArrayList<>(list.size()); for (Object element : list) { Object redacted = redactNode(element, null); - if ("variable".equals(key) && redacted instanceof JsonObject variable) { - redactSecretVariable(variable); + if (redacted instanceof JsonObject object) { + if ("variable".equals(key)) { + redactVariable(object); + } else if ("cookie".equals(key)) { + maskValue(object); + } else if (KEY_VALUE_LISTS.contains(key) && isSensitiveName(object.get("key"))) { + maskValue(object); + } } answer.add(redacted); } return new JsonArray(answer); } + if (node instanceof String text) { + if ("url".equals(key)) { + return redactUrl(text); + } + if ("header".equals(key)) { + // the headers can also be given as a single string of "Name: value" lines + return redactHeaderLines(text); + } + } return node; } - private static void redactSecretVariable(JsonObject variable) { - Object type = variable.get("type"); - if ("secret".equals(type) && variable.containsKey("value")) { + private static void redactVariable(JsonObject variable) { + if (!variable.containsKey("value")) { + return; + } + if ("secret".equals(variable.get("type"))) { variable.put("value", REDACTED); + } else if (isSensitiveName(variable.get("key"))) { + maskValue(variable); + } else if (variable.get("value") instanceof String value) { + // a variable such as baseUrl can hold a URL with credentials in it + variable.put("value", redactUrl(value)); + } + } + + private static void redactUrlObject(JsonObject url) { + if (url.get("raw") instanceof String raw) { + url.put("raw", redactUrl(raw)); + } + // the structured form keeps the userinfo in the first element of the host, such as user:password@example + if (url.get("host") instanceof List<?> host) { + List<Object> answer = new ArrayList<>(host.size()); + for (Object element : host) { + answer.add(element instanceof String text && text.indexOf('@') != -1 ? redactHost(text) : element); + } + url.put("host", new JsonArray(answer)); + } + } + + private static String redactHost(String host) { + // the userinfo rule of SensitiveUtils needs a scheme in front of the userinfo + String prefix = "x://"; + return maskUserInfo(prefix + host).substring(prefix.length()); + } + + /** + * Masks the userinfo password, and the values of the query parameters whose name marks a credential, in the URL. + */ + static String redactUrl(String url) { + if (url == null || url.isEmpty()) { + return url; + } + String answer = maskUserInfo(url); + int query = answer.indexOf('?'); + if (query == -1) { + return answer; + } + int fragment = answer.indexOf('#', query); + String params = fragment == -1 ? answer.substring(query + 1) : answer.substring(query + 1, fragment); + StringBuilder sb = new StringBuilder(answer.length()); + sb.append(answer, 0, query + 1); + String[] parts = params.split("&", -1); + for (int i = 0; i < parts.length; i++) { + if (i > 0) { + sb.append('&'); + } + String part = parts[i]; + int eq = part.indexOf('='); + if (eq > 0 && isSensitiveName(part.substring(0, eq)) && isLiteral(part.substring(eq + 1))) { + sb.append(part, 0, eq + 1).append(REDACTED); + } else { + sb.append(part); + } + } + if (fragment != -1) { + sb.append(answer, fragment, answer.length()); } + return sb.toString(); + } + + private static String maskUserInfo(String url) { + String masked = SensitiveUtils.maskUserInfoCredentials(url, REDACTED); + if (masked.equals(url)) { + return url; + } + // keep the userinfo when its password is only a placeholder: find the part that was replaced + int max = Math.min(url.length(), masked.length()); + int start = 0; + while (start < max && url.charAt(start) == masked.charAt(start)) { + start++; + } + int end = 0; + while (end < max - start && url.charAt(url.length() - 1 - end) == masked.charAt(masked.length() - 1 - end)) { + end++; + } + String password = url.substring(start, url.length() - end); + return isPlaceholder(password) ? url : masked; + } + + private static String redactHeaderLines(String text) { + String[] lines = text.split("\n", -1); + StringBuilder sb = new StringBuilder(text.length()); + for (int i = 0; i < lines.length; i++) { + if (i > 0) { + sb.append('\n'); + } + String line = lines[i]; + int colon = line.indexOf(':'); + if (colon > 0 && isSensitiveName(line.substring(0, colon)) && isLiteral(line.substring(colon + 1))) { + sb.append(line, 0, colon + 1).append(' ').append(REDACTED); + } else { + sb.append(line); + } + } + return sb.toString(); + } + + private static void maskValue(JsonObject object) { + Object value = object.get("value"); + if (value instanceof String text ? isLiteral(text) : value != null) { + object.put("value", REDACTED); + } + } + + /** + * Whether the name of a header, variable, query parameter or form field marks a credential. + */ + static boolean isSensitiveName(Object name) { + if (!(name instanceof String text) || text.isBlank()) { + return false; + } + text = text.strip(); + if (SensitiveUtils.isSensitiveHeader(text)) { + return true; + } + String key = text.toLowerCase(Locale.ENGLISH).replace("-", "").replace("_", ""); + for (String word : SENSITIVE_WORDS) { + if (key.contains(word)) { + return true; + } + } + return false; + } + + // a literal value is one that is neither blank nor only a variable reference + private static boolean isLiteral(String value) { + return !value.isBlank() && !isPlaceholder(value); + } + + private static boolean isPlaceholder(String value) { + return PLACEHOLDER.matcher(value.strip()).matches(); } } diff --git a/components/camel-rest-postman/src/test/java/org/apache/camel/component/rest/postman/support/PostmanRedactorTest.java b/components/camel-rest-postman/src/test/java/org/apache/camel/component/rest/postman/support/PostmanRedactorTest.java index e130fadaedde..265e737c308b 100644 --- a/components/camel-rest-postman/src/test/java/org/apache/camel/component/rest/postman/support/PostmanRedactorTest.java +++ b/components/camel-rest-postman/src/test/java/org/apache/camel/component/rest/postman/support/PostmanRedactorTest.java @@ -90,4 +90,218 @@ class PostmanRedactorTest { assertThat(original).containsKey("auth"); } + + private static JsonObject request(JsonObject redacted) { + return redacted.getJsonArray("item").getJsonObject(0).getJsonObject("request"); + } + + private static String header(JsonObject redacted, String name) { + JsonArray headers = request(redacted).getJsonArray("header"); + for (int i = 0; i < headers.size(); i++) { + JsonObject header = headers.getJsonObject(i); + if (name.equals(header.getString("key"))) { + return header.getString("value"); + } + } + throw new IllegalArgumentException("No header " + name); + } + + private static JsonObject withHeader(String name, String value) throws Exception { + return redact(""" + {"info":{"name":"t"}, + "item":[{"name":"R","request":{"method":"GET","url":"https://h/x", + "header":[{"key":"%s","value":"%s"},{"key":"Accept","value":"application/json"}]}}]}""" + .formatted(name, value)); + } + + @Test + void shouldMaskAuthorizationHeader() throws Exception { + JsonObject redacted = withHeader("Authorization", "Bearer s3cr3t"); + + assertThat(redacted.toJson()).doesNotContain("s3cr3t"); + assertThat(header(redacted, "Authorization")).isEqualTo("***"); + assertThat(header(redacted, "Accept")).isEqualTo("application/json"); + } + + @Test + void shouldMaskProxyAuthorizationHeader() throws Exception { + JsonObject redacted = withHeader("Proxy-Authorization", "Basic dXNlcjpwYXNz"); + + assertThat(header(redacted, "Proxy-Authorization")).isEqualTo("***"); + } + + @Test + void shouldMaskApiKeyHeader() throws Exception { + assertThat(header(withHeader("x-api-key", "k3y"), "x-api-key")).isEqualTo("***"); + assertThat(header(withHeader("api-key", "k3y"), "api-key")).isEqualTo("***"); + } + + @Test + void shouldMaskCookieHeader() throws Exception { + JsonObject redacted = withHeader("Cookie", "SESSION=abc123"); + + assertThat(redacted.toJson()).doesNotContain("abc123"); + assertThat(header(redacted, "Cookie")).isEqualTo("***"); + } + + @Test + void shouldMaskHeaderWhoseNameContainsToken() throws Exception { + assertThat(header(withHeader("X-Token-Id", "t0k3n"), "X-Token-Id")).isEqualTo("***"); + assertThat(header(withHeader("X-Auth-Token", "t0k3n"), "X-Auth-Token")).isEqualTo("***"); + } + + @Test + void shouldMaskHeadersOfExampleResponses() throws Exception { + JsonObject redacted = redact(""" + {"info":{"name":"t"}, + "item":[{"name":"R","request":{"method":"GET","url":"https://h/x"}, + "response":[{"name":"ok","code":200, + "originalRequest":{"method":"GET","url":"https://h/x", + "header":[{"key":"Authorization","value":"Bearer leaky"}]}, + "header":[{"key":"Set-Cookie","value":"SESSION=abc123"}], + "cookie":[{"name":"SESSION","value":"abc123","domain":"h"}]}]}]}"""); + + assertThat(redacted.toJson()).doesNotContain("leaky").doesNotContain("abc123"); + } + + @Test + void shouldMaskHeadersGivenAsString() throws Exception { + JsonObject redacted = redact(""" + {"info":{"name":"t"}, + "item":[{"name":"R","request":{"method":"GET","url":"https://h/x", + "header":"Accept: application/json\nAuthorization: Bearer s3cr3t"}}]}"""); + + assertThat(request(redacted).getString("header")).isEqualTo("Accept: application/json\nAuthorization: ***"); + } + + @Test + void shouldLeavePlaceholderHeaderValue() throws Exception { + assertThat(header(withHeader("Authorization", "Bearer {{token}}"), "Authorization")).isEqualTo("Bearer {{token}}"); + assertThat(header(withHeader("x-api-key", "{{apiKey}}"), "x-api-key")).isEqualTo("{{apiKey}}"); + } + + @Test + void shouldMaskDefaultTypeVariablesNamedAsCredential() throws Exception { + JsonObject redacted = redact(""" + {"info":{"name":"t"}, + "variable":[{"key":"apiKey","value":"k3y"}, + {"key":"password","value":"hunter2","type":"string"}, + {"key":"access_token","value":"t0k3n"}, + {"key":"petId","value":"42"}], + "item":[]}"""); + + assertThat(redacted.toJson()).doesNotContain("k3y").doesNotContain("hunter2").doesNotContain("t0k3n"); + + JsonArray variables = redacted.getJsonArray("variable"); + assertThat(variables.getJsonObject(0).getString("value")).isEqualTo("***"); + assertThat(variables.getJsonObject(1).getString("value")).isEqualTo("***"); + assertThat(variables.getJsonObject(2).getString("value")).isEqualTo("***"); + assertThat(variables.getJsonObject(3).getString("value")).isEqualTo("42"); + } + + @Test + void shouldLeavePlaceholderVariableValue() throws Exception { + JsonObject redacted = redact(""" + {"info":{"name":"t"}, + "variable":[{"key":"apiKey","value":"{{vaultApiKey}}"}], + "item":[]}"""); + + assertThat(redacted.getJsonArray("variable").getJsonObject(0).getString("value")).isEqualTo("{{vaultApiKey}}"); + } + + @Test + void shouldMaskUserInfoPasswordInRawUrl() throws Exception { + JsonObject redacted = redact(""" + {"info":{"name":"t"}, + "item":[{"name":"R","request":{"method":"GET","url":"https://scott:[email protected]/pet"}}]}"""); + + assertThat(request(redacted).getString("url")).isEqualTo("https://scott:***@api.example.com/pet"); + } + + @Test + void shouldMaskUserInfoPasswordInStructuredUrl() throws Exception { + JsonObject redacted = redact(""" + {"info":{"name":"t"}, + "item":[{"name":"R","request":{"method":"GET", + "url":{"raw":"https://scott:[email protected]/pet","protocol":"https", + "host":["scott:tiger@api","example","com"],"path":["pet"]}}}]}"""); + + assertThat(redacted.toJson()).doesNotContain("tiger"); + JsonObject url = request(redacted).getJsonObject("url"); + assertThat(url.getString("raw")).isEqualTo("https://scott:***@api.example.com/pet"); + assertThat(url.getJsonArray("host").getString(0)).isEqualTo("scott:***@api"); + } + + @Test + void shouldMaskVariableHoldingUrlWithUserInfo() throws Exception { + JsonObject redacted = redact(""" + {"info":{"name":"t"}, + "variable":[{"key":"baseUrl","value":"https://scott:[email protected]"}], + "item":[]}"""); + + assertThat(redacted.getJsonArray("variable").getJsonObject(0).getString("value")) + .isEqualTo("https://scott:***@api.example.com"); + } + + @Test + void shouldMaskSensitiveQueryParametersInRawUrl() throws Exception { + JsonObject redacted = redact( + """ + {"info":{"name":"t"}, + "item":[{"name":"R","request":{"method":"GET", + "url":"https://h/pet?api_key=k1&apikey=k2&token=t1&access_token=t2&password=p1&secret=s1&status=sold#top"}}]}"""); + + assertThat(request(redacted).getString("url")).isEqualTo( + "https://h/pet?api_key=***&apikey=***&token=***&access_token=***&password=***&secret=***&status=sold#top"); + } + + @Test + void shouldMaskSensitiveQueryParametersInStructuredUrl() throws Exception { + JsonObject redacted = redact(""" + {"info":{"name":"t"}, + "item":[{"name":"R","request":{"method":"GET", + "url":{"raw":"https://h/pet?api_key=k1&token=t1&access_token=t2&status=sold", + "host":["h"],"path":["pet"], + "query":[{"key":"api_key","value":"k1"},{"key":"token","value":"t1"}, + {"key":"access_token","value":"t2"},{"key":"status","value":"sold"}]}}}]}"""); + + assertThat(redacted.toJson()).doesNotContain("k1").doesNotContain("t1").doesNotContain("t2"); + JsonObject url = request(redacted).getJsonObject("url"); + assertThat(url.getString("raw")).isEqualTo("https://h/pet?api_key=***&token=***&access_token=***&status=sold"); + JsonArray query = url.getJsonArray("query"); + assertThat(query.getJsonObject(0).getString("value")).isEqualTo("***"); + assertThat(query.getJsonObject(1).getString("value")).isEqualTo("***"); + assertThat(query.getJsonObject(2).getString("value")).isEqualTo("***"); + assertThat(query.getJsonObject(3).getString("value")).isEqualTo("sold"); + } + + @Test + void shouldMaskSensitiveFormFields() throws Exception { + JsonObject redacted = redact(""" + {"info":{"name":"t"}, + "item":[{"name":"R","request":{"method":"POST","url":"https://h/login", + "body":{"mode":"urlencoded","urlencoded":[{"key":"username","value":"scott"}, + {"key":"client_secret","value":"hunter2"}, + {"key":"grant_type","value":"password"}]}}}]}"""); + + assertThat(redacted.toJson()).doesNotContain("hunter2"); + JsonArray fields = request(redacted).getJsonObject("body").getJsonArray("urlencoded"); + assertThat(fields.getJsonObject(1).getString("value")).isEqualTo("***"); + assertThat(fields.getJsonObject(2).getString("value")).isEqualTo("password"); + } + + @Test + void shouldLeavePlaceholdersInUrls() throws Exception { + JsonObject redacted = redact(""" + {"info":{"name":"t"}, + "item":[{"name":"R","request":{"method":"GET", + "url":{"raw":"https://{{user}}:{{password}}@{{host}}/pet?api_key={{apiKey}}", + "host":["{{user}}:{{password}}@{{host}}"],"path":["pet"], + "query":[{"key":"api_key","value":"{{apiKey}}"}]}}}]}"""); + + JsonObject url = request(redacted).getJsonObject("url"); + assertThat(url.getString("raw")).isEqualTo("https://{{user}}:{{password}}@{{host}}/pet?api_key={{apiKey}}"); + assertThat(url.getJsonArray("host").getString(0)).isEqualTo("{{user}}:{{password}}@{{host}}"); + assertThat(url.getJsonArray("query").getJsonObject(0).getString("value")).isEqualTo("{{apiKey}}"); + } } diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc index 842cdec20280..7a28064d3a16 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc @@ -12423,6 +12423,15 @@ With `mimeType` `PAGEABLE`, `PRINTABLE` or `RENDERABLE_IMAGE`, the producer now `java.awt.print.Pageable`, `java.awt.print.Printable` or `java.awt.image.renderable.RenderableImage`, as these doc flavors need, instead of a stream. With `sendToPrinter=false`, the body is still written to a file as bytes. +=== camel-rest-postman - the served collection masks more credentials + +The collection served on `apiContextPath` now also masks, with `+***+`, the values of credential headers (such as +`Authorization`, `x-api-key` and `Cookie`), of variables of the default type whose name marks a credential (such as +`apiKey` or `password`), of the cookies of example responses, of credential body fields, and of the userinfo password +and credential query parameters (such as `api_key` or `access_token`) in URLs. Before, only `auth` blocks were removed +and only variables of type `secret` were masked. A value that is only a Postman variable reference, such as +`+{{apiKey}}+`, is still served as it is. The collection that the routes use is not changed. + === Kamelets - removed Kamelets The Kamelet catalog (camel-kamelets 4.24) removes Kamelets that could not work on Camel 4.23 or 4.24:
