author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 31925 | nashorn/test/script/sandbox/safeprops.js@85c87bc2f1f3 |
permissions | -rw-r--r-- |
23076
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
1 |
/* |
31925 | 2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
23076
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
4 |
* |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
8 |
* |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
13 |
* accompanied this code). |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
14 |
* |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
18 |
* |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
21 |
* questions. |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
22 |
*/ |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
23 |
|
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
24 |
/** |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
25 |
* Try to access System properties safe to read for any code. |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
26 |
* No security exception expected. |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
27 |
* |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
28 |
* @test |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
29 |
* @security |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
30 |
* @run |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
31 |
* @bug 8033924: Default permissions are not given for eval code |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
32 |
*/ |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
33 |
|
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
34 |
var propNames = [ |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
35 |
"java.version", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
36 |
"java.vendor", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
37 |
"java.vendor.url", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
38 |
"java.class.version", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
39 |
"os.name", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
40 |
"os.version", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
41 |
"os.arch", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
42 |
"file.separator", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
43 |
"path.separator", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
44 |
"line.separator", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
45 |
"java.specification.version", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
46 |
"java.specification.vendor", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
47 |
"java.specification.name", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
48 |
"java.vm.specification.version", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
49 |
"java.vm.specification.vendor", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
50 |
"java.vm.specification.name", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
51 |
"java.vm.version", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
52 |
"java.vm.vendor", |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
53 |
"java.vm.name" |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
54 |
]; |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
55 |
|
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
56 |
// no security exception expected |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
57 |
for (var p in propNames) { |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
58 |
java.lang.System.getProperty(propNames[p]); |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
59 |
} |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
60 |
|
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
61 |
// no security exception expected |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
62 |
for (var p in propNames) { |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
63 |
var name = propNames[p]; |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
64 |
eval('java.lang.System.getProperty(name)'); |
8660ebaaa2f2
8033924: Default permissions are not given for eval code
sundar
parents:
diff
changeset
|
65 |
} |