Compare commits

...

2 commits

Author SHA1 Message Date
Jesse Wierzbinski 71cb7738de
chore(federation): 🔖 [publish] Release 0.2.1
Some checks failed
Test Build / build (push) Successful in 52s
CodeQL Scan / Analyze (javascript-typescript) (push) Failing after 35s
Lint & Format / tests (push) Successful in 15s
Mirror to Codeberg / Mirror (push) Failing after 0s
Build & Publish Package / publish (push) Failing after 1m37s
Test Publish / build (client) (push) Successful in 54s
Test Publish / build (federation) (push) Successful in 56s
Run Tests / build (push) Failing after 5s
2025-02-18 12:17:10 +01:00
Jesse Wierzbinski f3cfcc746a
fix(federation): 🐛 Use encodeURI instead of encodeURIComponent
This method doesn't improperly URLencode the *entire* path including the slashes
2025-02-18 12:16:39 +01:00
3 changed files with 4 additions and 4 deletions

View file

@ -152,7 +152,7 @@ export class SignatureValidator {
new TextEncoder().encode(body),
);
const expectedSignedString = `${method.toLowerCase()} ${encodeURIComponent(url.pathname)} ${timestamp.getTime() / 1000} ${arrayBufferToBase64(digest)}`;
const expectedSignedString = `${method.toLowerCase()} ${encodeURI(url.pathname)} ${timestamp.getTime() / 1000} ${arrayBufferToBase64(digest)}`;
// Check if signed string is valid
const isValid = await crypto.subtle.verify(
@ -305,7 +305,7 @@ export class SignatureConstructor {
new TextEncoder().encode(body ?? ""),
);
const signedString = `${requestOrMethod.toLowerCase()} ${encodeURIComponent(
const signedString = `${requestOrMethod.toLowerCase()} ${encodeURI(
url.pathname,
)} ${finalTimestamp.getTime() / 1000} ${arrayBufferToBase64(digest)}`;

View file

@ -1,7 +1,7 @@
{
"$schema": "https://jsr.io/schema/config-file.v1.json",
"name": "@versia/federation",
"version": "0.2.0",
"version": "0.2.1",
"exports": {
".": "./index.ts",
"./types": "./types.ts",

View file

@ -1,7 +1,7 @@
{
"name": "@versia/federation",
"displayName": "Versia Federation",
"version": "0.2.0",
"version": "0.2.1",
"author": {
"email": "jesse.wierzbinski@lysand.org",
"name": "Jesse Wierzbinski (CPlusPatch)",