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

Obsolete call to "j.l.reflect.AccessibleObject.setAccessible(true)" #88

Open
GoogleCodeExporter opened this issue Apr 22, 2015 · 9 comments

Comments

@GoogleCodeExporter
Copy link

Running beanshell scripts in a restricted Environment (with installed 
SecurityManager) fails with SecurityException, even when 
"setAccessibility(true)" isn't called.

Original issue reported on code.google.com by pejob...@gmail.com on 20 Sep 2013 at 12:14

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Original comment by pejob...@gmail.com on 20 Sep 2013 at 2:15

  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

There are more of these calls, I (or tests) didn't spot them because of legacy 
code which automagically set "accessibility" to "true" if a class is generated 
from beanshell code.
This has been removed with rev#135 (in v2.1 branch). This revealed some more 
flaws. The major drawback of the change is compatibility - you can achieve the 
old behaviour if you explictly switch "accessibility" on. But legacy code 
couldn't be changed :(

One workaround is preserving the old behaviour for constructors: If the script 
defines a class with a protected constructor creating an instance would fail 
now. This is one use case I found by googling (and the only one - because of 
the lack of documentation for class creation in beanshell - surly because of 
the pure implementation). So the checkin contains a "fix" for this by setting 
the constructor(s) public - if "accessibility" is off, which is the default now.

#$%& wtf, great mess..

Original comment by pejob...@gmail.com on 27 Sep 2013 at 3:33

@GoogleCodeExporter
Copy link
Author

One more thing: Initializing final fields from constructor failed, I can't see 
if this is also caused by driving with seat belts now ("accessibility" = 
false). Could be since setting final fields is allowed in the old mode. Fixed 
also by r135, change is 
http://code.google.com/p/beanshell2/source/diff?spec=svn135&r=135&format=side&pa
th=/branches/v2.1/src/bsh/Variable.java 

Original comment by pejob...@gmail.com on 27 Sep 2013 at 3:42

@GoogleCodeExporter
Copy link
Author

Issue 97 has been merged into this issue.

Original comment by pejob...@gmail.com on 10 Feb 2014 at 9:55

@GoogleCodeExporter
Copy link
Author

Issue 98 has been merged into this issue.

Original comment by pejob...@gmail.com on 10 Feb 2014 at 2:58

@GoogleCodeExporter
Copy link
Author

Issue 99 has been merged into this issue.

Original comment by pejob...@gmail.com on 20 Feb 2014 at 12:12

@GoogleCodeExporter
Copy link
Author

This change makes the accessibility.bsh fail in line 87 when accessing a static 
public member (in Java 1.6.0_45 ) ( mypackage.Accessibility1.supersfield4 )

Original comment by snap...@googlemail.com on 4 Jan 2015 at 7:00

@GoogleCodeExporter
Copy link
Author

Is this really because of the changes here? There is a comment over the 
mentioned line: "why is this broken?".
Sounds for me like this was broken before (the script was never changed after 
the initial fork).

Original comment by pejob...@gmail.com on 12 Jan 2015 at 8:33

nickl- added a commit to beanshell/beanshell that referenced this issue Nov 8, 2017
Merge pejobo/beanshell2@4df454b fix for pejobo/beanshell2#88 prevent obsolete calls to j.l.reflect.AccessibleObject.setAccessible(true)
nickl- added a commit to beanshell/beanshell that referenced this issue Nov 8, 2017
Merge pejobo/beanshell2@09383fe fix for pejobo/beanshell2#88 do not swallow java.lang.SecurityException
nickl- added a commit to beanshell/beanshell that referenced this issue May 14, 2018
Merge pejobo/beanshell2@904e1e3 fix for pejobo/beanshell2#88
- fixed forcing of SecurityException when switching on accessibility
- fixed check if setAccessible is necessary
nickl- added a commit to beanshell/beanshell that referenced this issue May 14, 2018
Merge pejobo/beanshell2@b6a99ba fix for pejobo/beanshell2#88
- do not call "Capabilities.setAccessibility(true)" when generating class instances
- workaround for (package) protected constructors not callable from script without accessibility
- improve exception handling
- fix for initialisation of local final variables from constructor
nickl- added a commit to beanshell/beanshell that referenced this issue May 14, 2018
nickl- added a commit to beanshell/beanshell that referenced this issue May 14, 2018
Merge pejobo/beanshell2@797ee8a fix for pejobo/beanshell2#88
test case for pejobo/beanshell2##97, pejobo/beanshell2#98, and pejobo/beanshell2##99
nickl- added a commit to beanshell/beanshell that referenced this issue Jan 7, 2019
Merge pejobo/beanshell2@4df454b fix for pejobo/beanshell2#88 prevent obsolete calls to j.l.reflect.AccessibleObject.setAccessible(true)
nickl- added a commit to beanshell/beanshell that referenced this issue Jan 7, 2019
Merge pejobo/beanshell2@09383fe fix for pejobo/beanshell2#88 do not swallow java.lang.SecurityException
nickl- added a commit to beanshell/beanshell that referenced this issue Jan 7, 2019
Merge pejobo/beanshell2@904e1e3 fix for pejobo/beanshell2#88
- fixed forcing of SecurityException when switching on accessibility
- fixed check if setAccessible is necessary
nickl- added a commit to beanshell/beanshell that referenced this issue Jan 7, 2019
Merge pejobo/beanshell2@b6a99ba fix for pejobo/beanshell2#88
- do not call "Capabilities.setAccessibility(true)" when generating class instances
- workaround for (package) protected constructors not callable from script without accessibility
- improve exception handling
- fix for initialisation of local final variables from constructor
nickl- added a commit to beanshell/beanshell that referenced this issue Jan 7, 2019
nickl- added a commit to beanshell/beanshell that referenced this issue Jan 7, 2019
Merge pejobo/beanshell2@797ee8a fix for pejobo/beanshell2#88
test case for pejobo/beanshell2##97, pejobo/beanshell2#98, and pejobo/beanshell2##99
nickl- added a commit to beanshell/beanshell that referenced this issue Jan 7, 2019
Merge pejobo/beanshell2@4df454b fix for pejobo/beanshell2#88 prevent obsolete calls to j.l.reflect.AccessibleObject.setAccessible(true)
nickl- added a commit to beanshell/beanshell that referenced this issue Jan 7, 2019
Merge pejobo/beanshell2@09383fe fix for pejobo/beanshell2#88 do not swallow java.lang.SecurityException
nickl- added a commit to beanshell/beanshell that referenced this issue Jan 7, 2019
Merge pejobo/beanshell2@904e1e3 fix for pejobo/beanshell2#88
- fixed forcing of SecurityException when switching on accessibility
- fixed check if setAccessible is necessary
nickl- added a commit to beanshell/beanshell that referenced this issue Jan 7, 2019
Merge pejobo/beanshell2@b6a99ba fix for pejobo/beanshell2#88
- do not call "Capabilities.setAccessibility(true)" when generating class instances
- workaround for (package) protected constructors not callable from script without accessibility
- improve exception handling
- fix for initialisation of local final variables from constructor
nickl- added a commit to beanshell/beanshell that referenced this issue Jan 7, 2019
nickl- added a commit to beanshell/beanshell that referenced this issue Jan 7, 2019
Merge pejobo/beanshell2@797ee8a fix for pejobo/beanshell2#88
test case for pejobo/beanshell2##97, pejobo/beanshell2#98, and pejobo/beanshell2##99
nickl- added a commit to beanshell/beanshell that referenced this issue Mar 19, 2019
Merge pejobo/beanshell2@4df454b fix for pejobo/beanshell2#88 prevent obsolete calls to j.l.reflect.AccessibleObject.setAccessible(true)
nickl- added a commit to beanshell/beanshell that referenced this issue Mar 19, 2019
Merge pejobo/beanshell2@09383fe fix for pejobo/beanshell2#88 do not swallow java.lang.SecurityException
nickl- added a commit to beanshell/beanshell that referenced this issue Mar 19, 2019
Merge pejobo/beanshell2@904e1e3 fix for pejobo/beanshell2#88
- fixed forcing of SecurityException when switching on accessibility
- fixed check if setAccessible is necessary
nickl- added a commit to beanshell/beanshell that referenced this issue Mar 19, 2019
Merge pejobo/beanshell2@b6a99ba fix for pejobo/beanshell2#88
- do not call "Capabilities.setAccessibility(true)" when generating class instances
- workaround for (package) protected constructors not callable from script without accessibility
- improve exception handling
- fix for initialisation of local final variables from constructor
nickl- added a commit to beanshell/beanshell that referenced this issue Mar 19, 2019
nickl- added a commit to beanshell/beanshell that referenced this issue Mar 19, 2019
Merge pejobo/beanshell2@797ee8a fix for pejobo/beanshell2#88
test case for pejobo/beanshell2##97, pejobo/beanshell2#98, and pejobo/beanshell2##99
patniemeyer pushed a commit to beanshell/beanshell that referenced this issue Dec 6, 2023
Merge pejobo/beanshell2@4df454b fix for pejobo/beanshell2#88 prevent obsolete calls to j.l.reflect.AccessibleObject.setAccessible(true)
patniemeyer pushed a commit to beanshell/beanshell that referenced this issue Dec 6, 2023
Merge pejobo/beanshell2@09383fe fix for pejobo/beanshell2#88 do not swallow java.lang.SecurityException
patniemeyer pushed a commit to beanshell/beanshell that referenced this issue Dec 6, 2023
Merge pejobo/beanshell2@904e1e3 fix for pejobo/beanshell2#88
- fixed forcing of SecurityException when switching on accessibility
- fixed check if setAccessible is necessary
patniemeyer pushed a commit to beanshell/beanshell that referenced this issue Dec 6, 2023
Merge pejobo/beanshell2@b6a99ba fix for pejobo/beanshell2#88
- do not call "Capabilities.setAccessibility(true)" when generating class instances
- workaround for (package) protected constructors not callable from script without accessibility
- improve exception handling
- fix for initialisation of local final variables from constructor
patniemeyer pushed a commit to beanshell/beanshell that referenced this issue Dec 6, 2023
patniemeyer pushed a commit to beanshell/beanshell that referenced this issue Dec 6, 2023
Merge pejobo/beanshell2@797ee8a fix for pejobo/beanshell2#88
test case for pejobo/beanshell2##97, pejobo/beanshell2#98, and pejobo/beanshell2##99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant