Skip to content

Commit 69b54cf

Browse files
authored
chore(docs): harden external link audit results (#114746)
1 parent ecfebd4 commit 69b54cf

10 files changed

Lines changed: 222 additions & 39 deletions

File tree

‎.github/workflows/docs-external-links.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
--no-progress
3030
--base-url https://docs.openclaw.ai
3131
--exclude-all-private
32-
--accept '100..=399,401,403,429'
32+
--accept '100..=399,401,403,429,500..=599'
3333
--accept-timeouts
3434
--max-retries 2
3535
--retry-wait-time 2

‎README.md‎

Lines changed: 8 additions & 8 deletions
Large diffs are not rendered by default.

‎docs/providers/deepgram.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ returns them.
1919

2020
| Detail | Value |
2121
| ------------- | ---------------------------------------------------------- |
22-
| Website | [deepgram.com](https://deepgram.com) |
2322
| Docs | [developers.deepgram.com](https://developers.deepgram.com) |
2423
| Auth | `DEEPGRAM_API_KEY` |
2524
| Default model | `nova-3` |

‎docs/providers/ollama-cloud.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ embeddings, and custom host details, see [Ollama](/providers/ollama).
1818

1919
## Setup
2020

21-
Create an Ollama Cloud API key at [ollama.com/settings/keys](https://ollama.com/settings/keys), then run:
21+
Follow [Ollama's API key instructions](https://docs.ollama.com/api/authentication#api-keys), then run:
2222

2323
```bash
2424
openclaw onboard --auth-choice ollama-cloud

‎docs/start/showcase.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Desktop app to manage skills and commands across Agents, Claude, Codex, and Open
119119
<img src="/assets/showcase/agents-ui.jpg" alt="Agents UI app" />
120120
</Card>
121121

122-
<Card title="Telegram voice notes (papla.media)" icon="microphone" href="https://papla.media/docs">
122+
<Card title="Telegram voice notes (papla.media)" icon="microphone">
123123
**Community** • `voice` `tts` `telegram`
124124

125125
Wraps papla.media TTS and sends results as Telegram voice notes (no annoying autoplay).

‎docs/tools/acp-agents-setup.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Built-in acpx harness aliases (from the pinned `acpx` dependency):
3232
| Alias | Wraps |
3333
| ------------ | ------------------------------------------------------------------------------------------------------ |
3434
| `claude` | [Claude Code](https://claude.ai/code) |
35-
| `codex` | [Codex CLI](https://codex.openai.com) |
35+
| `codex` | [Codex CLI](https://developers.openai.com/codex/cli) |
3636
| `copilot` | [GitHub Copilot CLI](https://docs.github.com/en/copilot/concepts/agents/copilot-cli/about-copilot-cli) |
3737
| `cursor` | [Cursor CLI](https://cursor.com/docs/cli/acp) (`cursor-agent acp`) |
3838
| `droid` | [Factory Droid](https://www.factory.ai) |

‎scripts/clawtributors-map.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"atalovesyou",
1717
"0xJonHoldsCrypto",
1818
"hougangdev",
19-
"jiulingyun"
19+
"mf-yang"
2020
],
2121
"seedCommit": "d6863f87",
2222
"displayName": {

‎scripts/update-clawtributors.ts‎

Lines changed: 87 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ for (const item of contributors) {
4848
contributionsByLogin.set(item.login.toLowerCase(), item.contributions);
4949
}
5050
apiByLogin.set(item.login.toLowerCase(), {
51+
id: item.id,
5152
login: item.login,
5253
html_url: item.html_url,
5354
avatar_url: normalizeAvatar(item.avatar_url),
@@ -183,16 +184,36 @@ const entriesByKey = new Map<string, Entry>();
183184

184185
for (const seed of seedEntries) {
185186
const login =
186-
loginFromUrl(seed.html_url) ??
187+
(seed.html_url ? loginFromUrl(seed.html_url) : null) ??
187188
resolveLogin(seed.display, null, apiByLogin, nameToLogin, emailToLogin);
188-
if (!login) {
189+
const accountId = accountIdFromAvatarUrl(seed.avatar_url);
190+
if (!login && !accountId) {
189191
continue;
190192
}
191-
const key = login.toLowerCase();
192-
const user = apiByLogin.get(key) ?? fetchUser(login);
193+
const loginKey = login?.toLowerCase();
194+
const userByLogin = loginKey ? apiByLogin.get(loginKey) : undefined;
195+
// Avatar account IDs survive renames and cannot be claimed by a handle squatter.
196+
const user = accountId
197+
? userByLogin?.id === accountId
198+
? userByLogin
199+
: fetchUserByAccountId(accountId)
200+
: (userByLogin ?? (login ? fetchUser(login) : null));
193201
if (!user) {
202+
const key = accountId ? `github-id:${accountId}` : expectDefined(loginKey, "seed login key");
203+
entriesByKey.set(key, {
204+
key,
205+
display: seed.display,
206+
html_url: null,
207+
avatar_url: normalizeAvatar(seed.avatar_url),
208+
lines: 0,
209+
commits: 0,
210+
prs: 0,
211+
score: 0,
212+
firstCommitDate: loginKey ? (firstCommitByLogin.get(loginKey) ?? "") : "",
213+
});
194214
continue;
195215
}
216+
const key = user.login.toLowerCase();
196217
apiByLogin.set(key, user);
197218
const existing = entriesByKey.get(key);
198219
if (!existing) {
@@ -318,7 +339,8 @@ for (let i = 0; i < visibleEntries.length; i += PER_LINE) {
318339
// (default identicons come back 420px) and never upscales tiny source
319340
// avatars, so markdown images render off-grid without explicit sizing.
320341
const alt = escapeHtmlAttribute(entry.display);
321-
return `<a href="${entry.html_url}"><img src="${entry.avatar_url}" width="48" height="48" alt="${alt}"></a>`;
342+
const image = `<img src="${entry.avatar_url}" width="48" height="48" alt="${alt}">`;
343+
return entry.html_url ? `<a href="${entry.html_url}">${image}</a>` : image;
322344
});
323345
markdownLines.push(parts.join(" "));
324346
}
@@ -446,27 +468,70 @@ function normalizeAvatar(url: string): string {
446468
}
447469
}
448470

471+
function accountIdFromAvatarUrl(url: string): number | null {
472+
try {
473+
const parsed = new URL(url);
474+
if (parsed.hostname !== "avatars.githubusercontent.com") {
475+
return null;
476+
}
477+
const match = /^\/u\/(\d+)\/?$/u.exec(parsed.pathname);
478+
const accountId = match?.[1] ? Number(match[1]) : Number.NaN;
479+
return Number.isSafeInteger(accountId) && accountId > 0 ? accountId : null;
480+
} catch {
481+
return null;
482+
}
483+
}
484+
485+
function parseUser(responseText: string): User | null {
486+
const parsed = JSON.parse(responseText);
487+
if (!parsed?.login || !parsed?.html_url || !parsed?.avatar_url) {
488+
return null;
489+
}
490+
return {
491+
id: typeof parsed.id === "number" ? parsed.id : undefined,
492+
login: parsed.login,
493+
html_url: parsed.html_url,
494+
avatar_url: normalizeAvatar(parsed.avatar_url),
495+
};
496+
}
497+
449498
function fetchUser(login: string): User | null {
450499
const normalized = normalizeLogin(login);
451500
if (!normalized) {
452501
return null;
453502
}
454503
try {
455-
const data = runGh(["api", `users/${normalized}`]);
456-
const parsed = JSON.parse(data);
457-
if (!parsed?.login || !parsed?.html_url || !parsed?.avatar_url) {
504+
return parseUser(runGh(["api", `users/${normalized}`]));
505+
} catch (error) {
506+
if (isGitHubMissing(error)) {
458507
return null;
459508
}
460-
return {
461-
login: parsed.login,
462-
html_url: parsed.html_url,
463-
avatar_url: normalizeAvatar(parsed.avatar_url),
464-
};
465-
} catch {
466-
return null;
509+
throw error;
467510
}
468511
}
469512

513+
function fetchUserByAccountId(accountId: number): User | null {
514+
try {
515+
return parseUser(runGh(["api", `user/${accountId}`]));
516+
} catch (error) {
517+
if (isGitHubMissing(error)) {
518+
return null;
519+
}
520+
throw error;
521+
}
522+
}
523+
524+
function isGitHubMissing(error: unknown): boolean {
525+
const message = error instanceof Error ? error.message : "";
526+
const stderr = (error as { stderr?: unknown } | null)?.stderr;
527+
const stderrText = Buffer.isBuffer(stderr)
528+
? stderr.toString("utf8")
529+
: typeof stderr === "string"
530+
? stderr
531+
: "";
532+
return /\bHTTP (?:404|410)\b/u.test(`${message}\n${stderrText}`);
533+
}
534+
470535
function isDefaultGitHubAvatar(login: string): Promise<boolean> {
471536
const normalized = normalizeLogin(login)?.toLowerCase();
472537
if (!normalized) {
@@ -850,13 +915,17 @@ function escapeHtmlAttribute(value: string): string {
850915

851916
function parseReadmeEntries(
852917
content: string,
853-
): Array<{ display: string; html_url: string; avatar_url: string }> {
918+
): Array<{ display: string; html_url: string | null; avatar_url: string }> {
854919
const rangeValue = findClawtributorsRange(content);
855920
if (!rangeValue) {
856921
return [];
857922
}
858923
const blockValue = content.slice(rangeValue.start, rangeValue.end);
859-
const entriesValue: Array<{ display: string; html_url: string; avatar_url: string }> = [];
924+
const entriesValue: Array<{
925+
display: string;
926+
html_url: string | null;
927+
avatar_url: string;
928+
}> = [];
860929
const markdown = /\[!\[([^\]]+)\]\(([^)]+)\)\]\(([^)]+)\)/g;
861930
for (const match of blockValue.matchAll(markdown)) {
862931
const [, alt, src, href] = match;
@@ -886,7 +955,7 @@ function parseReadmeEntries(
886955
if (entriesValue.some((entry) => entry.display === alt && entry.avatar_url === src)) {
887956
continue;
888957
}
889-
entriesValue.push({ html_url: fallbackHref(alt), avatar_url: src, display: alt });
958+
entriesValue.push({ html_url: null, avatar_url: src, display: alt });
890959
}
891960
return entriesValue;
892961
}
@@ -967,11 +1036,6 @@ function loginFromUrl(url: string): string | null {
9671036
return login;
9681037
}
9691038

970-
function fallbackHref(value: string): string {
971-
const encoded = encodeURIComponent(value.trim());
972-
return encoded ? `https://github.com/search?q=${encoded}` : "https://github.com";
973-
}
974-
9751039
function pickDisplay(
9761040
baseName: string | null | undefined,
9771041
login: string,

‎scripts/update-clawtributors.types.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export type MapConfig = {
88
};
99

1010
export type ApiContributor = {
11+
id?: number;
1112
login?: string;
1213
html_url?: string;
1314
avatar_url?: string;
@@ -17,6 +18,7 @@ export type ApiContributor = {
1718
};
1819

1920
export type User = {
21+
id?: number;
2022
login: string;
2123
html_url: string;
2224
avatar_url: string;
@@ -26,7 +28,7 @@ export type Entry = {
2628
key: string;
2729
login?: string;
2830
display: string;
29-
html_url: string;
31+
html_url: string | null;
3032
avatar_url: string;
3133
lines: number;
3234
commits: number;

0 commit comments

Comments
 (0)