Skip to content

[Notifier] [OvhCloud] “Invalid signature” for message with slashes #39836

Closed
@OneT0uch

Description

@OneT0uch

Symfony version(s) affected: 5.1.

Description
"Invalid signature error" when i try to send a sms with ovh cloud which contain an url.

How to reproduce

$message = "https://symfony.com/doc/current/index.html"
$notification = (new Notification($message))
    ->content('foo')
    ->importance(Notification::IMPORTANCE_HIGH);

$recipient = new AdminRecipient('insert email', 'insert phonenumber');

$this->notifier->send($notification, $recipient);

Possible Solution
The json used as a signature is different from the json send by HTTPClient, resulting in an invalid signature

OvhCloudTransport.php (Line 79)
Remove \JSON_UNESCAPED_SLASHES

$toSign = $this->applicationSecret.'+'.$this->consumerKey.'+POST+'.$endpoint.'+'.json_encode($content, \JSON_UNESCAPED_SLASHES).'+'.$now;

to

$toSign = $this->applicationSecret.'+'.$this->consumerKey.'+POST+'.$endpoint.'+'.json_encode($content).'+'.$now;

Additional context
image

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