Skip to content

Validate response (e.g. status code and content type) #599

@kesselb

Description

@kesselb

updater/lib/Updater.php

Lines 495 to 509 in e73aa39

$response = curl_exec($curl);
if ($response === false) {
throw new \Exception('Could not do request to updater server: '.curl_error($curl));
}
curl_close($curl);
// Response can be empty when no update is available
if ($response === '') {
return [];
}
$xml = simplexml_load_string($response);
if ($xml === false) {
throw new \Exception('Could not parse updater server XML response');
}

simplexml_load_string expects a well-formed xml document.
We should use curl_getinfo to check for the status code and the content type before parsing it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions