-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add Kilo Gastown methodology spec and SAST tooling #942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
0f98bcc
3d28883
f44d1fd
fa9c9d5
07c09bc
faafc4f
52b6035
b460bab
576b830
eac2d7f
d530d80
39ba5a3
d9cff8a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # cliproxyapi-plusplus Ruleset Baseline | ||
|
|
||
| This repository now has a checked-in baseline that matches the repaired remote `Main` ruleset. | ||
|
|
||
| ## Enforced Branch Protection Baseline | ||
|
|
||
| - require pull requests before merge on the default branch | ||
| - no branch deletion | ||
| - no force push / non-fast-forward updates | ||
| - require at least 1 approval | ||
| - dismiss stale approvals on new push | ||
| - require resolved review threads before merge | ||
| - allow merge methods: `merge`, `squash` | ||
| - enable GitHub `code_quality` | ||
| - enable GitHub `copilot_code_review` | ||
|
|
||
| ## Repo-Local Governance Gates | ||
|
|
||
| The repo-local workflow set remains the main CI and policy contract: | ||
|
|
||
| - `policy-gate` | ||
| - `pr-path-guard` | ||
| - `pr-test-build` | ||
| - `required-check-names-guard` | ||
| - `quality-gate` | ||
| - `security-guard` | ||
| - `codeql` | ||
| - `sast-quick` | ||
| - `sast-full` | ||
|
|
||
| Current required check manifests: | ||
|
|
||
| - `.github/required-checks.txt` | ||
| - `.github/release-required-checks.txt` | ||
|
|
||
| Those manifests should drive the next remote ruleset wave once the stable job names are re-verified | ||
| against live workflow output. | ||
|
|
||
| ## Exception Policy | ||
|
|
||
| - only documented billing or quota failures may be excluded from blocking CI evaluation | ||
| - review threads and blocking comments must be resolved before merge | ||
| - PRs must not rely on local `--no-verify` bypasses instead of server-side checks | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| { | ||
| "name": "Main", | ||
| "target": "branch", | ||
| "enforcement": "active", | ||
| "conditions": { | ||
| "ref_name": { | ||
| "include": ["~DEFAULT_BRANCH"], | ||
| "exclude": [] | ||
| } | ||
| }, | ||
| "bypass_actors": [], | ||
| "rules": [ | ||
| { "type": "deletion" }, | ||
| { "type": "non_fast_forward" }, | ||
| { | ||
| "type": "pull_request", | ||
| "parameters": { | ||
| "required_approving_review_count": 1, | ||
| "dismiss_stale_reviews_on_push": true, | ||
| "required_reviewers": [], | ||
| "require_code_owner_review": false, | ||
| "require_last_push_approval": false, | ||
| "required_review_thread_resolution": true, | ||
| "allowed_merge_methods": ["merge", "squash"] | ||
| } | ||
| }, | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| { | ||
| "type": "code_quality", | ||
| "parameters": { | ||
| "severity": "errors" | ||
| } | ||
| }, | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| { | ||
| "type": "copilot_code_review", | ||
| "parameters": { | ||
| "review_on_push": true, | ||
| "review_draft_pull_requests": true | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,86 @@ | ||||||||
| name: SAST Full Analysis | ||||||||
|
|
||||||||
| on: | ||||||||
| schedule: | ||||||||
| - cron: "0 2 * * *" | ||||||||
| workflow_dispatch: | ||||||||
|
|
||||||||
| permissions: | ||||||||
|
||||||||
| permissions: | |
| permissions: | |
| actions: read |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeQL scans wrong languages, misses Go entirely
High Severity
The CodeQL language matrix is [python, cpp, javascript], but this is a Go repository (the go.mod declares module github.com/kooshapari/CLIProxyAPI/v7). The existing codeql.yml correctly targets [go]. This full SAST analysis will scan three languages that have no source files in the repo while completely missing the actual Go codebase — rendering the CodeQL job useless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WARNING: CodeQL matrix missing Go language.
The matrix lists [python, cpp, javascript] but this is primarily a Go codebase (per cargo clippy in sast-quick.yml, the AGENTS.md build instructions, and the codebase structure). Without go in the matrix, CodeQL will not analyze the core Go code, making the full SAST scan incomplete for this repository.
| - uses: actions/checkout@v4 | |
| language: [go, python, javascript] |
Note: also removed cpp since this doesn't appear to be a C++ project. Adjust if there is C++ code present.
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This CodeQL matrix doesn’t include the repo’s primary language (Go) and includes cpp even though there are no C/C++ sources in the repository. Also, the repo already has a dedicated Go CodeQL workflow (.github/workflows/codeql.yml). Consider either extending the existing CodeQL workflow for additional languages present here (Go/Python/JS) or adjusting this job to scan the actual languages in the repo and avoid duplicating CodeQL uploads.
Copilot
AI
Apr 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow uses CodeQL action v3 (github/codeql-action/*@v3), but the existing .github/workflows/codeql.yml uses v4 (see .github/workflows/codeql.yml:24-36). Aligning on a single major version reduces maintenance overhead and avoids behavioral differences across workflows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WARNING: Using @master branch reference for trivy-action.
Pinning to a mutable branch (@master) introduces supply-chain risk and non-reproducible builds. If the upstream action is compromised or introduces breaking changes, your CI will silently adopt them.
Recommend pinning to a specific version tag or commit SHA:
- uses: aquasecurity/trivy-action@v0.28.0
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aquasecurity/trivy-action@master and trufflesecurity/trufflehog@main are floating refs. For a security workflow, these should be pinned to a version tag or (ideally) a commit SHA to reduce supply-chain risk and ensure reproducible scans.
Copilot
AI
Apr 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Trivy action is referenced from the moving @master branch. Pin to a version tag or commit SHA to avoid unexpected behavior changes and reduce supply-chain risk.
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as in the quick workflow: trufflehog is run with --fail but the step is continue-on-error: true, so verified secret findings won’t fail the scheduled/manual run. Decide whether this should be enforcing (remove continue-on-error) or informational (remove --fail).
| continue-on-error: true |
Copilot
AI
Apr 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TruffleHog action is referenced from the moving @main branch. Pin to a release tag or commit SHA for reproducibility and supply-chain safety.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,69 @@ | ||||||
| name: SAST Quick Check | ||||||
|
|
||||||
| on: | ||||||
| pull_request: | ||||||
| push: | ||||||
| branches: [main] | ||||||
|
|
||||||
| permissions: | ||||||
| contents: read | ||||||
| security-events: write | ||||||
| pull-requests: write | ||||||
|
||||||
| pull-requests: write |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WARNING: returntocorp/semgrep-action@v1 is deprecated.
The returntocorp/semgrep-action has been deprecated in favor of running the Semgrep CLI directly or using the semgrep/semgrep-action container. The @v1 tag may stop receiving updates.
Recommended replacement:
- uses: semgrep/semgrep-action@v1Or run semgrep CLI directly:
- run: semgrep ci --config p/security-audit --config p/owasp-top-ten --config p/cwe-top-25 --config .semgrep-rules/ --sarif --output semgrep.sarifThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security actions pinned to mutable branch references
Medium Severity
trufflesecurity/trufflehog@main and aquasecurity/trivy-action@master are pinned to mutable branch refs rather than commit SHAs or immutable version tags. A compromised upstream repo could inject malicious code that runs in CI with contents: read and security-events: write permissions. This is especially concerning for security-focused workflows running on every PR.
Additional Locations (2)
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trufflehog is invoked with --fail, but the step is marked continue-on-error: true, so verified secrets won’t actually fail the workflow. If the goal is to gate PRs on verified findings, remove continue-on-error; if the goal is reporting-only, drop --fail to avoid implying enforcement.
| extra_args: --only-verified --fail | |
| extra_args: --only-verified |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Secret scan continue-on-error defeats --fail flag
Medium Severity
The trufflehog step uses --fail (exit non-zero on verified secrets) but also sets continue-on-error: true, which means the job still reports success. In sast-quick.yml this runs on PRs, so a pull request containing verified leaked secrets will not be blocked by this check — undermining the purpose of secret scanning in CI.
Additional Locations (1)
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trufflesecurity/trufflehog@main is a floating ref. For supply-chain safety and reproducible results, pin to a version tag or commit SHA (especially in security workflows).
Copilot
AI
Apr 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step sets --fail in TruffleHog args, but the action step is marked continue-on-error: true, which prevents failures from ever gating. Decide whether secret findings should block (remove continue-on-error) or be informational (remove --fail).
| continue-on-error: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WARNING: Using @main branch reference for trufflehog.
Pinning to @main introduces supply-chain risk and non-reproducible builds. Pin to a specific release tag or commit SHA for security:
- uses: trufflesecurity/trufflehog@v3.82.12There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rust lint job runs on Go-only repository
Medium Severity
The lint-rust job runs cargo clippy on every PR and push to main, but this repository contains no Rust code — no Cargo.toml, no .rs files. This job will either fail (wasting CI time and creating noise) or require cargo setup for nothing. For a Go repo, this likely intended to be a Go lint step.
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lint-rust job runs cargo clippy, but this repo doesn’t contain a Cargo project (no Cargo.toml found). This job will fail on every run. Remove the Rust lint job, or guard it (e.g., only run when Cargo.toml exists / when Rust paths change).
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,9 +1,18 @@ | ||||||||||||||
| name: security-guard | ||||||||||||||
| on: [workflow_dispatch] | ||||||||||||||
| name: Security Guard | ||||||||||||||
|
|
||||||||||||||
| on: | ||||||||||||||
| workflow_call: | ||||||||||||||
|
||||||||||||||
| workflow_call: | |
| workflow_call: | |
| secrets: | |
| GITGUARDIAN_API_KEY: | |
| required: true |
Copilot
AI
Apr 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow is listed as a required check (security-guard.yml|ggshield-scan), but it only triggers via workflow_dispatch/workflow_call and is not invoked by any other workflow. As a result, PRs/branch updates won't automatically produce the required status check, potentially blocking merges unless run manually. Consider adding pull_request/push triggers (or wiring a caller workflow) or removing it from the required-check manifest if it should remain manual-only.
| workflow_dispatch: | |
| workflow_dispatch: | |
| push: | |
| pull_request: |
Copilot
AI
Apr 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pip install ggshield is unpinned and actions/setup-python doesn’t specify a python-version, which makes this check non-reproducible (and can break on future releases). Pin the ggshield version and set an explicit Python version, consistent with the Semgrep workflows.
| - name: Install ggshield | |
| run: pip install ggshield | |
| with: | |
| python-version: '3.11' | |
| - name: Install ggshield | |
| run: pip install ggshield==1.25.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WARNING: Unpinned pip install ggshield — supply-chain risk
No version is specified, so every CI run pulls the latest release. A compromised upstream release would immediately affect all pipelines. Pin to a specific version (e.g., pip install ggshield==25.1.0).
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| rules: | ||
| - id: circular-module-dependency | ||
| patterns: | ||
| - pattern-either: | ||
| - pattern: | | ||
| use crate::domain::*; | ||
| - pattern: | | ||
| use crate::adapters::*; | ||
| message: Potential circular dependency. Check module import hierarchy. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The rule |
||
| languages: [rust] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The repository |
||
| severity: MEDIUM | ||
|
|
||
| - id: layer-violation-adapter-accessing-domain | ||
| patterns: | ||
| - pattern: | | ||
| mod adapters { | ||
| ... | ||
| use crate::domain::... | ||
| ... | ||
| } | ||
| message: Adapter layer should not directly access domain logic. Use ports/traits instead. | ||
| languages: [rust] | ||
| severity: MEDIUM | ||
|
|
||
| - id: mixed-concerns-in-handler | ||
| patterns: | ||
| - pattern: | | ||
| async fn $HANDLER(...) { | ||
| ... | ||
| database.query(...) | ||
| ... | ||
| api.call(...) | ||
| ... | ||
| filesystem.write(...) | ||
| ... | ||
| } | ||
| message: Handler mixes database, API, and filesystem concerns. Consider dependency injection. | ||
| languages: [rust] | ||
| severity: LOW | ||
|
|
||
| - id: direct-database-in-tests | ||
| patterns: | ||
| - pattern: | | ||
| #[test] | ||
| fn $TEST(...) { | ||
| ... | ||
| Database::connect(...) | ||
| ... | ||
| } | ||
| message: Tests should use mocks/fixtures, not direct database connections. | ||
| languages: [rust] | ||
| severity: MEDIUM | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| rules: | ||
| - id: hardcoded-aws-key | ||
| patterns: | ||
| - pattern-either: | ||
| - pattern: | | ||
| "AKIA[0-9A-Z]{16}" | ||
| - pattern: | | ||
| AKIA[0-9A-Z]{16} | ||
|
||
| message: Potential AWS Access Key detected. Use environment variables instead. | ||
| languages: [generic] | ||
| severity: CRITICAL | ||
|
|
||
| - id: hardcoded-api-key-env | ||
| patterns: | ||
| - pattern-either: | ||
| - pattern: | | ||
| api_key = "..." | ||
| - pattern: | | ||
| apiKey = "..." | ||
| - pattern: | | ||
| API_KEY = "..." | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The patterns for hardcoded keys use the |
||
| message: Hardcoded API key detected. Use environment variables or secrets management. | ||
| languages: [generic] | ||
| severity: HIGH | ||
|
Comment on lines
+8
to
+12
|
||
|
|
||
|
Comment on lines
+2
to
+18
|
||
| - id: hardcoded-password | ||
| patterns: | ||
| - pattern-either: | ||
| - pattern: | | ||
| password = "..." | ||
| - pattern: | | ||
| passwd = "..." | ||
| - pattern: | | ||
| pwd = "..." | ||
| message: Hardcoded password detected. Use environment variables or secrets management. | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| languages: [generic] | ||
| severity: CRITICAL | ||
|
Comment on lines
+19
to
+23
|
||
|
|
||
| - id: hardcoded-slack-webhook | ||
| patterns: | ||
| - pattern: | | ||
| https://hooks.slack.com/services/[A-Z0-9/]+ | ||
| message: Slack webhook URL detected. This should be in environment variables. | ||
| languages: [generic] | ||
| severity: HIGH | ||
|
|
||
| - id: hardcoded-github-token | ||
| patterns: | ||
| - pattern-either: | ||
| - pattern: | | ||
| ghp_[A-Za-z0-9_]{36,255} | ||
| - pattern: | | ||
| gho_[A-Za-z0-9_]{36,255} | ||
| - pattern: | | ||
| ghu_[A-Za-z0-9_]{36,255} | ||
| message: GitHub token detected. Never commit tokens to code. | ||
| languages: [generic] | ||
| severity: CRITICAL | ||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: KooshaPari/cliproxyapi-plusplus
Length of output: 1151
Manifest files exist but are incomplete—most documented workflows are missing.
Both
.github/required-checks.txtand.github/release-required-checks.txtexist, but the manifest contents significantly diverge from the documented workflow names (lines 21-29). The manifests currently list onlypr-test-buildandpr-path-guard, while 7 documented workflows are absent:policy-gate,required-check-names-guard,quality-gate,security-guard,codeql,sast-quick, andsast-full. These manifests must be updated to align with the documented workflows before they can reliably drive the next ruleset wave.🤖 Prompt for AI Agents