mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 17:04:32 +00:00
fix(security): harden hook and device token auth
This commit is contained in:
@@ -2,6 +2,7 @@ import { randomUUID } from "node:crypto";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { resolveStateDir } from "../config/paths.js";
|
||||
import { safeEqualSecret } from "../security/secret-equal.js";
|
||||
|
||||
export type DevicePairingPendingRequest = {
|
||||
requestId: string;
|
||||
@@ -431,7 +432,7 @@ export async function verifyDeviceToken(params: {
|
||||
if (entry.revokedAtMs) {
|
||||
return { ok: false, reason: "token-revoked" };
|
||||
}
|
||||
if (entry.token !== params.token) {
|
||||
if (!safeEqualSecret(params.token, entry.token)) {
|
||||
return { ok: false, reason: "token-mismatch" };
|
||||
}
|
||||
const requestedScopes = normalizeScopes(params.scopes);
|
||||
|
||||
Reference in New Issue
Block a user