[ 
https://issues.apache.org/jira/browse/GROOVY-12369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18111995#comment-18111995
 ] 

ASF GitHub Bot commented on GROOVY-12369:
-----------------------------------------

paulk-asert opened a new pull request, #2893:
URL: https://github.com/apache/groovy/pull/2893

   …le cache
   
   uninstallArtifact deletes the jars named by a module's cached ivy 
descriptor. The jar path was new File(jardir, name) with name taken from the 
descriptor's artifact attributes unchecked, so a name carrying a path separator 
or a ".." segment deleted a file outside the module's jars directory:
   
       <artifact name="../victim" .../>
       -> new File(jardir, "../victim-1.0.jar").delete()   above jardir
   
   The deletion is now skipped, with a warning, unless the resolved file is 
inside the jars directory. The check is on canonical paths, so a ".." or a 
symbolic link along the way cannot carry it out, and it covers the version, 
classifier and extension that are concatenated into the name as well.
   
   Strictly this is out of the security model: a crafted descriptor is cached 
only by resolving from a repository, and resolving from an untrusted repository 
already runs its code, so a delete-on-uninstall is weaker than what such a 
repository already achieved. It is fixed anyway, as defense in depth and 
because a tool should not delete outside its own cache whatever a descriptor 
says, matching the containment added for deleteDir and groovydoc.
   
   The regression test builds a module cache with a traversing artifact name, 
runs uninstall, and asserts the outside file survives while an ordinary 
artifact is still deleted; it was confirmed to delete the outside file without 
the guard. It runs under -Djunit.network=true with the other groovy.grape 
tests, though it needs no network itself.




> Harden Grape uninstall
> ----------------------
>
>                 Key: GROOVY-12369
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12369
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Priority: Major
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to