...
A comprehensive way of handling this issue is to grant the application the permissions to operate only on files present within the intended directory — the user's home directory in this example. This compliant solution specifies the absolute path of the program in its security policy file and grants java.io.FilePermission
with target /${user.home}/me*
and actions read
and write
.
Code Block | ||
---|---|---|
| ||
grant codeBase "file:/home/programpath/" { permission java.io.FilePermission "${user.home}/*", "read, write"; }; |
...
FIO02-C. Canonicalize path names originating from untrusted sources | ||||
FIO02-CPP. Canonicalize path names originating from untrusted sources | ||||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="69c45b3755fe45d4-981abb37-486744f4-9364adfc-c20fd46b97fe7745defe2cad"><ac:plain-text-body><![CDATA[ | [ISO/IEC TR 24772:2010 | http://www.aitcnet.org/isai/] | Path Traversal [EWR] | ]]></ac:plain-text-body></ac:structured-macro> |
CWE-171. Cleansing, canonicalization, and comparison errors | ||||
| CWE-647. Use of non-canonical URL paths for authorization decisions |
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="fba5856163944b69-0ef93364-4df148ff-99b88f11-6116822fd7464065c15c6ec9"><ac:plain-text-body><![CDATA[ | [[API 2006 | AA. Bibliography#API 06]] | [method getCanonicalPath() | http://java.sun.com/javase/6/docs/api/java/io/File.html#getCanonicalPath()] | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="d2816a493976c345-46ced655-4cb64a8c-9158a594-dc75a458b88c89b6f8da4c4d"><ac:plain-text-body><![CDATA[ | [[Harold 1999 | AA. Bibliography#Harold 99]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
...