Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Matrix parameters break actuator health paths and ALL_REMAINING selectors with Spring MVC in 4.2.0-M2

Aperta Adatta ai principianti
#52,300 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java, spring-boot
Ambito
api, backend, testing

Direzione di ricerca

Inizia da AbstractWebMvcEndpointHandlerMapping.getRemainingPathSegments, dove l’issue identifica l’estrazione del percorso come origine della regressione. Riproduci le richieste health e degli endpoint personalizzati elencate, poi aggiungi un test di regressione per i parametri di matrice e verifica che i percorsi aggiuntivi composti da più segmenti di #51470 continuino a funzionare. Il lavoro è completato quando i selettori di Spring MVC ricevono segmenti di percorso senza parametri di matrice e le richieste elencate restituiscono i risultati previsti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

status: waiting-for-triage

Spring Boot: 4.2.0-M2 (works in 4.1.1)

With Spring MVC, path parameters (for example a ;jsessionid=... added by URL rewriting) are no longer removed from the path segments passed to endpoint operations that use @Selector(match = Match.ALL_REMAINING). This breaks health group and component paths, and changes the values that custom endpoints receive.

With management.endpoint.health.probes.enabled=true, management.endpoint.health.show-components=always and management.endpoint.health.group.custom.include=ping,diskSpace:

Request 4.1.1 4.2.0-M2
/actuator/health/liveness;jsessionid=abc 200 404
/actuator/health/diskSpace;jsessionid=abc 200 404
/actuator/health/custom/ping;x=1 200 404
/actuator/health/custom;x=1/ping 200 500

For a custom endpoint:

@Endpoint(id = "echo")
class EchoEndpoint {

	@ReadOperation
	String echo(@Selector(match = Match.ALL_REMAINING) String... path) {
		return String.join("|", path);
	}

}

GET /actuator/echo/a/b;jsessionid=abc returns a|b in 4.1.1 and a|b;jsessionid=abc in 4.2.0-M2.

This seems to come from #51470. getRemainingPathSegments in AbstractWebMvcEndpointHandlerMapping now tokenizes pathPattern.extractPathWithinPattern(...).value(), which keeps path parameters, whereas the previous code used PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE.

Using the decoded value of each segment without its parameters restores the 4.1.1 behavior. I verified this locally against all the cases above, and the multi-segment additional paths from #51470 keep working:

PathContainer remainingPath = pathPattern
	.extractPathWithinPattern(ServletRequestPathUtils.getParsedRequestPath(request).pathWithinApplication());
return remainingPath.elements()
	.stream()
	.filter(PathContainer.PathSegment.class::isInstance)
	.map((element) -> ((PathContainer.PathSegment) element).valueToMatch())
	.filter(StringUtils::hasLength)
	.toArray(String[]::new);

I'd be happy to submit a PR with this change and a test.

Lingua principale
Java
Stelle
81.7k
Fork
45.1k
Merge medio
3g 13h
PR unite (30g)
58

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di spring-projects/spring-boot

Tutte le issue di spring-projects/spring-boot

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.