Fix SpringRequestMappingMethod URL Extraction: Use getAStringArrayValue Instead of getValue #19512
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, the SpringRequestMappingMethod class in CodeQL used the getValue or getStringValue predicate to extract the "value" attribute from Spring's @RequestMapping and related annotations. However, in Spring, the "value" and "path" attributes are defined as String[] (string arrays), not single strings. This caused issues where URLs could not be extracted if they were specified as arrays.
This PR updates the relevant logic to use getAStringArrayValue, which correctly handles array-typed annotation elements and ensures all specified URLs are extracted, regardless of whether they are provided as single values or arrays. This change improves the accuracy and reliability of Spring controller route extraction in CodeQL queries.
spring-web-5.2.8.RELEASE

org.springframework.web.bind.annotation.RequestMapping
or
https://github.com/spring-projects/spring-framework/blob/main/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java