You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@struts.apache.org by "lukaszlenart (via GitHub)" <gi...@apache.org> on 2024/05/12 07:49:06 UTC
[PR] WW-5415 Fixes accessing public constructors via expression [struts]
lukaszlenart opened a new pull request, #933:
URL: https://github.com/apache/struts/pull/933
This PR fixes creating instances via OGNL expressions. The breaking change was introduced in #780 or #781
Closes [WW-5415](https://issues.apache.org/jira/browse/WW-5415)
--
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: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] WW-5415 Fixes accessing public constructors via expression [struts]
Posted by "lukaszlenart (via GitHub)" <gi...@apache.org>.
lukaszlenart merged PR #933:
URL: https://github.com/apache/struts/pull/933
--
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: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] WW-5415 Fixes accessing public constructors via expression [struts]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #933:
URL: https://github.com/apache/struts/pull/933#issuecomment-2106534361
## [](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=933) **Quality Gate failed**
Failed conditions
 [57.1% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=933&metric=new_coverage&view=list) (required ≥ 80%)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=933)
--
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: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] WW-5415 Fixes accessing public constructors via expression [struts]
Posted by "kusalk (via GitHub)" <gi...@apache.org>.
kusalk commented on code in PR #933:
URL: https://github.com/apache/struts/pull/933#discussion_r1597805873
##########
core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java:
##########
@@ -147,7 +147,7 @@ public boolean isAccessible(Map context, Object target, Member member, String pr
if (target != null) {
// Special case: Target is a Class object but not Class.class
if (Class.class.equals(target.getClass()) && !Class.class.equals(target)) {
- if (!isStatic(member)) {
+ if (!isStatic(member) && Arrays.stream(((Class<?>) target).getConstructors()).noneMatch(p -> p.getClass().equals(member.getClass()))) {
Review Comment:
Thanks @lukaszlenart for writing the test case - I did indeed overlook the constructor case, I've pushed a commit to this PR with the appropriate fix :)
--
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: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] WW-5415 Fixes accessing public constructors via expression [struts]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #933:
URL: https://github.com/apache/struts/pull/933#issuecomment-2106156152
## [](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=933) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=933&resolved=false&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=933&metric=new_accepted_issues&view=list)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=933&resolved=false&sinceLeakPeriod=true)
 [80.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=933&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=933&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=933)
--
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: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] WW-5415 Fixes accessing public constructors via expression [struts]
Posted by "lukaszlenart (via GitHub)" <gi...@apache.org>.
lukaszlenart commented on code in PR #933:
URL: https://github.com/apache/struts/pull/933#discussion_r1597574627
##########
core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java:
##########
@@ -147,7 +147,7 @@ public boolean isAccessible(Map context, Object target, Member member, String pr
if (target != null) {
// Special case: Target is a Class object but not Class.class
if (Class.class.equals(target.getClass()) && !Class.class.equals(target)) {
- if (!isStatic(member)) {
+ if (!isStatic(member) && Arrays.stream(((Class<?>) target).getConstructors()).noneMatch(p -> p.getClass().equals(member.getClass()))) {
Review Comment:
This is just a temporary solution to express where the problem is, @kusalk I count on your comment :)
--
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: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org