9 lines
731 B
PHP
9 lines
731 B
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
$repo = '/var/www/html';
|
|
$diff = shell_exec("cd $repo && git diff HEAD~1 --stat 2>/dev/null");
|
|
$files = intval(trim(shell_exec("cd $repo && git diff HEAD~1 --name-only 2>/dev/null | wc -l")));
|
|
$security = shell_exec("cd $repo && git diff HEAD~1 2>/dev/null | grep -inE 'password|secret|key|token|eval|exec|shell_exec' | head -5");
|
|
$sql = shell_exec("cd $repo && git diff HEAD~1 2>/dev/null | grep -inE 'SELECT.*FROM|INSERT.*INTO|DELETE.*FROM|DROP.*TABLE' | head -3");
|
|
echo json_encode(['ok'=>true,'files_changed'=>$files,'diff_stat'=>trim($diff),'security_flags'=>trim($security)?:'none','sql_flags'=>trim($sql)?:'none','verdict'=>empty(trim($security))?'APPROVE':'REVIEW NEEDED']);
|