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

推荐订阅源

爱范儿
爱范儿
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
博客园_首页
博客园 - 【当耐特】
量子位
S
SegmentFault 最新的问题
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Visual Studio Blog
T
Tailwind CSS Blog
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
Y
Y Combinator Blog
博客园 - 聂微东
The Cloudflare Blog
小众软件
小众软件
J
Java Code Geeks
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
月光博客
月光博客
H
Help Net Security
Jina AI
Jina 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
test: tighten nostr negative key assertions · openclaw/op...
steipete · 2026-05-09 · via Recent Commits to openclaw:main

@@ -20,6 +20,16 @@ function createCollectingMetrics() {

2020

};

2121

}

222223+

function expectThrowsError(run: () => unknown): void {

24+

let error: unknown;

25+

try {

26+

run();

27+

} catch (caught) {

28+

error = caught;

29+

}

30+

expect(error).toBeInstanceOf(Error);

31+

}

32+2333

// ============================================================================

2434

// Fuzz Tests for validatePrivateKey

2535

// ============================================================================

@@ -28,7 +38,7 @@ describe("validatePrivateKey fuzz", () => {

2838

describe("validatePrivateKey type confusion", () => {

2939

it("rejects non-string input", () => {

3040

for (const value of [null, undefined, 123, true, {}, [], () => {}]) {

31-

expect(() => validatePrivateKey(value as unknown as string)).toThrow();

41+

expectThrowsError(() => validatePrivateKey(value as unknown as string));

3242

}

3343

});

3444

});

@@ -49,42 +59,42 @@ describe("validatePrivateKey fuzz", () => {

4959

];

50605161

for (const key of invalidKeys) {

52-

expect(() => validatePrivateKey(key)).toThrow();

62+

expectThrowsError(() => validatePrivateKey(key));

5363

}

5464

});

5565

});

56665767

describe("edge cases", () => {

5868

it("rejects very long string", () => {

5969

const veryLong = "a".repeat(10000);

60-

expect(() => validatePrivateKey(veryLong)).toThrow();

70+

expectThrowsError(() => validatePrivateKey(veryLong));

6171

});

62726373

it("rejects string of spaces matching length", () => {

6474

const spaces = " ".repeat(64);

65-

expect(() => validatePrivateKey(spaces)).toThrow();

75+

expectThrowsError(() => validatePrivateKey(spaces));

6676

});

67776878

it("rejects hex with spaces between characters", () => {

6979

const withSpaces =

7080

"01 23 45 67 89 ab cd ef 01 23 45 67 89 ab cd ef 01 23 45 67 89 ab cd ef 01 23 45 67 89 ab cd ef";

71-

expect(() => validatePrivateKey(withSpaces)).toThrow();

81+

expectThrowsError(() => validatePrivateKey(withSpaces));

7282

});

7383

});

74847585

describe("nsec format edge cases", () => {

7686

it("rejects nsec with invalid bech32 characters", () => {

7787

// 'b', 'i', 'o' are not valid bech32 characters

7888

const invalidBech32 = "nsec1qypqxpq9qtpqscx7peytbfwtdjmcv0mrz5rjpej8vjppfkqfqy8skqfv3l";

79-

expect(() => validatePrivateKey(invalidBech32)).toThrow();

89+

expectThrowsError(() => validatePrivateKey(invalidBech32));

8090

});

81918292

it("rejects nsec with wrong prefix", () => {

83-

expect(() => validatePrivateKey("nsec0aaaa")).toThrow();

93+

expectThrowsError(() => validatePrivateKey("nsec0aaaa"));

8494

});

85958696

it("rejects partial nsec", () => {

87-

expect(() => validatePrivateKey("nsec1")).toThrow();

97+

expectThrowsError(() => validatePrivateKey("nsec1"));

8898

});

8999

});

90100

});

@@ -119,7 +129,7 @@ describe("normalizePubkey fuzz", () => {

119129

describe("prototype pollution attempts", () => {

120130

it("throws for prototype property names", () => {

121131

for (const value of ["__proto__", "constructor", "prototype"]) {

122-

expect(() => normalizePubkey(value)).toThrow();

132+

expectThrowsError(() => normalizePubkey(value));

123133

}

124134

});

125135

});