Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeException: Could not send site statistics to remote server: Invalid data submission. #44736

Open
chmst opened this issue Jan 15, 2025 · 3 comments
Labels

Comments

@chmst
Copy link
Contributor

chmst commented Jan 15, 2025

Steps to reproduce the issue

The statistics Plugin throws this messag at first login to the backend of different sites.
It affects sites where the user accepted to send statistic data after installation.
Not sure when I noticed this at the first time, maybe since J4.2? I had this on localhost under xampp and thought that it is caused by a misconfiguration of my environment.

But now i see it reported from different users and also on own sites which are in a subdomain.

Expected result

No error message

Actual result

RuntimeException: Could not send site statistics to remote server: Invalid data submission.

System information (as much as possible)

PHP 8.2 or higher
online on subdomains and on localhost under xampp (win11)

Additional comments

In my application it affects only sites which are transferred via akeeba backup, no clue if this is relevant.

@brianteeman
Copy link
Contributor

is the value of $secret unique across the sites?

@alikon
Copy link
Contributor

alikon commented Jan 16, 2025

got the same

Image

with a request like this

Image

in my case the problem arise from https://github.com/joomla/statistics-server
i suspect don't validate the input in some circumstances

https://github.com/joomla/statistics-server/blob/4e8bcaa164b5002683ed131fcc137be7f9950dcf/src/Controllers/SubmitDataController.php#L100-L138

    // Validate the submitted data
    $data['php_version'] = $this->checkPHPVersion($data['php_version']);
    $data['cms_version'] = $this->checkCMSVersion($data['cms_version']);
    $data['db_type']     = $this->checkDatabaseType($data['db_type']);
    $data['db_version']  = $this->validateVersionNumber($data['db_version']);


    // We require at a minimum a unique ID and the CMS version
    if (empty($data['unique_id']) || (empty($data['cms_version']) && $data['cms_version'] !== false)) {
        $this->getApplication()->getLogger()->info(
            'Missing required data from request.',
            ['postData' => $originalData]
        );


        /** @var JsonResponse $response */
        $response = $this->getApplication()->getResponse();
        $response = $response->withPayload(
            [
                'error'   => true,
                'message' => 'There was an error storing the data.',
            ]
        );
        $response = $response->withStatus(500);


        $this->getApplication()->setResponse($response);


        return true;
    }


    // If the below data does not pass tests, we do not accept the POST
    if ($data['php_version'] === false || $data['cms_version'] === false || $data['db_type'] === false || $data['db_version'] === false) {
        /** @var JsonResponse $response */
        $response = $this->getApplication()->getResponse();
        $response = $response->withPayload(
            [
                'error'   => true,
                'message' => 'Invalid data submission.',
            ]
        );
        $response = $response->withStatus(500);

@chmst
Copy link
Contributor Author

chmst commented Jan 16, 2025

is the value of $secret unique across the sites?

Indeed, good idea. I changed the secret Key in one of the sites before first login and the message did not appear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants