feat: add GitHub Action and Docker support - #72
Conversation
- Improve OpenAI API key regex (word boundaries, 48+ chars) - Add OpenCode API key detector (context-based sk- prefix) - Add 63+ new prefix-based detectors covering: - AI services (Anthropic, Cohere, HuggingFace, Mistral, Groq, Replicate, LangSmith) - Cloud/Infra (Vercel, Netlify, Supabase, Convex) - Monitoring (Datadog, New Relic, PagerDuty, Sentry, Elastic) - DevOps (GitLab PATs, Buildkite, TravisCI, Ngrok) - Messaging (Confluent) - Productivity (Airtable, HashiCorp Vault, Terraform) - Remove redundant context-based 32-hex detectors (covered by GenericKeyValueDetector) - Strip verbose descriptions from detectors.toml - Fix justfile trailing newline Refs: #57
- Add Critical variant to Severity enum - Update from_string() to parse CRITICAL - Update get_severity_counts() to return 4-tuple (critical, high, medium, low) - Update calculate_exit_code() to treat Critical like High in critical mode - Update severity display output to include CRITICAL count - Update tests for new 4-tuple format Fixes part of #68
- Add baseline module (src/baseline.rs) with JSON serialization - Add --baseline <path> flag to suppress known findings - Add --update-baseline flag to write baseline from current scan - Baseline matching uses file_path + line_number + finding_type + plugin_name - Integration tests for filtering, save/load, and from_findings Refs #68
…ntegration test, graceful git-not-found
- .github/actions/keywatch-scan/action.yml: composite action that downloads and runs key-watch on specified paths with configurable exit mode - Dockerfile: multi-stage build (rust:alpine → alpine:3.21 runtime) - .dockerignore: exclude build artifacts and non-essential files - .github/workflows/docker-publish.yml: build & push to GHCR on version tags
…ser, GH auth, keep Cargo.lock
f15a9b6 to
2e62f03
Compare
* origin/master: chore(deps): bump toml from 1.1.3+spec-1.1.0 to 1.1.4+spec-1.1.0 (#70)
…/github-action-docker * origin/feat/missing-features: docs(changelog): add PR review fix entries chore(deps): bump toml from 1.1.3+spec-1.1.0 to 1.1.4+spec-1.1.0 (#70) # Conflicts: # CHANGELOG.md
…to scratch - docker-publish.yml: actions/checkout v4→v7, login-action v3→v4.6.0, metadata-action v5→v6.2.0, build-push-action v6→v7.3.0 - ci.yml, release.yml: actions/checkout v4→v7 - Dockerfile: runtime stage alpine→scratch (static musl binary), numeric USER 65532:65532, absolute ENTRYPOINT path
…/github-action-docker * origin/feat/missing-features: refactor: use const for baseline version and domain separator, rename severity param
- Dockerfile: install git + ca-certificates on alpine:3.23 runtime so --git-history scanning and hook installation work in the container - Dockerfile: copy templates/ (build was missing them, failed at compile) - Dockerfile: bump build stage to rust:1.97.1-alpine (let-chains in scanner.rs require rust >= 1.88) - ci.yml: crate-ci/typos master -> v1.48.0, Swatinem/rust-cache v2.7.0 -> v2.9.1 - release.yml: softprops/action-gh-release v1 -> v3.0.2
There was a problem hiding this comment.
🟡 Not ready to approve
The new composite action and Docker publish workflow contain functional issues (verbose flag always enabled, platform/asset resolution and install assumptions, and an unused workflow_dispatch input) that can break CI/CD usage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Adds CI/CD infrastructure for KeyWatch by introducing a composite GitHub Action for scanning, a multi-stage Docker image build, and a GHCR publish workflow, plus workflow/version updates and documentation entries.
Changes:
- Added a composite GitHub Action (
.github/actions/keywatch-scan/action.yml) to install and runkey-watchwith configurable inputs and outputs. - Added container support via a multi-stage
Dockerfileand a new.dockerignore. - Added a Docker publish workflow to push images to GHCR; updated existing CI/release workflows to newer action versions.
File summaries
| File | Description |
|---|---|
| Dockerfile | Adds multi-stage build/runtime containerization for key-watch and bundles detectors.toml. |
| CHANGELOG.md | Documents the new GitHub Action and Docker-related additions/changes. |
| .github/workflows/release.yml | Updates action versions used in the release pipeline. |
| .github/workflows/docker-publish.yml | Introduces GHCR Docker image build/publish workflow on tags/manual dispatch. |
| .github/workflows/ci.yml | Updates action versions used in CI (checkout, typos, rust-cache). |
| .github/actions/keywatch-scan/action.yml | Introduces a composite Action to download/install key-watch and run scans with outputs/summary. |
| .dockerignore | Optimizes Docker build context by excluding git metadata, build output, and misc files. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 6
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
…/github-action-docker * origin/feat/missing-features: style: group Rust imports fix: harden generated git hooks fix: harden file and git history scanning fix: validate detector severity and names fix: stabilize baseline fingerprints
* feat/missing-features: fix: guard Unix-only hook test imports
7e20919 to
e543e6d
Compare
e543e6d to
699f621
Compare
* feat/missing-features: style: use descriptive scanner test errors refactor: simplify baseline hashing refactor: clarify pre-push remote policy shell
7f6ea7a to
26287b8
Compare
Summary
Adds the infrastructure for running KeyWatch in CI/CD environments.
Changes
GitHub Action (
.github/actions/keywatch-scan/action.yml)Composite action that installs and runs key-watch with configurable inputs:
paths- files or directories to scan (default:.)exit-mode-strict(default),critical, oralwaysoutput- path for JSON reportverbose- detailed console outputfindings-countandexit-codeoutputsDockerfile
Multi-stage build:
rust:1.85-alpinewith musl targetalpine:3.21with ca-certificatesdetectors.tomlat/etc/keywatch/detectors.tomlKEYWATCH_CONFIG_PATHenv varDocker Publish Workflow
ghcr.io/pixincreate/keywatch1.2.0,1.2), short SHAUsage
Closes the Action and Docker items from #71.