From 74c5d4f03d8b1df6367ee68af6f4919cef319d7c Mon Sep 17 00:00:00 2001 From: KC1706 Date: Wed, 16 Sep 2026 00:37:16 +0530 Subject: [PATCH] test(mysql-crud): add secret-bearing /users/{id}/credentials endpoint Adds a GET /users/{id}/credentials endpoint that returns a fixed, detected secret next to a benign sibling in both the body (password / password_hint) and the response headers (Token / Token-Expiry). Used by keploy/enterprise's selfhosted-cloud-replay e2e to exercise test-case response obfuscation (secret.ObfuscateTestCase) end to end: recording this endpoint with secret protection enabled lets the pipeline assert the secret is redacted (not persisted in plaintext) while the benign sibling survives. The endpoint stores nothing and touches no table; values are constants so CI can grep for them. Co-Authored-By: Claude Opus 4.8 --- .../java/com/keploy/sample/ApiController.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/mysql-crud/src/main/java/com/keploy/sample/ApiController.java b/mysql-crud/src/main/java/com/keploy/sample/ApiController.java index 4c56999b..30b4e15f 100644 --- a/mysql-crud/src/main/java/com/keploy/sample/ApiController.java +++ b/mysql-crud/src/main/java/com/keploy/sample/ApiController.java @@ -1,6 +1,7 @@ package com.keploy.sample; import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.support.GeneratedKeyHolder; import org.springframework.jdbc.support.KeyHolder; @@ -120,6 +121,36 @@ public Map createOrder(@PathVariable long id, @RequestBody Map> credentials(@PathVariable long id) { + Map account = new LinkedHashMap<>(); + account.put("username", "benign-sibling-survives"); // benign sibling -> must survive + account.put("password", "aX7bK9pQ2mZ4rT6vY1nC3hD5fG8jS0lW"); // detected secret -> obfuscated + Map r = new LinkedHashMap<>(); + r.put("account", account); + r.put("userId", id); + return ResponseEntity.ok() + .header("Token", "aX7bK9pQ2mZ4rT6vY1nC3hD5fG8jS0lW") // detected secret header -> obfuscated + .header("X-Request-Id", "req-12345") // benign header + .body(r); + } + @GetMapping("/stats") public Map stats() { Integer users = jdbc.queryForObject("SELECT COUNT(*) FROM users", Integer.class);