Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpEL Indexer silently ignores failure to set property as index #33310

Closed
sbrannen opened this issue Aug 4, 2024 · 0 comments
Closed

SpEL Indexer silently ignores failure to set property as index #33310

sbrannen opened this issue Aug 4, 2024 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@sbrannen
Copy link
Member

sbrannen commented Aug 4, 2024

The PropertyIndexingValueRef.setValue(Object) method in SpEL's Indexer silently ignores a failure to set a property via the indexing syntax.

For example, if property writes are disabled in the EvaluationContext, the SpEL expression #person['name'] = 'Jane' evaluates successfully without throwing an exception, but the name property is not actually set.

@sbrannen sbrannen added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) labels Aug 4, 2024
@sbrannen sbrannen added this to the 6.1.12 milestone Aug 4, 2024
@sbrannen sbrannen self-assigned this Aug 4, 2024
@sbrannen sbrannen changed the title SpEL Indexersilently ignores failure to set property as index SpEL Indexer silently ignores failure to set property as index Aug 4, 2024
@github-actions github-actions bot added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-6.0.x labels Aug 4, 2024
sbrannen added a commit that referenced this issue Aug 5, 2024
Prior to this commit, the Indexer in the Spring Expression Language
(SpEL) silently ignored a failure to set a property via the indexed
property syntax (['<property name>'] = <new value>) – for example, if
property write access was disabled in the EvaluationContext.

This commit addresses this issue by properly throwing a
SpelEvaluationException in PropertyIndexingValueRef.setValue(Object) if
the property could not be set.

See gh-33310
Closes gh-33311

(cherry picked from commit c57c227)
sbrannen added a commit that referenced this issue Aug 5, 2024
Prior to this commit, the Indexer in the Spring Expression Language
(SpEL) silently ignored a failure to set a property via the indexed
property syntax (['<property name>'] = <new value>) – for example, if
property write access was disabled in the EvaluationContext.

This commit addresses this issue by properly throwing a
SpelEvaluationException in PropertyIndexingValueRef.setValue(Object) if
the property could not be set.

See gh-33310
Closes gh-33312

(cherry picked from commit c57c227)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant