From f66611ce1832ad3b8411dc70ddd63074bae7911e Mon Sep 17 00:00:00 2001 From: Dmitry Karpukhin Date: Fri, 16 Jan 2026 11:17:32 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87?= =?UTF-8?q?=D0=B8=D0=BA=20=D0=B2=D0=B5=D0=B1=D1=85=D1=83=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B3=D0=B8=D1=82=D0=BB=D0=B0=D0=B1=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/pull.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 public/pull.php diff --git a/public/pull.php b/public/pull.php new file mode 100644 index 0000000..e973121 --- /dev/null +++ b/public/pull.php @@ -0,0 +1,28 @@ + Date: Fri, 16 Jan 2026 11:26:56 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=201=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B3=D0=B8=D1=82=D0=BB=D0=B0=D0=B1=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/pull.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/pull.php b/public/pull.php index e973121..083f2a8 100644 --- a/public/pull.php +++ b/public/pull.php @@ -6,7 +6,7 @@ $hash = hash_hmac('sha256', $payload, $key, false); $signature = $_SERVER['HTTP_X_GITEA_SIGNATURE']?? ''; - +file_put_contents("/var/www/lk/storage/logs/temp_sign", print_r($signature, 1)); // check payload signature against header signature if ($hash !== $signature) { @@ -15,6 +15,7 @@ } $json = json_decode($payload, true); +file_put_contents("/var/www/lk/storage/logs/temp_json", print_r($json, 1)); if (json_last_error() !== JSON_ERROR_NONE) { @@ -24,5 +25,6 @@ if(strcmp($json['object_kind'], 'push') == 0) { - shell_exec("cd /var/www/lk && git reset --hard HEAD && git pull"); + $result = shell_exec("cd /var/www/lk && git reset --hard HEAD && git pull"); + file_put_contents("/var/www/lk/storage/logs/temp_exec", print_r($result, 1)); } \ No newline at end of file From e16aea039326dbf3fc738d3f100460774de69251 Mon Sep 17 00:00:00 2001 From: Dmitry Karpukhin Date: Fri, 16 Jan 2026 11:33:29 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=202=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B3=D0=B8=D1=82=D0=BB=D0=B0=D0=B1=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/pull.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/pull.php b/public/pull.php index 083f2a8..ba3abf3 100644 --- a/public/pull.php +++ b/public/pull.php @@ -1,4 +1,5 @@ Date: Fri, 16 Jan 2026 11:35:22 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=203=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B3=D0=B8=D1=82=D0=BB=D0=B0=D0=B1=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/pull.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/pull.php b/public/pull.php index ba3abf3..7791dce 100644 --- a/public/pull.php +++ b/public/pull.php @@ -1,5 +1,5 @@ Date: Fri, 16 Jan 2026 11:40:58 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=204=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B3=D0=B8=D1=82=D0=BB=D0=B0=D0=B1=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/pull.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/public/pull.php b/public/pull.php index 7791dce..5c094c7 100644 --- a/public/pull.php +++ b/public/pull.php @@ -12,7 +12,7 @@ if ($hash !== $signature) { error_log('FAILED - payload signature mismatch'); - exit(); + exit("wrong signature"); } $json = json_decode($payload, true); @@ -21,11 +21,13 @@ if (json_last_error() !== JSON_ERROR_NONE) { error_log('FAILED - json decode - '. json_last_error()); - exit(); + exit(json_last_error()); } if(strcmp($json['object_kind'], 'push') == 0) { $result = shell_exec("cd /var/www/lk && git reset --hard HEAD && git pull"); file_put_contents("/var/www/lk/storage/logs/temp_exec", print_r($result, 1)); -} \ No newline at end of file + echo "

$result

"; +} + From 2c5bef703d9ad4fd1cb1333c57350ef9c865b3b0 Mon Sep 17 00:00:00 2001 From: Dmitry Karpukhin Date: Fri, 16 Jan 2026 11:43:00 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=205=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B3=D0=B8=D1=82=D0=BB=D0=B0=D0=B1=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/pull.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/pull.php b/public/pull.php index 5c094c7..2dc7f67 100644 --- a/public/pull.php +++ b/public/pull.php @@ -1,5 +1,5 @@ Date: Fri, 16 Jan 2026 11:54:34 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=206=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B3=D0=B8=D1=82=D0=BB=D0=B0=D0=B1=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/pull.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/public/pull.php b/public/pull.php index 2dc7f67..a81e11d 100644 --- a/public/pull.php +++ b/public/pull.php @@ -7,7 +7,7 @@ $hash = hash_hmac('sha256', $payload, $key, false); $signature = $_SERVER['HTTP_X_GITEA_SIGNATURE']?? ''; -file_put_contents("/var/www/lk/storage/logs/temp_sign", print_r($signature, 1)); + // check payload signature against header signature if ($hash !== $signature) { @@ -16,7 +16,6 @@ } $json = json_decode($payload, true); -file_put_contents("/var/www/lk/storage/logs/temp_json", print_r($json, 1)); if (json_last_error() !== JSON_ERROR_NONE) { @@ -24,10 +23,9 @@ exit(json_last_error()); } -if(strcmp($json['object_kind'], 'push') == 0) +if($json['total_commits'] > 0) { $result = shell_exec("cd /var/www/lk && git reset --hard HEAD && git pull"); - file_put_contents("/var/www/lk/storage/logs/temp_exec", print_r($result, 1)); echo "

$result

"; } From bdcd4d4cca18cffc0e707ec3aff0d931f39250f6 Mon Sep 17 00:00:00 2001 From: Dmitry Karpukhin Date: Fri, 16 Jan 2026 11:58:20 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=207=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B3=D0=B8=D1=82=D0=BB=D0=B0=D0=B1=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/pull.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/pull.php b/public/pull.php index a81e11d..e4db6e7 100644 --- a/public/pull.php +++ b/public/pull.php @@ -1,5 +1,5 @@ Date: Fri, 16 Jan 2026 12:05:58 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=208=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B3=D0=B8=D1=82=D0=BB=D0=B0=D0=B1=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/pull.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/pull.php b/public/pull.php index e4db6e7..5f103dc 100644 --- a/public/pull.php +++ b/public/pull.php @@ -25,7 +25,8 @@ if($json['total_commits'] > 0) { - $result = shell_exec("cd /var/www/lk && git reset --hard HEAD && git pull"); +// $result = shell_exec("cd /var/www/lk && git reset --hard HEAD && git pull"); + $result = shell_exec("whoami"); echo "

$result

"; } From 2513a062b283611c2be36f236969de93a959a703 Mon Sep 17 00:00:00 2001 From: Dmitry Karpukhin Date: Fri, 16 Jan 2026 12:07:17 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=208=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B3=D0=B8=D1=82=D0=BB=D0=B0=D0=B1=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/pull.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/pull.php b/public/pull.php index 5f103dc..b15f311 100644 --- a/public/pull.php +++ b/public/pull.php @@ -1,5 +1,5 @@ Date: Fri, 16 Jan 2026 12:15:29 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=209=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B3=D0=B8=D1=82=D0=BB=D0=B0=D0=B1=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/pull.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/public/pull.php b/public/pull.php index b15f311..8535fb5 100644 --- a/public/pull.php +++ b/public/pull.php @@ -1,5 +1,5 @@ 0) { -// $result = shell_exec("cd /var/www/lk && git reset --hard HEAD && git pull"); - $result = shell_exec("whoami"); + $result = shell_exec("cd /var/www/lk && git reset --hard HEAD && git pull"); echo "

$result

"; } From e76ba4f20b38977ae5a0b14fb086eeab750c9dd2 Mon Sep 17 00:00:00 2001 From: Dmitry Karpukhin Date: Fri, 16 Jan 2026 12:17:00 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=2010=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B3=D0=B8=D1=82=D0=BB=D0=B0=D0=B1=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/pull.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/pull.php b/public/pull.php index 8535fb5..efde1dc 100644 --- a/public/pull.php +++ b/public/pull.php @@ -1,5 +1,5 @@ Date: Fri, 16 Jan 2026 12:33:18 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=2011=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B3=D0=B8=D1=82=D0=BB=D0=B0=D0=B1=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/pull.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/pull.php b/public/pull.php index efde1dc..8535fb5 100644 --- a/public/pull.php +++ b/public/pull.php @@ -1,5 +1,5 @@