Skip to content

feat(tooling): make deep-scan — tier-3 local analysis; fix TLS floor on reverse-bootstrap listener - #230

Merged
amirotin merged 2 commits into
mainfrom
feat/deep-scan
Aug 7, 2026
Merged

feat(tooling): make deep-scan — tier-3 local analysis; fix TLS floor on reverse-bootstrap listener#230
amirotin merged 2 commits into
mainfrom
feat/deep-scan

Conversation

@amirotin

@amirotin amirotin commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Реализация трёхуровневой схемы проверок, о которой договорились: тяжёлый анализ — локально и бесплатно, в GitHub остаётся лёгкий фон (Sonar).

make deep-scan

Секция Что даёт Чего нет ни в CI, ни в pre-push
semgrep (offline) SAST Go+TS, паки p/golang + p/typescript + p/security-audit глубже Sonar по паттернам; правила из локального кэша — сам semgrep резолвит registry минутами, curl качает те же паки за 0.2 с
govulncheck Go-CVE с анализом достижимости точнее любого сканера lock-файлов
osv-scanner go.mod + package-lock против базы OSV замена удалённых Trivy fs / npm audit-в-CI
npm audit npm advisories убран из CI как дубль — локально бесплатен
gitleaks секреты по всем 2284 коммитам CI-action сканирует только диапазон PR и историю не видит в принципе

Все секции толерантны к отсутствию инструмента (SKIPPED, не падение). Ложные срабатывания подавляются как классы с записанными причинами — ratchet в стиле archguard: scripts/semgrep-filter.py (5 классов) и .gitleaksignore (1 fingerprint — правило приняло сигнатуру secret, expirationRFC3339 string за API-ключ).

Реальная находка первого прогона

Reverse-bootstrap TLS-листенер агента (internal/agent/creds/reverse.go) не задавал MinVersion и молча принимал TLS 1.2 — при том что основной листенер держит floor 1.3 (S-7), а CI-гейт греппит только listen.go. Исправлено на 1.3; совместимость не страдает — единственный легитимный пир это панель с современным Go TLS-стеком. Тесты internal/agent/creds зелёные.

Итог триажа первого полного прогона: 24 semgrep-находки → 1 реальная (исправлена) + 5 FP-классов; 1 gitleaks-находка → FP. make deep-scan теперь выходит clean.

…on reverse-bootstrap listener

Completes the 2026-08-07 check tiering: pre-push = fast gate, CI =
path-gated required checks with Sonar as the hosted SAST, and now
Tier-3 = the heavy/free analysis that runs on the dev machine instead
of runner minutes and sees the whole tree + whole git history instead
of a PR diff.

scripts/deep-scan.sh (make deep-scan), all sections tolerant of a
missing tool:
  semgrep      p/golang + p/typescript + p/security-audit, scanned
               OFFLINE from ~/.cache/semgrep-rules — letting semgrep
               resolve registry configs itself stalled for minutes while
               curl fetched the same packs in 0.2 s, so the cache is
               refreshed via curl with a hard 30 s cap
  govulncheck  Go CVEs with reachability
  osv-scanner  go.mod + web/package-lock.json against the OSV database
  npm audit    advisories (removed from CI as a Trivy duplicate)
  gitleaks     secrets over ALL 2284 commits — the CI action only scans
               a push/PR commit range and can never resurface history

Findings from the first full run, all triaged:
  REAL: the agent's reverse-bootstrap TLS listener (creds/reverse.go)
        set no MinVersion and silently accepted TLS 1.2, while the
        long-lived listener enforces 1.3 (S-7) and the CI security gate
        only greps listen.go. Fixed: MinVersion 1.3, no compatibility
        cost (the only peer is the panel's modern Go TLS stack).
  FP,  suppressed as CLASSES with reasons in scripts/semgrep-filter.py
       (ratchet, archguard convention): SQL-identifier Sprintf,
       math/rand jitter, dynamic cookie Secure, LimitReader-capped
       decompression, rooted-path Clean over embed.FS.
  FP:  gitleaks generic-api-key on a function SIGNATURE (parameter list
       'secret, expirationRFC3339 string') — pinned by fingerprint in
       .gitleaksignore.
Copilot AI lite review requested due to automatic review settings August 7, 2026 21:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

- gitleaks: the .gitleaksignore comment QUOTED the false-positive text,
  and once committed the quote itself matched generic-api-key. Reworded
  to describe without quoting; the already-pushed revision is pinned by
  its own fingerprint.
- Sonar shell rules on deep-scan.sh: curl now pins --proto '=https'
  --tlsv1.2 (S6506), [[ ]] over [ ] (S7688), explicit returns (S7682) —
  as status PROPAGATION (return $?) in the scan functions, where a bare
  return 0 would have swallowed findings.
@sonarqubecloud

sonarqubecloud Bot commented Aug 7, 2026

Copy link
Copy Markdown

@amirotin
amirotin merged commit 9dd6d38 into main Aug 7, 2026
24 checks passed
@amirotin
amirotin deleted the feat/deep-scan branch August 7, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants