security-audit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Security Audit

安全审计

Find what a site exposes to visitors and attackers: leaked secrets, open files and endpoints, weak headers and cookies, mixed content, and signs of compromise. Then fix it in the order that limits damage.
This is not a penetration test. squirrelscan reports what it can see and prove from outside; a clean run means these checks found nothing, not that the site is secure.
找出站点向访问者和攻击者暴露的内容:泄露的密钥、开放的文件和端点、不安全的响应头与 Cookie、混合内容,以及网站遭入侵的迹象。然后按照能够将损害降到最低的顺序进行修复。
这不是渗透测试。squirrelscan 报告其从外部能够观察并证实的问题;一次干净的运行仅表示这些检查未发现问题,并不代表站点安全。

Before the first audit

首次审计前

Run
squirrel --version
. If it fails, install the CLI from squirrelscan.com/download (the
squirrelscan
skill has
references/install.md
). Then run
squirrel auth status
:
  • Signed out, or
    --offline
    : the audit runs on this machine, is free, and nothing is published.
  • Signed in: the audit is billed in credits (50 plus 2 per audited page, plus 1 per distinct external link the cloud verifies), adds the site to the user's dashboard, can turn on recurring audits and publishes an unlisted report. Tell the user the cost (
    squirrel credits
    ) and get a yes. Offer
    --offline
    or
    --no-publish
    . For a site the user does not own, add
    --ephemeral
    : nothing is added to the dashboard, scheduled or published.
Every flag below is checked against the squirrel CLI docs (https://docs.squirrelscan.com/cli/audit). Rule docs:
https://docs.squirrelscan.com/rules/{category}/{rule_id}
.
运行
squirrel --version
。如果失败,则从 squirrelscan.com/download 安装 CLI(
squirrelscan
skill 中包含
references/install.md
)。随后运行
squirrel auth status
:
  • 未登录或使用
    --offline
    :审计将在本机运行,免费,且不会发布任何内容。
  • 已登录:审计将消耗 credits 计费(50 credits,另加每个受审计页面 2 credits,以及云端验证的每个不同外部链接 1 credits),并将站点添加到用户仪表板;它还可以启用定期审计,并发布一份非公开报告。请告知用户费用(
    squirrel credits
    )并获得用户同意。提供
    --offline
    或
    --no-publish
    选项。对于用户并不拥有的站点,添加
    --ephemeral
    :不会将站点添加到仪表板,不会安排定期审计,也不会发布报告。

Who owns the site decides the probe level

站点所有权决定探测级别

squirrelscan can send probes beyond the crawl (see
--probe
). Ask first: "Do you own this site, or are you authorized to test it?"
SituationCommand
Not the user's site, or unknown
squirrel audit <url> --rule-include security,integrity --passive --ephemeral --format llm
The user's own site, normal check
squirrel audit <url> --rule-include security,integrity --level surface --format llm
(probing defaults to
active
: a handful of requests that look like normal traffic)
The user's own site, deep checkOnly after the user says in this conversation that they own it or may test it:
squirrel audit <url> --rule-include security,integrity --level full --aggressive --probe-budget 2m --format llm
Never add
--aggressive
or
--pentest
on your own. Aggressive probing makes many requests and many 404s, requests paths that
robots.txt
disallows on purpose, can trip a WAF, and is what runs
security/exposed-files
and
security/supabase-rls
. An aggressive run also asks for
/actuator/heapdump
, which makes an exposed Spring server write a dump to disk.
--offline
does not make probing passive: add
--passive
for that. A hosted (cloud) audit of a site whose ownership is not confirmed stays passive, so the probing rules are not checked there; do not report them as clean.
squirrelscan 可以发送超出抓取范围的探测请求(参见
--probe
)。首先询问:“你拥有此站点,或是否获授权测试它?”
情况命令
不是用户的站点,或所有权未知
squirrel audit <url> --rule-include security,integrity --passive --ephemeral --format llm
用户自己的站点,常规检查
squirrel audit <url> --rule-include security,integrity --level surface --format llm
(探测默认采用
active
模式:发送少量看起来像正常流量的请求)
用户自己的站点,深度检查仅在用户于当前对话中声明拥有该站点或有权测试后使用:
squirrel audit <url> --rule-include security,integrity --level full --aggressive --probe-budget 2m --format llm
绝不要自行添加
--aggressive
或
--pentest
。激进探测会发送大量请求并产生大量 404,请求
robots.txt
明确禁止访问的路径,还可能触发 WAF;
security/exposed-files
和
security/supabase-rls
规则也需要通过这种模式运行。激进运行还会请求
/actuator/heapdump
,这会使暴露该端点的 Spring 服务器将堆转储写入磁盘。
--offline
不会让探测变为被动;还需添加
--passive
。对于所有权尚未确认的站点,托管的(云端)审计会保持被动模式,因此不会在那里检查探测规则;不要将其报告为“干净”。

Reading the findings

读取审计结果

  1. Export the full list:
    squirrel audit <url> --rule-include security,integrity --format json -o security.json
    (the
    llm
    format samples 5 pages and 5 items per rule).
  2. Read
    skippedChecks
    ,
    summary.skipped
    and the
    Not checked:
    line. A probe rule that was skipped (
    probing-passive
    ,
    probing-not-aggressive
    ,
    external-requests-off
    ) is not clean: say which checks did not run and what would run them.
  3. Re-render later without recrawling:
    squirrel report <audit-id> --group security --severity error --format llm
    .
  4. Never paste a leaked secret into chat, a commit or a PR. Name the rule, the file or URL and the key type only.
  1. 导出完整清单:
    squirrel audit <url> --rule-include security,integrity --format json -o security.json
    (
    llm
    格式仅采样 5 个页面以及每条规则 5 个项目)。
  2. 读取
    skippedChecks
    、
    summary.skipped
    和
    Not checked:
    行。被跳过的探测规则(
    probing-passive
    、
    probing-not-aggressive
    、
    external-requests-off
    )不能视为干净:应说明哪些检查未运行,以及怎样才能运行它们。
  3. 稍后无需重新抓取即可重新渲染报告:
    squirrel report <audit-id> --group security --severity error --format llm
    。
  4. 绝不要将泄露的密钥粘贴到聊天、commit 或 PR 中。只需注明规则名称、文件或 URL 以及密钥类型。

Fix order

修复顺序

  1. integrity/*
    findings first
    (injected pages, cloaking, phishing kits, obfuscated scripts,
    integrity/known-malicious-url
    ). These can mean the site is compromised. Tell the user before changing anything; do not just delete files, since the entry point (a plugin, a CI token, a stolen login) is still open. Hand off to their host or incident process.
  2. Leaked secrets (
    security/leaked-secrets
    ,
    security/token-storage
    ): removing the key from the code is not enough. Rotate it at the provider, then remove it, then check git history. A key that shipped to browsers was read.
  3. Exposed files and endpoints (
    security/exposed-files
    ,
    security/exposed-actuator
    ,
    security/graphql-introspection
    ,
    security/graphql-get-mutations
    ,
    security/unauthenticated-api
    ,
    security/json-sensitive-fields
    ,
    security/auth-endpoint-disclosure
    ,
    security/client-side-authz
    ): block at the server or the edge, or add authentication. Hiding a link does not fix an open endpoint.
  4. Supabase tables (
    security/supabase-rls
    ): use the
    supabase-security-audit
    skill.
  5. Transport (
    security/https
    ,
    security/http-to-https
    ,
    security/tls-certificate
    ,
    security/mixed-content
    ,
    security/hsts
    ,
    security/form-https
    ,
    security/password-form-get
    ).
  6. Headers (
    security/csp
    ,
    security/x-frame-options
    ,
    security/x-content-type
    ,
    security/referrer-policy
    ,
    security/permissions-policy
    ): use the
    security-headers
    skill for the config.
  7. Cookies and third parties (
    security/cookie-flags
    ,
    security/third-party-cookies
    ,
    security/sri
    ,
    security/open-redirect
    ,
    security/new-tab
    ,
    security/version-disclosure
    ,
    security/security-txt
    ).
  1. 首先处理
    integrity/*
    发现
    (注入页面、cloaking、phishing kit、混淆脚本、
    integrity/known-malicious-url
    )。这些问题可能意味着站点已遭入侵。在进行任何更改前先告知用户;不要只是删除文件,因为入口点(插件、CI token 或被盗登录凭据)仍然存在。将问题移交给站点托管方或其事件响应流程。
  2. 泄露的密钥(
    security/leaked-secrets
    、
    security/token-storage
    ):仅从代码中删除密钥并不足够。先在密钥提供方处轮换密钥,然后删除旧密钥,再检查 Git 历史。任何已经下发到浏览器的密钥都应视为已被读取。
  3. 暴露的文件和端点(
    security/exposed-files
    、
    security/exposed-actuator
    、
    security/graphql-introspection
    、
    security/graphql-get-mutations
    、
    security/unauthenticated-api
    、
    security/json-sensitive-fields
    、
    security/auth-endpoint-disclosure
    、
    security/client-side-authz
    ):在服务器或边缘层进行阻断,或添加身份验证。仅仅隐藏链接无法修复开放端点。
  4. Supabase 表(
    security/supabase-rls
    ):使用
    supabase-security-audit
    skill。
  5. 传输安全(
    security/https
    、
    security/http-to-https
    、
    security/tls-certificate
    、
    security/mixed-content
    、
    security/hsts
    、
    security/form-https
    、
    security/password-form-get
    )。
  6. 响应头(
    security/csp
    、
    security/x-frame-options
    、
    security/x-content-type
    、
    security/referrer-policy
    、
    security/permissions-policy
    ):使用
    security-headers
    skill 进行配置。
  7. Cookie 和第三方服务(
    security/cookie-flags
    、
    security/third-party-cookies
    、
    security/sri
    、
    security/open-redirect
    、
    security/new-tab
    、
    security/version-disclosure
    、
    security/security-txt
    )。

Where the fix usually lives

修复通常位于何处

StackLook here
Next.js
next.config.*
headers()
,
middleware.ts
, route handlers under
app/api/
,
NEXT_PUBLIC_*
env vars (anything with that prefix ships to the browser)
WordPress
wp-config.php
,
.htaccess
or the server block, plugin updates, removing unused plugins and themes, backup and debug files in the web root
Shopifytheme code (
theme.liquid
,
*.liquid
), installed apps that inject scripts; Shopify controls headers and TLS itself, so those are usually not fixable by the merchant
WebflowSite settings, custom code (head and body), the hosting settings; headers are limited to what Webflow exposes
CloudflareRules, then Transform Rules (modify response headers); SSL/TLS, Always Use HTTPS, WAF custom rules for blocking paths
Vercel
vercel.json
headers
,
redirects
, environment variables, deployment protection
Netlify
_headers
,
netlify.toml
, redirects, environment variables
SupabaseRow Level Security policies, the API keys page, Edge Functions; see
supabase-security-audit
技术栈查看位置
Next.js
next.config.*
中的
headers()
、
middleware.ts
、
app/api/
下的 route handler、
NEXT_PUBLIC_*
环境变量(带此前缀的变量都会发送到浏览器)
WordPress
wp-config.php
、
.htaccess
或服务器配置块、插件更新、移除未使用的插件和主题、删除 Web 根目录中的备份与调试文件
Shopify主题代码(
theme.liquid
、
*.liquid
)、会注入脚本的已安装应用;Shopify 自行控制响应头和 TLS,因此这些问题通常无法由商家修复
Webflow站点设置、自定义代码(页头和正文)、托管设置;响应头只能使用 Webflow 开放的功能
CloudflareRules,然后是 Transform Rules(用于修改响应头);SSL/TLS、Always Use HTTPS、用于阻断路径的 WAF 自定义规则
Vercel
vercel.json
中的
headers
、
redirects
、环境变量、部署保护
Netlify
_headers
、
netlify.toml
、重定向、环境变量
SupabaseRow Level Security 策略、API keys 页面、Edge Functions;参见
supabase-security-audit

Stop condition

停止条件

Stop when a re-audit with the same command and
--refresh
shows no error-severity findings in
security
and
integrity
, every probe rule that applies was checked (not skipped), exposed secrets are rotated (ask the user to confirm), and anything left is a documented decision. A finding that is intentional (a public file listed in
security/exposed-files
, a table public by design) is waived with an
[[ignore]]
entry that has a
reason
, not by disabling the rule. See
references/configuration.md
in the
squirrelscan
skill.
当使用相同命令并添加
--refresh
重新审计后,
security
和
integrity
中不再存在 error 严重度的发现、所有适用的探测规则均已检查(未被跳过)、暴露的密钥均已轮换(请用户确认),且所有遗留项都有书面决定时,即可停止。有意保留的发现(例如
security/exposed-files
中列出的公开文件、按设计公开的表)应通过带
reason
的
[[ignore]]
条目豁免,而不是禁用规则。参见
squirrelscan
skill 中的
references/configuration.md
。

Hand off

移交给其他 skill

  • Supabase app:
    supabase-security-audit
    . Header and CSP config:
    security-headers
    .
  • Findings outside security (SEO, links, performance):
    audit-website
    .
  • Gate it in CI:
    website-ci-gate
    .
  • Supabase 应用:
    supabase-security-audit
    。响应头和 CSP 配置:
    security-headers
    。
  • 安全范围之外的发现(SEO、链接、性能):
    audit-website
    。
  • 在 CI 中设置门禁:
    website-ci-gate
    。