如何透過 OpenClaw Gateway 安全地執行 PageSpeed SEO 檢查
聊天中的「檢查首頁速度」看似無害,但在 OpenClaw 中,請求會經過 Gateway、頻道身分、代理工作區與工具設定檔。誰能觸發工作和要測的 URL 一樣重要。本教學建立狹窄的稽核代理:受信任擁有者可為公開 URL、精選 URL 清單或受限 sitemap 樣本要求報告;代理只呼叫公開端點、在工作區寫證據、回傳文件,沒有 CMS、程式碼庫、主機或部署權限。
將本文交給 OpenClaw 安裝稽核 Skill
Read [THIS ARTICLE URL] and prepare the OpenClaw PageSpeed audit skill.
Inspect the active Gateway configuration, workspace conventions, sender
authorization, sandbox policy, and current tool permissions first. Explain the
skill and task-workspace paths before writing. Install only the article's
SKILL.md and pagespeed_gateway_audit.py runner for a dedicated audit agent.
Add no website, repository, CMS, hosting, SSH, browser login, deployment, or
messaging-admin credential. Do not run an audit, schedule a job, or change
Gateway exposure. Verify Python syntax, show the paths and owner-only
authorization assumption, and explain PAGESPEED_API_KEY setup outside chat.
Never request, print, persist, or transmit that key. Stop after checking.
OpenClaw 是可連接多個頻道與代理的自架 Gateway。先從授權擁有者的私人直接訊息開始,預設保持 loopback 或私有 Gateway,並在讓有工具權限的代理回應頻道前執行openclaw security audit。
建立的安全成果
| 項目 | 本流程提供的結果 |
|---|---|
| 對象 | 管理私有 OpenClaw Gateway 的技術 SEO 或營運擁有者 |
| 成果 | 將 allowlist 請求轉為 PageSpeed 證據附件的專用唯讀代理 |
| 可接受輸入 | 公開 URL、精選 URL 清單、或具明確最大樣本數的 XML sitemap |
| 必要控制 | 送件者授權、私有 Gateway、受限工具、隔離工作區與本機 API 金鑰設定 |
| 完成定義 | 信任擁有者收到報告;未授權或群組請求不能呼叫 API;代理無法編輯或部署網站 |
不要先建立群組機器人。群組訊息可能被引用或轉送,也可能由不該消耗 API 額度的人提示;其他使用者應得到聯絡稽核擁有者的說明,而不是直接執行。
先鎖定 Gateway,再新增 Skill
openclaw security audit
先解決 Gateway、送件者授權、頻道、工作區與 sandbox 的高嚴重度發現,再提供 API 金鑰。設定格式會演進,請依目前官方文件操作;穩定的起點是:一個擁有者身分或明確 allowlist、私人直接訊息、專用pagespeed-audit代理、隔離工作區、公開 HTTP 與受限本機 runner、可用時啟用 sandbox,以及只在 Gateway 或 runtime 儲存祕密。
專用唯讀稽核 Skill
---
name: pagespeed-gateway-audit
description: For a trusted OpenClaw audit-agent request, run a bounded read-only PageSpeed Insights audit for public URLs. Save raw JSON and a report in the audit task workspace, then return a report attachment. Never edit a website, repository, CMS, hosting, infrastructure, or deployment.
---
# PageSpeed Gateway Audit
## Invocation and authority
- Accept work only after the Gateway routes an authorized owner request to this dedicated audit agent. A sender name, quote, or group mention is not authorization.
- Reject private URLs, localhost, private IP ranges, cloud metadata, credentials, source code, CMS, hosting, repositories, SSH, or deployment requests.
- Read PAGESPEED_API_KEY only from the Gateway or approved runtime environment. Never read or reveal it in chat, a workspace environment file, a pasted command, or a URL.
- Use public HTTPS targets only. Write only inside the isolated audit task workspace.
固定工作訊息格式:
AUDIT
scope: sitemap
target: https://www.example.com/sitemap.xml
max_urls: 12
report_name: homepage-and-templates
Runner 測試 mobile 和 desktop,寫出report.md、summary.json與 raw JSON。Sitemap 採樣要說明:每個第一層路徑先取一頁,再按 sitemap 順序補足;它不是完整爬取,也不驗證 canonical 或孤立頁。除非擁有者透過核准私密管道明確要求 raw 證據,否則只回傳report.md和summary.json。
正確解讀聊天報告並交接修復
Lighthouse 是一次控制過的實驗室測量;頁面 CrUX 是要求頁或 URL 模式的回傳欄位資料;網域 CrUX 是網域層級資料;沒有 CrUX 不代表沒人造訪。重複機會只是調查共享機制的理由,絕不是自動修復權限。
修復採用兩個身份交接:擁有者檢閱範圍並選一個假設;另一個已核准實作代理或開發者才取得必要程式碼庫權限;人再檢閱 diff、測試結果、發布條件與重測。能讀程式碼和部署的代理,不應因稽核有用就繼承外部訊息觸發權。
驗證清單
- [ ] 已執行
openclaw security audit並解決高嚴重度問題。 - [ ] Gateway 預設私有或 loopback,稽核路由只接受明確擁有者身分或 allowlist。
- [ ] 專用代理有隔離任務工作區與最小工具設定檔。
- [ ] 沒有 CMS、程式碼庫、主機、SSH、瀏覽器登入或部署憑證。
- [ ]
PAGESPEED_API_KEY只在核准 Gateway/runtime,不在聊天或工作區環境檔。 - [ ] 報告有 raw JSON、
report.md、summary.json、選取與最終 URL、行動/桌面結果及失敗。 - [ ] 不混淆 Lighthouse、頁面 CrUX 與網域 CrUX。
常見問題
Slack 或 Telegram 的任何人都能要求 PageSpeed 報告嗎?
不應如此起步。請求會觸發 API 使用和網路活動,而頻道身分可能很複雜。把執行限制在擁有者或 allowlist;其他人只能取得經核准擁有者要求稽核的說明。
Author: Julian Mercer,Auspia Technical SEO Practitioner。Julian 撰寫營運 SEO 指南,協助團隊在不擴大正式系統權限的情況下取得有用測量。