pledgeandgrow/pledgeguard

GitHub: pledgeandgrow/pledgeguard

一款基于 Rust 构建的密钥扫描工具,旨在通过 AST 精炼、WASM 插件和 MCP 服务器等特性,为 CI/CD 流水线提供高性能且可扩展的敏感信息泄露检测与合规审计方案。

Stars: 1 | Forks: 0

# PledgeGuard **Rust 原生密钥扫描器 — TruffleHog/Gitleaks 的替代方案。** [![npm version](https://img.shields.io/npm/v/pledgeguard.svg)](https://www.npmjs.com/package/pledgeguard) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/cas/39/39faa54be350a1dab8afd3b2fb8c1c83e4d9cff84abfef2374d19a18053687c4.svg)](https://github.com/pledgeandgrow/pledgeguards/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Stars](https://img.shields.io/github/stars/pledgeandgrow/pledgeguard)](https://github.com/pledgeandgrow/pledgeguard) ![secrets scanned](https://img.shields.io/badge/secrets%20scanned-pledgeguard-green) [![Sponsor](https://img.shields.io/badge/Sponsor-%E2%9D%A4-red)](https://github.com/sponsors/pledgeandgrow) ## 快速开始 ``` # 安装 npm install -g pledgeguard # 或者:npx pledgeguard scan . (无需安装) # 或者:brew install pledgeguard # 或者:scoop install pledgeguard # 扫描你的项目 pledgeguard scan . # 仅扫描已更改的文件(非常适合 PRs) pledgeguard scan . --diff --fail-on-findings # 生成合规报告 pledgeguard compliance . --framework pci-dss # 初始化 config pledgeguard init ``` ## 为什么选择 PledgeGuard? | 功能 | PledgeGuard | TruffleHog | Gitleaks | GitGuardian | |---|:---:|:---:|:---:|:---:| | **语言** | Rust | Go | Go | SaaS | | **检测器** | 708 | 800+ | ~100 | 500+ | | **实时验证** | 191 个规则 ID | 800+ | ❌ | 500+ | | **AI 集成** | ✅ | ❌ | ❌ | 部分 | | **MCP 服务器** | ✅ | ❌ | ❌ | ❌ | | **企业版(RBAC,审计)** | ✅ | 部分 | ❌ | ✅ | | **合规报告** | ✅ | ❌ | ❌ | ✅ | | **扫描差异对比** | ✅ | ❌ | ❌ | ✅ | | **Webhook 通知** | ✅ | ❌ | ❌ | ✅ | | **WASM 插件** | ✅ | ❌ | ❌ | ❌ | | **离线模式** | ✅ | ✅ | ✅ | ❌ | | **npm/npx** | ✅ | ❌ | ❌ | ❌ | | **GitHub Action** | ✅ | ✅ | ✅ | ✅ | | **SARIF 输出** | ✅ | ✅ | ✅ | ✅ | | **速度** | ★★★★★ | ★★★★☆ | ★★★★★ | ★★☆☆☆ | ## 安装说明 ### npm(推荐) ``` npm install -g pledgeguard # 或者无需安装使用: npx pledgeguard scan . ``` ### Homebrew (macOS/Linux) ``` brew install pledgeguard ``` ### Scoop (Windows) ``` scoop install pledgeguard ``` ### 从源码构建 ``` git clone https://github.com/pledgeandgrow/pledgeguard.git cd pledgeguard cargo install --path crates/pledgeguard-cli ``` ### 二进制文件下载 从 [GitHub Releases](https://github.com/pledgeandgrow/pledgeguard/releases) 下载适用于以下平台的版本: - Linux x86_64 / ARM64 - macOS x86_64 / ARM64 (Apple Silicon) - Windows x86_64 ### Docker ``` docker run ghcr.io/pledgeandgrow/pledgeguard scan /repo ``` ## 使用说明 ### 基础扫描 ``` pledgeguard scan . pledgeguard scan src/ --min-severity high pledgeguard scan . --format json --report-file results.json pledgeguard scan . --format sarif --report-file results.sarif pledgeguard scan . --format github-actions ``` ### CI/CD 门禁 ``` pledgeguard scan . --fail-on-findings --min-severity high # 如果发现任何高危或更严重的发现,则退出代码为 1 ``` ### PR 差异扫描(快速 — 仅扫描已更改的文件) ``` pledgeguard scan . --diff --fail-on-findings # 仅扫描自 HEAD 以来更改的文件 —— 完美适用于 pull requests ``` ### 验证密钥是否处于活跃状态 ``` pledgeguard scan . --verify # 调用 provider APIs 以检查 secrets 是否仍然有效 ``` ### Git 历史扫描 ``` pledgeguard history . # 扫描所有 commits 以查找过去 commits 中引入的 secrets pledgeguard history . --since-commit abc123 # 增量扫描:仅扫描 abc123 之后的 commits pledgeguard history . --branch feature/x --since-date 2024-01-01 # 限定范围:仅扫描自 2024 年 1 月 1 日起 feature/x branch ``` ### CI/CD 集成 ``` # CI 优化的扫描,具有可配置的 exit code pledgeguard scan . --ci-mode --format json --report-file results.json # 仅在 critical 发现时失败,最多 50 条发现 pledgeguard scan . --fail-on-severity critical --max-findings 50 # 将发现作为 GitHub PR comment 发布 pledgeguard scan . --pr-comment-platform github --pr-number 42 --pr-comment-repo owner/repo # 自动将 SARIF 上传到 GitHub Code Scanning pledgeguard scan . --sarif-upload --format sarif # 首次运行时自动创建 baseline,在后续运行中强制执行 pledgeguard scan . --baseline-auto --enforce-baseline # 追加到现有报告中(multi-scan 聚合) pledgeguard scan src/ --report-append --report-file combined.json pledgeguard scan infra/ --report-append --report-file combined.json ``` `templates/` 中可用的 CI/CD 模板: - **CircleCI** — `templates/circleci-orb.yml` - **Jenkins** — `templates/Jenkinsfile` - **DroneCI** — `templates/drone.yml` - **Azure DevOps** — `templates/azure-pipelines.yml` - **Bitbucket** — `templates/bitbucket-pipelines.yml` - **TeamCity** — `templates/teamcity.config` - **Husky** — `templates/husky-pre-commit` - **lint-staged** — `templates/lint-staged.json` ### 合规报告 ``` pledgeguard compliance . --framework soc2 pledgeguard compliance . --framework pci-dss --verify ``` ### 扫描差异 ``` pledgeguard scan . --format json --report-file current.json pledgeguard diff previous.json current.json # 显示新的、已解决的和未更改的发现 ``` ### Webhook 通知 ``` pledgeguard notify --url https://hooks.slack.com/services/... --webhook-type slack . ``` ### 初始化配置 ``` pledgeguard init # 使用推荐的默认值创建 .pledgeguard.toml ``` ### 安装 pre-commit 钩子 ``` pledgeguard install-pre-commit . ``` ### MCP 服务器(用于 AI 代理) ``` pledgeguard mcp pledgeguard mcp --tcp 127.0.0.1:9470 --auth-token secret ``` ### AI 钩子 ``` pledgeguard install-ai-hooks --tool cursor pledgeguard install-ai-hooks --tool claude-code pledgeguard install-ai-hooks --tool copilot ``` ### 加载自定义 WASM 检测器 ``` pledgeguard scan . --plugin-dir ./plugins ``` ### 基线 / 白名单 ``` pledgeguard scan . --save-baseline .pledgeguard-baseline.json pledgeguard scan . --baseline .pledgeguard-baseline.json ``` `--fail-on-findings` 会使 CLI 在存在发现结果时以非零状态退出, 用作 CI 门禁。`history` 要求 `PATH` 中包含 `git`,并且目标路径 位于 git 工作树内。 ## 内置检测器 708 个检测器,涵盖 AWS(Access Key、Secret、Session Token、MWS、Bedrock、 Account ID),Azure(Storage、SAS、Client Secret、AD/Entra ID、Batch、Function、 DevOps PAT、Cosmos DB),Google Cloud(API Key、OAuth、Service Account、Client ID、 Gemini/PaLM),阿里巴巴、腾讯、DigitalOcean、IBM Cloud、Oracle Cloud、Scaleway、 Vultr、Linode、Cloudflare(API Key、Token、CA Key、Global)、 GitHub、GitLab、Bitbucket(App Password、Client ID/Secret、DataCenter)、Slack、 Discord(Bot Token、Webhook、Client ID/Secret)、Telegram、Microsoft Teams、 Atlassian(API Token、Jira)、Notion、Gitter、Webex、Intercom、HelpScout、 HelpCrunch、Canny、Pipedrive、Beamer、Frame.io、Zeplin、Trello、Asana (Client ID/Secret、PAT)、 Stripe(Secret、Publishable、Restricted)、Shopify(Access、Shared Secret、 Custom/Private App)、PayPal(OAuth、Client Secret)、Square(Token、App Secret)、 Coinbase、RazorPay、Paystack、Plaid(Token、Key)、Flutterwave(Secret、Encryption)、 Paddle、FastSpring、Sellfy、Duffel、EasyPost(API、Test)、Finicity(Token、Secret)、 Freshbooks、GoCardless、Taxjar、Etsy、PostHog、Amplitude、Segment、Mixpanel、Heap、 Pendo、Keen.io、Fathom、Plausible、Hotjar、FullStory、Bitly、Calendly、 Calendarific、AppFollow、Appcues、Mailchimp、OpenAI、Anthropic(API、Admin)、 HuggingFace、Cohere、Replicate、Stability AI、AssemblyAI、Clarifai、OpenRouter、 Together AI、Perplexity、Mistral、Groq、DeepSeek、ElevenLabs、SendGrid、Mailgun、 Postmark、Mailjet(Basic、SMS)、Brevo/SendinBlue、Elastic Email、Pepipost、 Mailmodo、Verimail、ZeroBounce、Mailboxlayer、D7Networks、Sinch、MessageBird、 Vonage/Nexmo、Plivo、Postman、PubNub、Pusher、PushBullet、Doppler、Datadog (API Key、Access Token)、New Relic(License、Personal API Key)、PagerDuty、 Opsgenie、Sentry、SumoLogic、Splunk Observability、AppOptics、Airbrake、LogDNA、 Loggly、Better Stack、Statuspage、UptimeRobot、Pingdom、Auth0(API、Management、 OAuth)、Okta、OneLogin、JumpCloud、Authress、Keycloak、FusionAuth、Stytch、Clerk、 WorkOS、Supabase(Service Key、Anon Key)、Firebase(Token、FCM)、KubeConfig、 HashiCorp Vault、1Password(Secret Key、Service Account)、Vercel、Netlify、Heroku、 WP Engine、Fastly、Akamai、Equinix、Fly.io、Railway、Render、Koyeb、Twitch (Client Secret、Access Token)、Twitter/X、Facebook(App Secret、Access Token、 OAuth)、LinkedIn、Linear、Figma(Token、PAT)、npm、PyPI、Docker Hub、Spotify、 YouTube、Flickr、Dropbox(API Secret、Long/Short-Lived Token)、Reddit(Client Secret、Access Token)、Instagram、Pinterest、TikTok、Zoom、Zapier Webhook、 PostgreSQL、MySQL、MongoDB、Redis、JDBC、SQL Server、Elasticsearch、InfluxDB、 Couchbase、Cassandra、Neo4j、Supabase DB、PlanetScale、Neon、Turso、Convex、 Age Secret Key、Kubernetes Secret Manifest、Terraform Cloud、Ansible Vault、 Docker Registry、Harbor、Nexus、Confluent(Access Token、Secret Key)、Databricks、 Snowflake、Dynatrace、LaunchDarkly、ConfigCat、Flagsmith、Shodan、AbuseIPDB、 AlienVault OTX、VirusTotal、Hunter.io、IPStack、MaxMind、CloudSight、RapidAPI、 ScrapingBee、ipinfo.io、Google Maps、MapBox、MapQuest、Here Maps、OpenCage、 HubSpot(API Key、OAuth)、Salesforce OAuth2、Zendesk、Elastic Path、ButterCMS、 Contentful(Delivery、PAT)、Sanity、Storyblok、Strapi、Airtable(API Key、PAT、 OAuth)、Algolia Admin、Lokalise、Bitcoin(WIF)、Ethereum、Solana、Infura、Alchemy、 Moralis、QuickNode、Bitfinex、Bittrex(Access、Secret)、 Curl Authentication String、URI with Embedded Credentials、Generic OAuth Client Secret、.env File Secrets、Firebase Web Config、 Twilio、Line(Messaging、Notify)、Mattermost、WeChat、KakaoTalk、LiveAgent、Front、 RingCentral、TeleSign、TeamViewer、CometChat、Mesibo、Bulbul、Tyntec、Kaleyra、 Onbuka、ClickSend、Clockwork SMS、BombBomb、DFuse、ApiFonica、Mandrill、SparkPost、 MailerLite、ConvertKit、Omnisend、Customer.io、Moosend、Dotdigital、Dyspatch、 PostageApp、Nicereply、AutoPilot、Airship、 Freshworks、Close CRM、Copper CRM、Streak CRM、GrooveHQ、GetGist、Autoklose、 Salesflare、SalesBlink、Salescookie、Metrilo、RevampCRM、KarmaCRM、Less Annoying CRM、 NetHunt CRM、Nimble CRM、Apptivo CRM、Capsule CRM、Insightly CRM、Kylas CRM、 OnePageCRM、Prospect CRM、Really Simple Systems CRM、Central Station CRM、Teamgate、 Axonaut、FlowFlu、Clientary、Clinchpad、CompanyHub、Campayn、Hiveage、Billomat、 Alegra、Loyverse、CommerceJS、Snipcart、PartnerStack、Vouchery、Monday.com、 Smartsheets、Wrike、Apollo.io、UpLead、RocketReach、Clearbit、Brandfetch、 Leadfeeder、GetEmail、GetEmails、Skrappio、Powrbot、 ClickUp、Todoist、Shortcut、TMetric、Clockify、Everhour、Harvest、Humanity、 Toggl Track、RunRunIt、Workstack、EasyInsight、Dovico、Mavenlink、Float、 Daily.co、T.ly、Rebrandly、Timezone、Jotform、 Typeform、SurveySparrow、Survicate、Delighted、Feedier、Zonka Feedback、 Satismeter(Project、Write)、Simplesat、SurveyAnyplace、SurveyBot、Qualaroo、 CustomerGuru、Abyssale、Magnetic、Refiner、Simvoly、Checkmarket、Webengage、 Twelve Data、Fixer.io、Alpha Vantage、Tradier、Finnhub、Tiingo、Finage、 IEX Cloud、Intrinio、Financial Modeling Prep、Nasdaq Data Link、Qubole、 Enigma、Data.gov、Stockdata、Marketstack、Commodities、Baremetrics、Dwolla、 WePay、Checkout.com、Paymongo、Avalara、Carbon Interface、Currency Layer、 Exchange Rates、CurrencyScoop、CurrencyFreaks、Country Layer、FX Market、 Currency Cloud、 Kraken、Poloniex、BitMEX、CoinAPI、Coinlayer、Coinlib、CryptoCompare、 Bitcoin Average、World Coin Index、Glassnode、Tatum.io、Ethplorer、NFTPort、 Messari、CoinGecko、 OpenWeather、WeatherStack、AccuWeather、World Weather、Tomorrow.io、 AirVisual、Visual Crossing、Stormglass、Aeris Weather、Ambee、OpenUV、 Edge Token、Calendly Webhook、 TomTom、Geoapify、Geocodify、Geocode、Geocodio、PositionStack、LocationIQ、 Graphhopper、SmartyStreets、Route4me、ZipCode、OnWater、GeoIPify、IPGeolocation、 IPinfoDB、ipify、ipapi、VPN、DNS Check、Walk Score、Besttime、Hypertrack、Fulcrum、Samsara、 Unsplash、Pixabay、Gyazo、Imgur、Shutterstock、IconFinder、ImageKit、Bannerbear、 Imagga、Face++、SkyBiometry、Cloudive、ScreenshotAPI、ScreenshotLayer、Browshot、 LinkPreview、Mixcloud、RAWG、Strava、FourSquare、TicketMaster、Riot Games、Cricket、 All Sports、SportsMonk、Edamam、Nutritionix、Spoonacular、Calorie Ninja、Protocols.io、 HypeAuditor、NewsAPI、Newscatcher、Currents、Guardian、Aylien、Cicero、Lexigram、 Blogger、MediaStack、ClickHelp、Storychief、Noticeable、ReadMe、Pastebin、Crowdin、 Alconost、Gengo、HappyScribe、RiteKit、RubyGems、Codacy、Coveralls、SauceLabs、Bitbar、 Bugsnag、Adafruit IO、Apify、Keygen、Aiven、File.io、Flat.io、Dynalist、Sheety、Swell、 M3o、JSONbin、UserStack、PureStake、Host、BaseAPI、SslMate、Adobe IO、EdenAI、Deepgram、 Voicegain、Audd.io、OwlBot、DetectLanguage、LanguageLayer、ParallelDots、Veriphone、 Verifier、API2Cart、APIDeck、APIFlash、Fleetbase、Agora、Yandex、Artsy、Blit.app、 Censys、SecurityTrails、URLScan、Aletheia、Whoxy、Mailsac、LoginRadius、Rev、 YouNeedABudget、Filestack、Bubble、Shopee、Kite Connect、Veeva Vault、Cloudways、 Duda、Yext、ContentStack、Surge、Kairos、FullContact、Eversign、NetCore、Bored、 HTML2PDF、PDF Layer、PDF Shift、Restpack(HTML-to-PDF、Screenshot)、Documo、ClustDoc、 PandaDoc、HelloSign、Juro、YouSign、VatLayer、UPC Database、 ScraperAPI、ScrapingDog、ScrapeOwl、WebScraping、ZenScrape、ZenSerp、SerpStack、 ScraperBox、ScrapingAnt、ScrapeStack、ProxyCrawl、 Debounce、Kickbox、IPQuality、Roaring、OOPSpam、Numverify、 Webflow、Squarespace、Siteleaf、GraphCMS、Kontent、 Wakatime、Ubidots、Raven、Guru、Hive、Technical Analysis、Impala、Unplugg、 Cloverly、Flight、AviationStack、Distribusion、Words、Holiday、Amadeus、 Exchange Rate、Abstract、 Auth0、Okta、Vercel、Netlify、Supabase、CircleCI、Heroku、Travis CI、DroneCI、 Buildkite、TeamCity、Jenkins、GoCD、ArgoCD、Spinnaker、Harness、Codecov、 SonarQube、Snyk、Artifactory、Terraform Cloud、Pivotal Tracker、Clojars、Linear、 Figma、Twitch、Twitter/X、Facebook、LinkedIn、npm、PEM private keys、JWTs、 PostgreSQL/MySQL/MongoDB/Redis connection strings,以及基于通用熵的 检测。 完整列表请参见 **[SUPPORT.md](docs/SUPPORT.md)**。 所有匹配到的密钥默认在 CLI 输出中进行脱敏处理(使用 `--no-redact` 禁用)。 ## 功能 ### Git 历史扫描 `pledgeguard history ` 调用系统 `git` 二进制文件并遍历 可从任何 ref(`git log --all`)访问的每个 commit,仅扫描 每个 commit 与其父 commit 的差异中*新增*的行。发现结果包括 引入密钥的 commit SHA。 ### 降低误报率 两层误报过滤: 1. **词法启发式**(`context.rs`)— 标记同一行注释或 测试/夹具/示例路径中的发现结果。与语言无关,适用于所有文件。 2. **基于 AST 的细化**(`ast.rs`) — 使用 [oxc](https://oxc.rs) 解析器 对 JS/TS 文件(`.js`, `.jsx`, `.ts`, `.tsx`, `.mjs`, `.cjs`, `.mts`, `.cts`)进行精确的注释范围检测。处理多行块注释 并忽略字符串字面量中的 `//` — 这两种情况是词法启发式 容易出错的。在工作树扫描期间自动应用。 发现结果永远不会被丢弃,只会被标记;CLI 默认隐藏它们, `--show-all` 可以显示它们。 ### 实时提供商验证 `--verify` 调用提供商 API 以检查匹配的密钥是否仍然有效。 支持 48 个提供商:GitHub、GitLab、Slack、Stripe、npm、DigitalOcean、 Telegram、Twilio、OpenAI、Anthropic、PyPI、Docker Hub、SendGrid、Mailgun、 Mailchimp、Opsgenie、PagerDuty、Google API、Google OAuth、HuggingFace、Shopify、 Heroku、Vercel、Datadog、Cloudflare、Linear、Okta、Auth0、Supabase、CircleCI、 Discord、Atlassian、New Relic、Notion、AWS STS、Azure AD、GCP IAM、Private Key (PEM)、DB Connection、Slack Webhook、Vault Token、Bitbucket、SonarQube、Snyk、 Twitch、Pulumi、Square、Postman、Buildkite 和 Terraform Cloud。使用 `--only-verified` 仅显示确认为 Active(活跃)的发现结果。使用 `--verify-detectors` / `--no-verify-detectors` 进行精细的按检测器控制。 完整列表请参见 **[SUPPORT.md](docs/SUPPORT.md)**。 ### 基线 / 白名单模式 `--save-baseline ` 将所有当前发现结果写入 JSON 基线文件。 `--baseline ` 会抑制其指纹(rule_id + path + 匹配文本)出现在基线中的发现结果。指纹与行号无关, 因此抑制规则在格式化后依然有效。基线文件包含原始匹配的 密钥值 — 请将其视为敏感数据(添加到 `.gitignore` 或安全存储)。 ### pre-commit 钩子安装器 `pledgeguard install-pre-commit` 安装一个 git pre-commit 钩子,该钩子会在 每次 commit 之前运行 `pledgeguard scan --fail-on-findings`。使用 `--force` 来 覆盖现有的钩子。该钩子是一个 shell 脚本(在 Windows 上需要 Git Bash,Git for Windows 已包含此组件)。 ### SARIF 输出 `--format sarif` 生成一个 SARIF 2.1.0 日志文档,其中包含去重后的规则 和每个发现结果的结果,用于 GitHub Code Scanning 集成。 ### MCP 服务器 `pledgeguard mcp` 通过 stdio 运行 Model Context Protocol 服务器(JSON-RPC 2.0),将 `scan_path` 和 `scan_git_history` 作为工具暴露给 AI 代理。 支持 `initialize`、`tools/list` 和 `tools/call`。 ### WASM 插件系统 可以在运行时使用 `--plugin-dir `(可重复使用)从 `.wasm` 模块加载 自定义检测器,而无需重新编译 PledgeGuard。请参阅 `crates/pledgeguard-core/src/plugin.rs` 获取插件 ABI 文档,并参阅 `examples/plugins/example-plugin/` 获取最小的工作插件。插件通过 `wasmtime` 运行,并且一次最多由一个线程调用。 ## 工作区布局 ``` pledgeguard/ ├── Cargo.toml # workspace manifest ├── action.yml # GitHub Action definition ├── gitlab-ci.yml # GitLab CI template ├── templates/ # publishable CI/CD templates │ ├── circleci-orb.yml │ ├── Jenkinsfile │ ├── drone.yml │ ├── azure-pipelines.yml │ ├── bitbucket-pipelines.yml │ ├── teamcity.config │ ├── husky-pre-commit │ └── lint-staged.json ├── examples/plugins/example-plugin/ # sample WASM detector plugin └── crates/ ├── pledgeguard-core/ # detection engine library │ ├── detector.rs # Detector trait + RegexDetector │ ├── detectors.rs # built-in detector definitions │ ├── entropy.rs # Shannon-entropy helper │ ├── finding.rs # Finding, Severity, VerificationStatus types │ ├── redact.rs # secret redaction for display │ ├── scanner.rs # Scanner: file walking + parallel scan + IaC detection │ ├── context.rs # lexical comment/fixture-path false-positive heuristic │ ├── ast.rs # oxc-based AST false-positive refinement for JS/TS │ ├── git_history.rs # git history scan + scoped history scan │ ├── plugin.rs # WASM plugin loader + ABI (wasmtime) │ ├── verify.rs # live provider verification │ ├── sarif.rs # SARIF 2.1.0 output for GitHub Code Scanning │ ├── baseline.rs # baseline/allowlist persistence and filtering │ ├── ci_cd.rs # CI/CD templates, scan scope, exit code config, PR comments │ └── iac_detection.rs # IaC secret detection (30+ file types) └── pledgeguard-cli/ # `pledgeguard` binary ├── main.rs # clap CLI: scan + history + scan-source + mcp + compliance + diff └── mcp.rs # MCP server over stdio (JSON-RPC 2.0) ``` ## GitHub Action 将 `.github/workflows/pledgeguard.yml` 添加到你的仓库: ``` name: PledgeGuard Secret Scan on: [push, pull_request] jobs: scan: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: pledgeandgrow/pledgeguard@v0.1.1 with: path: . format: github-actions min-severity: high fail-on-findings: true ``` 有关包含 SARIF 上传的完整示例,请参见 [`docs/github-action-example.yml`](docs/github-action-example.yml)。 ## 迁移指南 来自其他扫描器?请查看我们的迁移指南: - [从 Gitleaks 迁移](docs/MIGRATION-GITLEAKS.md) - [从 TruffleHog 迁移](docs/MIGRATION-TRUFFLEHOG.md) ## CLI 参考 ``` pledgeguard scan [OPTIONS] pledgeguard history [OPTIONS] pledgeguard scan-source [OPTIONS] pledgeguard mcp [OPTIONS] pledgeguard install-pre-commit [OPTIONS] [path] pledgeguard init [OPTIONS] [path] pledgeguard compliance [OPTIONS] pledgeguard diff pledgeguard notify [OPTIONS] pledgeguard install-ai-hooks --tool pledgeguard ai-analyze --analysis [OPTIONS] Common scan options: --format Output format --min-severity Minimum severity to report --no-redact Show full secret values (default: redacted) --fail-on-findings Exit non-zero if findings are present --diff Only scan git-changed files (PR mode) --plugin-dir Load .wasm detectors (repeatable) --show-all Include likely false positives --verify Call provider APIs to check if secrets are active --baseline Suppress findings matching a baseline file --save-baseline Save current findings as a baseline file --config Load custom TOML rules --report-file Write output to file instead of stdout CI/CD scan options: --since-commit Scan only commits after this SHA --since-date Scan only commits after this date --branch Scan only this branch --pr-number PR number (for PR comment integration) --commit-range Scan specific commit range --exit-code Custom exit code on findings (default: 1) --ignore-exit-code Always exit 0 (reporting-only mode) --fail-on-severity Fail only on findings >= severity --max-findings Stop after N findings --ci-mode CI-optimized: no color, JSON, fail-on-findings --report-append Append to report file (multi-scan aggregation) --baseline-auto Auto-create baseline on first run --enforce-baseline Fail if baseline is missing/outdated --pr-comment-platform Post findings as PR/MR comment --pr-comment-repo Repository slug for PR comments --pr-comment-token API token for PR comments --sarif-upload Auto-upload SARIF to GitHub Code Scanning --sarif-upload-token GitHub token for SARIF upload --junit-upload Write JUnit XML for CI test runner ``` ## 安全性 有关负责任的披露,请参见 [SECURITY.md](SECURITY.md)。 ## 限制 - **AST 细化仅支持 JS/TS** — Python、Go、Ruby 等使用词法启发式。 - **Git 历史扫描仅使用词法过滤** — 仅提供新增行的文本,而不提供完整文件。 - **实时验证涵盖 48 个提供商** — 完整列表请参见 [SUPPORT.md](docs/SUPPORT.md)。 - **基线文件包含原始密钥值** — 请视为敏感数据。 - **详细的比较请参见 [BENCHMARK.md](docs/BENCHMARK.md)。** ## 赞助商 如果 PledgeGuard 帮助你避免了密钥泄露,请考虑支持开发: - **[GitHub Sponsors](https://github.com/sponsors/pledgeandgrow)** — 按月或一次性 - **[Buy Me a Coffee](https://buymeacoffee.com/pledgeandgrow)** — 一次性 ## 许可证 MIT
标签:AI工具, MITM代理, Rust, StruQ, WASM插件, 可视化界面, 合规报告, 网络流量审计, 请求拦截, 通知系统