Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions html/inc/db_ops.inc
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ class SqlQueryString {
$this->addeq('app_version_id');
$this->addeq('exit_status');
if (isset($_GET['nsecs'])) {
$_GET['mod_time'] = date("YmdHis",time() - $_GET['nsecs']);
$_GET['mod_time'] = date("YmdHis",time() - (int)$_GET['nsecs']);
}
$this->addgt('mod_time');
$this->addeq_not_CHOOSE_ALL('server_state');
Expand Down Expand Up @@ -439,17 +439,17 @@ function admin_show_result_summary() {
$_GET['sort_by'] = ''; // ignore sort

if (isset($_GET['appid'])) {
$query_appid = $_GET['appid'];
$query_appid = (int)$_GET['appid'];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: This cast protects only $main_query; $_GET['appid'] remains raw when $q->process_form_items() builds links to db_action.php. A payload such as 1' OR SLEEP(5) -- can execute when an admin follows one of those links. Normalize appid and workunitid before processing the form values, or make their query construction type-safe.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At html/inc/db_ops.inc, line 442:

<comment>This cast protects only `$main_query`; `$_GET['appid']` remains raw when `$q->process_form_items()` builds links to `db_action.php`. A payload such as `1' OR SLEEP(5) -- ` can execute when an admin follows one of those links. Normalize `appid` and `workunitid` before processing the form values, or make their query construction type-safe.</comment>

<file context>
@@ -439,17 +439,17 @@ function admin_show_result_summary() {
 
     if (isset($_GET['appid'])) {
-        $query_appid = $_GET['appid'];
+        $query_appid = (int)$_GET['appid'];
     } else {
         $query_appid = "";
</file context>

} else {
$query_appid = "";
}
$query_mod_time = 0;
if (isset($_GET['nsecs'])) {
//$query_mod_time = time() - $_GET['nsecs'];
$query_mod_time = $_GET['nsecs'];
$query_mod_time = (int)$_GET['nsecs'];
}
if (isset($_GET['workunitid'])) {
$query_wuid = $_GET['workunitid'];
$query_wuid = (int)$_GET['workunitid'];
} else {
$query_wuid = null;
}
Expand Down
Loading