mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-06 04:10:52 +01:00
Validate filepath and filename to prevent path traversal (#1604)
Validate filepath and filename to prevent path traversal in modification command and provide validations for editor plugin. Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
This commit is contained in:
@@ -93,6 +93,11 @@ public class HgModifyCommand extends AbstractWorkingCopyCommand implements Modif
|
||||
private void addFileToHg(File file) {
|
||||
workingRepository.workingCopy().add(file.getAbsolutePath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isProtectedPath(Path path) {
|
||||
return path.startsWith(workingRepository.getDirectory().toPath().normalize().resolve(".hg"));
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
throwInternalRepositoryException("could not execute command on repository", e);
|
||||
|
||||
Reference in New Issue
Block a user