m3 Security Fixes

This commit is contained in:
Mark Gregory
2026-09-17 10:24:14 +01:00
parent 74f2387dfe
commit c9856d58c1
20 changed files with 234 additions and 201 deletions
@@ -9,6 +9,10 @@ use Str;
class execSummaryLineController extends Controller
{
private const FIRST_DAY_THIS_MONTH = 'first day of this month';
private const LAST_DAY_THIS_MONTH = 'last day of this month';
private const ONE_YEAR_AGO = '-1 year';
public static function index(Request $request)
{
try {
@@ -82,12 +86,12 @@ class execSummaryLineController extends Controller
$firstDay = isset($request->REPORTDATE) ? \DateTime::createFromFormat('Y-m', $request->REPORTDATE) : null;
$lastDay = (clone $firstDay);
$reportDate = $firstDay->modify('-11 months')->modify('first day of this month')->format('Ymd'); //
$toreportDate = $lastDay ? $lastDay->modify('last day of this month')->format('Ymd') : '';
$reportDate = $firstDay->modify('-11 months')->modify(self::FIRST_DAY_THIS_MONTH)->format('Ymd'); //
$toreportDate = $lastDay ? $lastDay->modify(self::LAST_DAY_THIS_MONTH)->format('Ymd') : '';
// Last Year Dates
// Same period, but for Last Year (LY)
$reportDateLY = (clone $firstDay)->modify('-1 year')->modify('first day of this month')->format('Ymd');
$toreportDateLY = (clone $lastDay)->modify('-1 year')->modify('last day of this month')->format('Ymd');
$reportDateLY = (clone $firstDay)->modify(self::ONE_YEAR_AGO)->modify(self::FIRST_DAY_THIS_MONTH)->format('Ymd');
$toreportDateLY = (clone $lastDay)->modify(self::ONE_YEAR_AGO)->modify(self::LAST_DAY_THIS_MONTH)->format('Ymd');
// Build SQL
$selectContent = "with tempfile as (
@@ -121,12 +125,12 @@ class execSummaryLineController extends Controller
case 'custom':
// Set Dates based on reportPeriod type
$firstDay = isset($request->REPORTDATE) ? \DateTime::createFromFormat('Y-m', $request->REPORTDATE) : '';
$reportDate = $firstDay->modify('first day of this month')->format('Ymd');
$toreportDate = $firstDay->modify('last day of this month')->format('Ymd');
$reportDate = $firstDay->modify(self::FIRST_DAY_THIS_MONTH)->format('Ymd');
$toreportDate = $firstDay->modify(self::LAST_DAY_THIS_MONTH)->format('Ymd');
// Last Year Dates
$reportDateLY = (clone $firstDay)->modify('-1 year')->modify('first day of this month')->format('Ymd');
$toreportDateLY = (clone $firstDay)->modify('-1 year')->modify('last day of this month')->format('Ymd');
$reportDateLY = (clone $firstDay)->modify(self::ONE_YEAR_AGO)->modify(self::FIRST_DAY_THIS_MONTH)->format('Ymd');
$toreportDateLY = (clone $firstDay)->modify(self::ONE_YEAR_AGO)->modify(self::LAST_DAY_THIS_MONTH)->format('Ymd');
// Build SQL
$selectContent = "with tempfile as (