惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
博客园_首页
WordPress大学
WordPress大学
大猫的无限游戏
大猫的无限游戏
有赞技术团队
有赞技术团队
阮一峰的网络日志
阮一峰的网络日志
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
酷 壳 – CoolShell
酷 壳 – CoolShell
Y
Y Combinator Blog
Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
云风的 BLOG
云风的 BLOG
博客园 - 司徒正美
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
N
Netflix TechBlog - Medium
Martin Fowler
Martin Fowler
宝玉的分享
宝玉的分享
G
Google Developers Blog
Last Week in AI
Last Week in AI

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
Bound native hook permission fingerprints (#71758) · open...
pashpashpash · 2026-04-26 · via Recent Commits to openclaw:main

@@ -122,6 +122,7 @@ const MAX_NATIVE_HOOK_RELAY_HISTORY_ARRAY_ITEMS = 50;

122122

const MAX_NATIVE_HOOK_RELAY_HISTORY_OBJECT_KEYS = 50;

123123

const MAX_PERMISSION_FALLBACK_KEYS = 200;

124124

const MAX_PERMISSION_FALLBACK_KEY_CHARS = 240;

125+

const MAX_PERMISSION_FINGERPRINT_SORT_KEYS = 200;

125126

const MAX_APPROVAL_TITLE_LENGTH = 80;

126127

const MAX_APPROVAL_DESCRIPTION_LENGTH = 700;

127128

const MAX_PERMISSION_APPROVALS_PER_WINDOW = 12;

@@ -442,7 +443,7 @@ async function runNativeHookRelayPermissionRequest(params: {

442443

const pendingApproval = pendingPermissionApprovals.get(approvalKey);

443444

try {

444445

const decision = await (pendingApproval ??

445-

requestNativeHookRelayPermissionApprovalWithBudget({

446+

startNativeHookRelayPermissionApprovalWithBudget({

446447

registration: params.registration,

447448

approvalKey,

448449

request,

@@ -463,7 +464,7 @@ async function runNativeHookRelayPermissionRequest(params: {

463464

return params.adapter.renderNoopResponse(params.invocation.event);

464465

}

465466466-

async function requestNativeHookRelayPermissionApprovalWithBudget(params: {

467+

async function startNativeHookRelayPermissionApprovalWithBudget(params: {

467468

registration: NativeHookRelayRegistration;

468469

approvalKey: string;

469470

request: NativeHookRelayPermissionApprovalRequest;

@@ -505,18 +506,18 @@ function permissionRequestFallbackKey(request: NativeHookRelayPermissionApproval

505506506507

function permissionRequestToolInputKeyFingerprint(toolInput: Record<string, unknown>): string {

507508

let fingerprint = "";

508-

let processed = 0;

509-

for (const key of Object.keys(toolInput).toSorted()) {

510-

if (processed >= MAX_PERMISSION_FALLBACK_KEYS) {

511-

break;

512-

}

509+

const { keys, truncated } = readBoundedOwnKeys(toolInput, MAX_PERMISSION_FALLBACK_KEYS);

510+

for (const key of keys) {

513511

const separator = fingerprint ? "," : "";

514512

const remaining = MAX_PERMISSION_FALLBACK_KEY_CHARS - fingerprint.length - separator.length;

515513

if (remaining <= 0) {

516514

break;

517515

}

518516

fingerprint += `${separator}${key.slice(0, remaining)}`;

519-

processed += 1;

517+

}

518+

if (truncated && fingerprint.length < MAX_PERMISSION_FALLBACK_KEY_CHARS) {

519+

const marker = `${fingerprint ? "," : ""}...`;

520+

fingerprint += marker.slice(0, MAX_PERMISSION_FALLBACK_KEY_CHARS - fingerprint.length);

520521

}

521522

return fingerprint || "none";

522523

}

@@ -559,15 +560,51 @@ function updateJsonHash(hash: ReturnType<typeof createHash>, value: JsonValue):

559560

return;

560561

}

561562

hash.update("{");

562-

for (const key of Object.keys(value).toSorted()) {

563+

const { keys, truncated } = readBoundedOwnKeys(value, MAX_PERMISSION_FINGERPRINT_SORT_KEYS);

564+

for (const key of keys) {

563565

hash.update(JSON.stringify(key));

564566

hash.update(":");

565567

updateJsonHash(hash, value[key]);

566568

hash.update(",");

567569

}

570+

if (truncated) {

571+

// Keep ordinary objects order-independent without sorting a broad native

572+

// hook payload. The tail remains content-sensitive in traversal order.

573+

const sortedKeySet = new Set(keys);

574+

hash.update("#object-tail:");

575+

for (const key in value) {

576+

if (!Object.prototype.hasOwnProperty.call(value, key) || sortedKeySet.has(key)) {

577+

continue;

578+

}

579+

hash.update(JSON.stringify(key));

580+

hash.update(":");

581+

updateJsonHash(hash, value[key]);

582+

hash.update(",");

583+

}

584+

}

568585

hash.update("}");

569586

}

570587588+

function readBoundedOwnKeys(

589+

value: Record<string, unknown>,

590+

maxKeys: number,

591+

): { keys: string[]; truncated: boolean } {

592+

const keys: string[] = [];

593+

let truncated = false;

594+

for (const key in value) {

595+

if (!Object.prototype.hasOwnProperty.call(value, key)) {

596+

continue;

597+

}

598+

if (keys.length >= maxKeys) {

599+

truncated = true;

600+

break;

601+

}

602+

keys.push(key);

603+

}

604+

keys.sort();

605+

return { keys, truncated };

606+

}

607+571608

function consumeNativeHookRelayPermissionBudget(relayId: string, now = Date.now()): boolean {

572609

const windowStart = now - PERMISSION_APPROVAL_WINDOW_MS;

573610

const timestamps = (permissionApprovalWindows.get(relayId) ?? []).filter(

@@ -1032,6 +1069,14 @@ export const __testing = {

10321069

): string {

10331070

return formatPermissionApprovalDescription(request);

10341071

},

1072+

permissionRequestContentFingerprintForTests(

1073+

request: NativeHookRelayPermissionApprovalRequest,

1074+

): string {

1075+

return permissionRequestContentFingerprint(request);

1076+

},

1077+

permissionRequestToolInputKeyFingerprintForTests(toolInput: Record<string, unknown>): string {

1078+

return permissionRequestToolInputKeyFingerprint(toolInput);

1079+

},

10351080

setNativeHookRelayPermissionApprovalRequesterForTests(

10361081

requester: NativeHookRelayPermissionApprovalRequester,

10371082

): void {