From 2d87065deb00d2b74c93b444b1b770451c20de40 Mon Sep 17 00:00:00 2001 From: Matthias Lucas Jaros Date: Sat, 15 Nov 2025 18:09:40 +0100 Subject: Refactoring --- src/git-run | 14 +++++++------- src/version | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/git-run b/src/git-run index e89a12a..8a0da81 100755 --- a/src/git-run +++ b/src/git-run @@ -15,8 +15,7 @@ end function verifyGitCommand # check given git command # basic form is '' - set -l matcher $argv - if test (count $matcher) -ne 2 + if test (count $argv) -ne 2 emit log_event DENY bad_format "argv=$argv" return 1 end @@ -57,15 +56,16 @@ end # redirect stdout/stderr to file, no information to potential attacker begin - set -l matcher (string match -r -g $_GIT_VALIDATION_REGEX -- "$argv") - verifyGitCommand $matcher; or exit $status + # parse command + set -l parsedCommand (string match -r -g $_GIT_VALIDATION_REGEX -- "$argv") + + verifyGitCommand $parsedCommand; or exit $status # extract variables - set gitCommand $matcher[1] - set -l repo $matcher[2] + set gitCommand $parsedCommand[1] # adjust repo path to /srv/repos - set repoDir /(string join -n '/' srv repos (string split '/' $repo)) + set repoDir /(string join -n '/' srv repos (string split '/' $parsedCommand[2])) # check if realPath is in jail under /srv/repos verifyRepoJail; or exit $status diff --git a/src/version b/src/version index ea710ab..6b3ae54 100644 --- a/src/version +++ b/src/version @@ -1 +1 @@ -1.2 \ No newline at end of file +1.3-SNAPSHOT \ No newline at end of file -- cgit v1.3.1