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

MemberAccess support private static field. #58 #59

Merged
merged 1 commit into from
Oct 22, 2018

Conversation

hengyunabc
Copy link
Contributor

No description provided.

Copy link
Collaborator

@lukaszlenart lukaszlenart left a 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

src/java/ognl/OgnlRuntime.java Outdated Show resolved Hide resolved
src/java/ognl/OgnlRuntime.java Outdated Show resolved Hide resolved
src/java/ognl/OgnlRuntime.java Outdated Show resolved Hide resolved
@hengyunabc
Copy link
Contributor Author

@lukaszlenart Thanks, I updated the commit.

context.getMemberAccess().restore(context, null, f, null, state);
}
} else {
result = f.get(null);
Copy link
Collaborator

@lukaszlenart lukaszlenart Oct 21, 2018

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?

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator

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);

Suggested change
result = f.get(null);
throw new IllegalAccessException("Access to " + fieldName + " is forbidden");

Copy link
Collaborator

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);

Suggested change
result = f.get(null);
throw new IllegalAccessException("Access to " + fieldName + " is forbidden");

Copy link
Collaborator

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);

Copy link
Collaborator

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);

Suggested change
result = f.get(null);
throw new IllegalAccessException("Access to " + fieldName + " is forbidden");

Copy link
Collaborator

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);

Copy link
Collaborator

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);

Suggested change
result = f.get(null);
throw new IllegalAccessException("Access to " + fieldName + " is forbidden");

Copy link
Contributor Author

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.

@lukaszlenart
Copy link
Collaborator

LGTM 👍

@lukaszlenart
Copy link
Collaborator

Thanks a lot!

@lukaszlenart lukaszlenart merged commit 92e1560 into orphan-oss:ognl-3-1-x Oct 22, 2018
@lukaszlenart
Copy link
Collaborator

Do you plan to cherry-pick those changes into the master branch?

@hengyunabc
Copy link
Contributor Author

Do you plan to cherry-pick those changes into the master branch?

OK, I created a new PR: #60.

In addition, may I ask is there any plan to release the new version?

@lukaszlenart
Copy link
Collaborator

In few hours, working on it ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants