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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]