You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by github-code-scanning on 2023/01/23 10:59:23 UTC

[GitHub] [directory-kerby] github-code-scanning[bot] commented on a diff in pull request #131: Make sure the keytab file is being written out to the correct directory

github-code-scanning[bot] commented on code in PR #131:
URL: https://github.com/apache/directory-kerby/pull/131#discussion_r1083913993


##########
has-project/has-server/src/main/java/org/apache/kerby/has/server/web/rest/KadminApi.java:
##########
@@ -116,11 +117,18 @@
                                                                             .replace('?', '-')
                                             + ".keytab");
                             try {
+                                // Check we are not writing out of the desired target directory
+                                if (!keytabFile.getCanonicalPath().startsWith(path.getCanonicalPath())) {

Review Comment:
   ## Partial path traversal vulnerability from remote
   
   Partial Path Traversal Vulnerability due to insufficient guard against path traversal from [user-supplied data](1).
   
   [Show more details](https://github.com/apache/directory-kerby/security/code-scanning/25)



##########
has-project/has-server/src/main/java/org/apache/kerby/has/server/web/rest/KadminApi.java:
##########
@@ -134,14 +142,21 @@
~                } else {
~                    File path = new File("/tmp/" + System.currentTimeMillis());
                     if (path.mkdirs()) {
                         File keytabFile = new File(path, principal.replace('/', '-') + ".keytab");
                         try {
+                            // Check we are not writing out of the desired target directory
+                            if (!keytabFile.getCanonicalPath().startsWith(path.getCanonicalPath())) {

Review Comment:
   ## Partial path traversal vulnerability from remote
   
   Partial Path Traversal Vulnerability due to insufficient guard against path traversal from [user-supplied data](1).
   
   [Show more details](https://github.com/apache/directory-kerby/security/code-scanning/26)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@directory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@directory.apache.org
For additional commands, e-mail: dev-help@directory.apache.org