Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #30411
| From | Stanimir Stamenkov <s7an10@netscape.net> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Comparing some of the ways to create objects |
| Date | 2016-05-08 17:27 +0300 |
| Organization | A noiseless patient Spider |
| Message-ID | <ngni5e$ns6$1@dont-email.me> (permalink) |
| References | (5 earlier) <ne73l3$2i4$2@dont-email.me> <crgfgbd1s7r9irkgg6vbm7qt6e1e8a3ctd@4ax.com> <ne9go3$ehl$1@dont-email.me> <closures-20160409050628@ram.dialup.fu-berlin.de> <nebblk$6dj$1@dont-email.me> |
Sat, 9 Apr 2016 16:46:45 -0000 (UTC), /Scott Sauyet/:
> Stefan Ram wrote:
>> Scott Sauyet wrote:
>>
>>> But the privacy offered by these techniques, even without a keyword is
>>> actually much stronger than that offered by Java or C# (I don't know
>>> about C++.) In those languages, you can use reflection to to still get
>>> at the field. In Javascript closure-based privacy, it's really hidden.
>>
>> Java programs can be run with a security manager, and IIRC there is a
>> »suppressAccessChecks« permission that can be denied to deny access to
>> private fields via reflection.
>> (I am not sure about this, I haven't tested it today.)
>
> I'm more than six years out from regularly working with Java, so I may be
> a little rusty. But I believe that field is precisely the reverse: a
> tool to _allow_ otherwise restricted code from viewing private or
> protected members. That's certainly how the Javadocs seem to read. [1]
>
> [1]: <http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/ReflectPermission.html>
No contradiction here. While the default security manager, or may
be better stated having no security manager when you run a program
from the command line may allow you to suppress access checks for
private fields of any class via refection, running a code inside an
application or applet container may have a security manager
installed which prohibits the user code from doing it – at least for
framework/container (provided/built-in) classes (vs. user code
classes). The security manager is standard feature of the Java
sandboxing model. See that trying to override access checks may
still fail:
http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/AccessibleObject.html#setAccessible%28boolean%29
> First, if there is a security manager, its checkPermission method
> is called with a ReflectPermission("suppressAccessChecks")
> permission.
>
> Throws:
> SecurityException - if the request is denied.
java.lang.reflect.Field is a subclass of AccessibleObject.
--
Stanimir
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Comparing some of the ways to create objects John Harris <niam@jghnorth.org.uk.invalid> - 2016-04-03 16:09 +0100
Re: Comparing some of the ways to create objects Scott Sauyet <scott@sauyet.com> - 2016-04-04 04:15 +0000
Re: Comparing some of the ways to create objects Stefan Weiss <krewecherl@gmail.com> - 2016-04-04 15:20 +0200
Re: Comparing some of the ways to create objects Scott Sauyet <scott@sauyet.com> - 2016-04-05 04:04 +0000
Re: Comparing some of the ways to create objects John Harris <niam@jghnorth.org.uk.invalid> - 2016-04-04 16:48 +0100
Re: Comparing some of the ways to create objects Scott Sauyet <scott@sauyet.com> - 2016-04-05 04:04 +0000
Re: Comparing some of the ways to create objects John Harris <niam@jghnorth.org.uk.invalid> - 2016-04-07 15:07 +0100
Re: Comparing some of the ways to create objects Scott Sauyet <scott@sauyet.com> - 2016-04-08 01:10 +0000
Re: Comparing some of the ways to create objects John Harris <niam@jghnorth.org.uk.invalid> - 2016-04-08 14:55 +0100
Re: Comparing some of the ways to create objects Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-04 22:12 +0200
Re: Comparing some of the ways to create objects John Harris <niam@jghnorth.org.uk.invalid> - 2016-04-05 09:57 +0100
Re: Comparing some of the ways to create objects John Harris <niam@jghnorth.org.uk.invalid> - 2016-04-06 16:41 +0100
Re: Comparing some of the ways to create objects Scott Sauyet <scott@sauyet.com> - 2016-04-06 23:42 +0000
Re: Comparing some of the ways to create objects John Harris <niam@jghnorth.org.uk.invalid> - 2016-04-07 16:09 +0100
Re: Comparing some of the ways to create objects Scott Sauyet <scott@sauyet.com> - 2016-04-08 02:05 +0000
Re: Comparing some of the ways to create objects John Harris <niam@jghnorth.org.uk.invalid> - 2016-04-08 15:43 +0100
Re: Comparing some of the ways to create objects Scott Sauyet <scott@sauyet.com> - 2016-04-09 00:01 +0000
Re: Comparing some of the ways to create objects Scott Sauyet <scott@sauyet.com> - 2016-04-09 16:46 +0000
Re: Comparing some of the ways to create objects Scott Sauyet <scott@sauyet.com> - 2016-04-10 16:51 +0000
Re: Comparing some of the ways to create objects Stanimir Stamenkov <s7an10@netscape.net> - 2016-05-08 17:27 +0300
Re: Comparing some of the ways to create objects John Harris <niam@jghnorth.org.uk.invalid> - 2016-04-10 11:31 +0100
Re: Comparing some of the ways to create objects John Harris <niam@jghnorth.org.uk.invalid> - 2016-04-10 11:52 +0100
csiph-web