diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..bae6fa5 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,47 @@ +name: "CodeQL" + +on: + push: + branches: [main, master, develop, regression-audit] + paths-ignore: + - "**/*.php" + - "**/*.md" + pull_request: + branches: [main, master, develop, regression-audit] + paths-ignore: + - "**/*.php" + - "**/*.md" + schedule: + - cron: "30 1 * * 1" + workflow_dispatch: + +concurrency: + group: codeql-${{ github.ref }} + cancel-in-progress: true + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + actions: read + contents: read + security-events: write + strategy: + fail-fast: false + matrix: + language: ["javascript-typescript", "python", "ruby"] + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - name: Initialize CodeQL + uses: github/codeql-action/init@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3 + with: + languages: ${{ matrix.language }} + - name: Autobuild + uses: github/codeql-action/autobuild@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3 + with: + category: "/language:${{ matrix.language }}" diff --git a/syslog.php b/syslog.php index 50bd2e1..7db1ef7 100644 --- a/syslog.php +++ b/syslog.php @@ -1191,7 +1191,7 @@ function syslog_filter($sql_where, $tab) { - '> + '> ' class='calendar fa fa-calendar-alt' id='startDate'> @@ -1200,7 +1200,7 @@ function syslog_filter($sql_where, $tab) { - '> + '> ' class='calendar fa fa-calendar-alt' id='endDate'> @@ -1472,7 +1472,7 @@ function syslog_filter($sql_where, $tab) { - '> + '> diff --git a/syslog_alerts.php b/syslog_alerts.php index 1397791..1c9d9ac 100644 --- a/syslog_alerts.php +++ b/syslog_alerts.php @@ -934,20 +934,7 @@ function import() { } function alert_import() { - $import_text = get_nfilter_request_var('import_text'); - - if (trim($import_text) != '') { - /* textbox input */ - $xml_data = $import_text; - } elseif (($_FILES['import_file']['tmp_name'] != 'none') && ($_FILES['import_file']['tmp_name'] != '')) { - /* file upload */ - $fp = fopen($_FILES['import_file']['tmp_name'],'r'); - $xml_data = fread($fp, filesize($_FILES['import_file']['tmp_name'])); - fclose($fp); - } else { - header('Location: syslog_alerts.php?header=false'); - exit; - } + $xml_data = syslog_get_import_xml_payload('syslog_alerts.php?header=false'); $xml_array = xml2array($xml_data); diff --git a/syslog_removal.php b/syslog_removal.php index be149ef..51fa924 100644 --- a/syslog_removal.php +++ b/syslog_removal.php @@ -731,20 +731,7 @@ function import() { } function removal_import() { - $import_text = get_nfilter_request_var('import_text'); - - if (trim($import_text) != '') { - /* textbox input */ - $xml_data = $import_text; - } elseif (($_FILES['import_file']['tmp_name'] != 'none') && ($_FILES['import_file']['tmp_name'] != '')) { - /* file upload */ - $fp = fopen($_FILES['import_file']['tmp_name'],'r'); - $xml_data = fread($fp, filesize($_FILES['import_file']['tmp_name'])); - fclose($fp); - } else { - header('Location: syslog_removal.php?header=false'); - exit; - } + $xml_data = syslog_get_import_xml_payload('syslog_removal.php?header=false'); /* obtain debug information if it's set */ $xml_array = xml2array($xml_data); diff --git a/syslog_reports.php b/syslog_reports.php index e7340aa..1a97b3a 100644 --- a/syslog_reports.php +++ b/syslog_reports.php @@ -796,20 +796,7 @@ function import() { } function report_import() { - $import_text = get_nfilter_request_var('import_text'); - - if (trim($import_text) != '') { - /* textbox input */ - $xml_data = $import_text; - } elseif (($_FILES['import_file']['tmp_name'] != 'none') && ($_FILES['import_file']['tmp_name'] != '')) { - /* file upload */ - $fp = fopen($_FILES['import_file']['tmp_name'],'r'); - $xml_data = fread($fp, filesize($_FILES['import_file']['tmp_name'])); - fclose($fp); - } else { - header('Location: syslog_reports.php?header=false'); - exit; - } + $xml_data = syslog_get_import_xml_payload('syslog_reports.php?header=false'); /* obtain debug information if it's set */ $xml_array = xml2array($xml_data);