-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
MemberAccess support private static field. #58 #59
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, left some comments
a5affd6
to
a143763
Compare
@lukaszlenart Thanks, I updated the commit. |
src/java/ognl/OgnlRuntime.java
Outdated
context.getMemberAccess().restore(context, null, f, null, state); | ||
} | ||
} else { | ||
result = f.get(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I wonder if we shouldn't throw an exception here, I mean, the field is not accessible but we want to get access to it anyway. Wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukaszlenart Do you mean line 2079?
Field f = getField(c, fieldName);
if (f == null) {
throw new NoSuchFieldException(fieldName);
}
OgnlRuntime#getField
return all fields, contain private fields, so throw NoSuchFieldException
is ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I meant that we check access first and if the field is not accessible we access it anyway. This can lead to a security vulnerability as basically we ignore if the field is accessible or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I meant that we check access first and if the field is not accessible we access it anyway. This can lead to a security vulnerability as basically we ignore if the field is accessible or not.
We should throw an exception here instead of f.get(null);
result = f.get(null); | |
throw new IllegalAccessException("Access to " + fieldName + " is forbidden"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I meant that we check access first and if the field is not accessible we access it anyway. This can lead to a security vulnerability as basically we ignore if the field is accessible or not.
We should throw an exception here instead of f.get(null);
result = f.get(null); | |
throw new IllegalAccessException("Access to " + fieldName + " is forbidden"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I meant that we check access first and if the field is not accessible we access it anyway. This can lead to a security vulnerability as basically we ignore if the field is accessible or not.
We should throw an exception here instead of f.get(null);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I meant that we check access first and if the field is not accessible we access it anyway. This can lead to a security vulnerability as basically we ignore if the field is accessible or not.
We should throw an exception here instead of f.get(null);
result = f.get(null); | |
throw new IllegalAccessException("Access to " + fieldName + " is forbidden"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I meant that we check access first and if the field is not accessible we access it anyway. This can lead to a security vulnerability as basically we ignore if the field is accessible or not.
We should throw an exception here instead of f.get(null);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I meant that we check access first and if the field is not accessible we access it anyway. This can lead to a security vulnerability as basically we ignore if the field is accessible or not.
We should throw an exception here instead of f.get(null);
result = f.get(null); | |
throw new IllegalAccessException("Access to " + fieldName + " is forbidden"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukaszlenart I got it, I updated the commit.
a143763
to
453b4a7
Compare
LGTM 👍 |
Thanks a lot! |
Do you plan to cherry-pick those changes into the |
OK, I created a new PR: #60. In addition, may I ask is there any plan to release the new version? |
In few hours, working on it ;-) |
No description provided.