Skip to content

Adds reporting around requests made by AI bots#23870

Merged
sgiehl merged 9 commits into5.x-devfrom
aiassistants
Dec 17, 2025
Merged

Adds reporting around requests made by AI bots#23870
sgiehl merged 9 commits into5.x-devfrom
aiassistants

Conversation

@sgiehl
Copy link
Copy Markdown
Member

@sgiehl sgiehl commented Dec 4, 2025

Description

This PR aims to gather all reporting related PRs for AI bots

Checklist

  • [NA] I have understood, reviewed, and tested all AI outputs before use
  • [NA] All AI instructions respect security, IP, and privacy rules

Review

@sgiehl sgiehl force-pushed the aiassistants branch 7 times, most recently from 5e512c1 to e590f05 Compare December 9, 2025 20:54
@sgiehl sgiehl added this to the 5.7.0 milestone Dec 12, 2025
COUNT(DISTINCT(CASE WHEN log_action.type = ? THEN log_action.name END)) AS uniq_downloads
FROM `$table` AS bot
LEFT JOIN `$actionTable` AS log_action ON log_action.idaction = bot.idaction_url
WHERE bot.bot_type = ? AND $where
Copy link
Copy Markdown

@aikido-pr-checks aikido-pr-checks Bot Dec 16, 2025

Choose a reason for hiding this comment

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

Potential SQL injection via string-based query concatenation - critical severity
SQL injection might be possible in these locations, especially if the strings being concatenated are controlled via user input.

Remediation: If possible, rebuild the query to use prepared statements or an ORM. If that is not possible, make sure the user input is verified or sanitized. As an added layer of protection, we also recommend installing a WAF that blocks SQL injection attacks.
View details in Aikido Security

$where = $logAggregator->getWhereStatement('log_visit', 'visit_last_action_time');

$visitsSql = sprintf(
"SELECT COUNT(*) FROM `%s` log_visit WHERE referer_type = ? AND $where",
Copy link
Copy Markdown

@aikido-pr-checks aikido-pr-checks Bot Dec 16, 2025

Choose a reason for hiding this comment

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

Potential SQL injection via string-based query concatenation - critical severity
SQL injection might be possible in these locations, especially if the strings being concatenated are controlled via user input.

Remediation: If possible, rebuild the query to use prepared statements or an ORM. If that is not possible, make sure the user input is verified or sanitized. As an added layer of protection, we also recommend installing a WAF that blocks SQL injection attacks.
View details in Aikido Security

GROUP BY `referer_name`",
Common::prefixTable('log_visit'),
Common::REFERRER_TYPE_AI_ASSISTANT,
$where
Copy link
Copy Markdown

@aikido-pr-checks aikido-pr-checks Bot Dec 16, 2025

Choose a reason for hiding this comment

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

Potential SQL injection via string-based query concatenation - high severity
SQL injection might be possible in these locations, especially if the strings being concatenated are controlled via user input.

Remediation: If possible, rebuild the query to use prepared statements or an ORM. If that is not possible, make sure the user input is verified or sanitized. As an added layer of protection, we also recommend installing a WAF that blocks SQL injection attacks.
View details in Aikido Security

@sgiehl sgiehl marked this pull request as ready for review December 16, 2025 14:11
* Adds archiving for new report(s)

* Add API methods for new report

* Add report classes

* Move AI Agent reports to bottom

* Add system tests for new report

* Adds UI tests for new report

* updates expected UI test files

* fix other tests

* do not double count acquired visits

* remove explicit plugin loading from ui tests

* updates expected UI test file
* Use a ranking query for bot requests

* try using with rollup again

* update with rollup implementation after fixes

* Fix sorting in database query
* Adds leaf row count functionality

* Adds archiving for new overview metrics

* Adds new overview reports and API

* add / adjust tests

* updates expected test files

* fix report category

* updates expected test files

* use ranking query for action type reports

* directly query all metrics for day archives

* include 410 in not found requests

* do not process and show unique pages and documents metrics for periods other than day

* updates expected test files

* Adjust tests

* remove pages & document report archiving
@sgiehl sgiehl merged commit bf4cbc7 into 5.x-dev Dec 17, 2025
27 of 29 checks passed
@sgiehl sgiehl deleted the aiassistants branch December 17, 2025 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants