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
Eliminación de duplicación — Los tres métodos repetían la misma lógica de crear un LinkedHashMap e insertar "mode" y "dependency". Se extrae el método privado buildResponse(String mode, String dependency).
Simplificación de variable intermedia — En commonsCollectionsNonExploitable() se eliminó el HashMap intermedio (source) usando Collections.singletonMap() directamente en la llamada a MapUtils.unmodifiableMap().
Import limpio — Se reemplaza java.util.HashMap (ya innecesario) por java.util.Collections.
gh aw add githubnext/agentics/workflows/code-simplifier.md@298f992955146a6731d380a9de808e17861708e5
expires on Jun 12, 2026, 12:09 PM 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-43014d2cc16cf2ee.
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 (81 of 81 lines)
From d60f0f36b73eba26395022814b58e0c8af77ee9d Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Thu, 11 Jun 2026 12:07:31 +0000
Subject: [PATCH] refactor: extraer buildResponse y simplificar
SecurityDependencyDemoController
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Extrae método privado buildResponse() para eliminar duplicación del mapa de respuesta- Simplifica commonsCollectionsNonExploitable() usando Collections.singletonMap()- Reemplaza import HashMap por Collections
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
.../SecurityDependencyDemoController.java | 25 +++++++++----------
1 file changed, 12 insertions(+), 13 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..e7d726e 100644
--- a/src/main/java/com/example/demo/controller/SecurityDependencyDemoController.java+++ b/src/main/java/com/example/demo/controller/SecurityDependencyDemoController.java@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import java.util.HashMap;+import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -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 = buildResponse("exploitable", "org.apache.
... (truncated)
Simplificación de código - 2026-06-11
Mejoras de claridad y eliminación de duplicación en
SecurityDependencyDemoController, añadido en #90.Archivo simplificado
src/main/java/com/example/demo/controller/SecurityDependencyDemoController.javaMejoras
Eliminación de duplicación — Los tres métodos repetían la misma lógica de crear un
LinkedHashMape insertar"mode"y"dependency". Se extrae el método privadobuildResponse(String mode, String dependency).Simplificación de variable intermedia — En
commonsCollectionsNonExploitable()se eliminó elHashMapintermedio (source) usandoCollections.singletonMap()directamente en la llamada aMapUtils.unmodifiableMap().Import limpio — Se reemplaza
java.util.HashMap(ya innecesario) porjava.util.Collections.Basado en
Testing
Automatizado por Code Simplifier Agent
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
releaseassets.githubusercontent.comSee Network Configuration for more information.
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-43014d2cc16cf2ee.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 (81 of 81 lines)