You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simplificación del controlador añadido recientemente en el PR #90 para mejorar claridad y reducir duplicación, preservando toda la funcionalidad.
Archivos simplificados
src/main/java/com/example/demo/controller/SecurityDependencyDemoController.java - Extraído helper buildBaseResponse y renombrada variable para mayor consistencia
Mejoras realizadas
Reducción de duplicación
Los tres métodos de endpoint repetían el mismo patrón: new LinkedHashMap<>(), put("mode", ...), put("dependency", ...). Se extrae a buildBaseResponse(mode, dependency).
Mayor claridad en nombres
Renombrada la variable demo → entries en guavaNonExploitable para que sea consistente con la clave del mapa de respuesta ("entries").
gh aw add githubnext/agentics/workflows/code-simplifier.md@298f992955146a6731d380a9de808e17861708e5
expires on Jun 11, 2026, 11:58 AM UTC
Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch simplify/security-demo-controller-2026-06-10-5bfdfd8386ec4612.
To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ
Show patch preview (69 of 69 lines)
From 06ca89291342ee66dc800e3fbb5ac8aad2bae28c Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Wed, 10 Jun 2026 11:55:45 +0000
Subject: [PATCH] Simplify SecurityDependencyDemoController: extract
buildBaseResponse helper
- Extract buildBaseResponse() helper to eliminate duplicated LinkedHashMap
creation pattern across the three endpoint methods
- Rename demo variable to entries in guavaNonExploitable for consistency
with the response map key name
No functional changes - all endpoints return identical JSON responses.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
.../SecurityDependencyDemoController.java | 21 ++++++++++---------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/main/java/com/example/demo/controller/SecurityDependencyDemoController.java b/src/main/java/com/example/demo/controller/SecurityDependencyDemoController.java
index 6242bfd..25ccab9 100644
--- a/src/main/java/com/example/demo/controller/SecurityDependencyDemoController.java+++ b/src/main/java/com/example/demo/controller/SecurityDependencyDemoController.java@@ -21,9 +21,7 @@ public class SecurityDependencyDemoController {
// Deliberately vulnerable for GHAS demo: interpolator resolves lookups from user input.
String resolved = StringSubstitutor.createInterpolator().replace(template);
- Map<String, Object> response = new LinkedHashMap<>();- response.put("mode", "exploitable");- response.put("dependency", "org.apache.commons:commons-text:1.9");+ Map<String, Object> response = buildBaseResponse("exploitable", "org.apache.commons:commons-text:1.9");
response.put("input", template);
response.put("resolved", resolved);
return response;
@@ -35,21 +33,24 @@ public class SecurityDependencyDemoController {
source.put("demo", "safe-usage-only");
Map<String, String> unmodifiable = MapUtils.unmodifia
... (truncated)
Simplificación de código - 2026-06-10
Simplificación del controlador añadido recientemente en el PR #90 para mejorar claridad y reducir duplicación, preservando toda la funcionalidad.
Archivos simplificados
src/main/java/com/example/demo/controller/SecurityDependencyDemoController.java- Extraído helperbuildBaseResponsey renombrada variable para mayor consistenciaMejoras realizadas
Reducción de duplicación
new LinkedHashMap<>(),put("mode", ...),put("dependency", ...). Se extrae abuildBaseResponse(mode, dependency).Mayor claridad en nombres
demo→entriesenguavaNonExploitablepara que sea consistente con la clave del mapa de respuesta ("entries").Basado en cambios recientes de
Testing
Foco de revisión
Verificar que:
buildBaseResponseno altera el orden de las claves (LinkedHashMappreserva orden de inserción)Automatizado por Code Simplifier Agent
Add this agentic workflows to your repo
To install this agentic workflow, run
Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch
simplify/security-demo-controller-2026-06-10-5bfdfd8386ec4612.Click here to create the pull request
To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ
Show patch preview (69 of 69 lines)