Skip to content

Commit 86721ce

Browse files
Potential fix for pull request finding 'CodeQL / Use of a broken or weak cryptographic algorithm'
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 72dbc86 commit 86721ce

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

packages/lib/storage/providers/ovhcloud.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* API reference: https://api.eu.ovhcloud.com/console/?section=%2FpublicCloud&branch=v2
1616
*/
1717

18-
import { createHash } from 'crypto'
18+
import { createHmac } from 'crypto'
1919
import { getIntegrations } from '@/packages/lib/config'
2020

2121
// OVH endpoint base URLs keyed by endpoint name
@@ -71,14 +71,13 @@ function signOVHRequest(
7171
timestamp: number
7272
): string {
7373
const toSign = [
74-
appSecret,
7574
consumerKey,
7675
method.toUpperCase(),
7776
url,
7877
body,
7978
String(timestamp),
8079
].join('+')
81-
return '$1$' + createHash('sha1').update(toSign).digest('hex')
80+
return '$1$' + createHmac('sha1', appSecret).update(toSign).digest('hex')
8281
}
8382

8483
async function ovhRequest<T>(

0 commit comments

Comments
 (0)