SABITHSAHEB opened a new pull request, #305: URL: https://github.com/apache/commons-jxpath/pull/305
Thanks for your contribution to [Apache Commons](https://commons.apache.org/)! Your help is appreciated! Before you push a pull request, review this list: - [x] Read the [contribution guidelines](CONTRIBUTING.md) for this project. - [x] Read the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) if you use Artificial Intelligence (AI). - [x] I used AI to create any part of, or all of, this pull request. Which AI tool was used to create this pull request, and to what extent did it contribute? Claude (Anthropic) found the issue and drafted the patch, test and description; I reviewed all of it before submitting. - [x] Run a successful build using the default [Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command line by itself. - [x] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best practice. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process. `ServletRequestHandler.getProperty`, which backs the context from `JXPathServletContexts.getRequestContext` and the `$request` variable, checks `getParameterValues` first, then the request attribute, then (via `HttpSessionHandler`) the session and application attributes. Parameters come from the client and attributes are set by server code, so a parameter with the same name as any attribute in those scopes replaces it. With session attribute `role=user`, a request carrying `?role=admin` makes `getValue("role")` on the request context return `"admin"`; the same happens to a request attribute set by a filter, such as the authenticated user. It also breaks write/read round trips: `setProperty` stores a request attribute, but a later read returns the parameter of that name instead. The change looks up the request, session and application attributes first and only falls back to request parameters when none of them has the name, so server-set values cannot be overridden from the query string. This matches the page context, which resolves names through `PageContext.findAttribute` and never consults parameters. Names that only exist as parameters, multi-valued parameters and empty parameters resolve as before. `JXPathServletContextTest.testServletRequestParameterDoesNotShadowAttributes` fails on the current code (`expected: <OK> but was: <forged>`) and passes with the change. Default `mvn` goal is green locally (416 tests, checkstyle, PMD, RAT, japicmp, javadoc). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
