Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c9066e2
docs: add malware-protection CI design spec
DeFiVC Nov 19, 2026
8e2aa78
docs: add malware-protection CI implementation plan
DeFiVC Nov 19, 2026
8f7ad70
docs: align spec and plan on allowlist.json; drop placeholder wording
DeFiVC Nov 19, 2026
c1d9d02
chore: ignore .worktrees directory
DeFiVC Nov 19, 2026
4bed7f0
docs: fix S4 table formatting
DeFiVC Nov 19, 2026
0d6b101
feat(malware-scan): scanner skeleton with finding model and CLI exit …
DeFiVC Nov 19, 2026
5b77049
fix(malware-scan): map unexpected scanner exceptions to fail-safe exit 2
DeFiVC Nov 19, 2026
85ae645
fix(malware-scan): fail closed on missing scan roots and prune path w…
DeFiVC Nov 19, 2026
64ef6f5
test(malware-scan): direct unit tests for path walking and finding co…
DeFiVC Nov 19, 2026
9863507
fix(malware-scan): fail closed on explicitly named excluded roots; ra…
DeFiVC Nov 19, 2026
e9abf4c
feat(malware-scan): PolinRider config-append and obfuscation rules
DeFiVC Nov 19, 2026
ebdc63a
fix(malware-scan): close PolinRider rule detection gaps (unescape, st…
DeFiVC Nov 19, 2026
49a2085
docs: refine PolinRider rule criteria in spec to implemented precision
DeFiVC Nov 19, 2026
e4aedcb
fix(malware-scan): harden PolinRider rules against comment evasion an…
DeFiVC Nov 19, 2026
3abd6d8
feat(malware-scan): VS Code tasks, token-exfil, and lifecycle-hook rules
DeFiVC Nov 19, 2026
d51e2e9
fix(malware-scan): tighten execution-vector rule scope and close dete…
DeFiVC Nov 19, 2026
82c8f8d
fix(malware-scan): eliminate ReDoS in pipe rules and harden hook/exfi…
DeFiVC Nov 19, 2026
9257b40
feat(malware-scan): GitHub Actions abuse rules with secrets escalation
DeFiVC Nov 19, 2026
224aedf
fix(malware-scan): per-job secrets escalation, case-safe SHA pins, an…
DeFiVC Nov 19, 2026
4e63135
fix(malware-scan): correct YAML comment semantics and workflow-rule p…
DeFiVC Nov 19, 2026
bae9799
feat(malware-scan): suspicion heuristics and typosquat detection
DeFiVC Nov 20, 2026
4edc005
feat(malware-scan): allowlist, diff/history modes, diff-only rules
DeFiVC Nov 20, 2026
fe59cff
fix(malware-scan): unify path policy for diff/history modes and cut W…
DeFiVC Nov 20, 2026
f32a787
fix(malware-scan): stop persist-credentials action input tripping STE…
DeFiVC Nov 20, 2026
77d063f
ci: add malware-protection workflow (TTP scan, secrets, workflow lint…
DeFiVC Nov 20, 2026
f080044
feat(malware-scan): annotations and summary output; maintainer guide
DeFiVC Nov 20, 2026
0f42a84
fix(gitleaks): correct allowlist syntax and baseline pre-existing fin…
DeFiVC Nov 20, 2026
4afe6f3
ci: scope zizmor to malware-protection workflow; keep actionlint repo…
DeFiVC Nov 20, 2026
8b13d78
fix(malware-scan): anchor path exclusion to scanner directories only
DeFiVC Nov 20, 2026
1d3079a
ci: add lockfile-only npm audit to ttp-scan job
DeFiVC Nov 20, 2026
ab145e0
fix(malware-scan): cap diff-mode reads; exec-bit detection; docs wording
DeFiVC Nov 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions .github/workflows/malware-protection.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: Malware Protection

on:
pull_request:
branches: [main]
push:
branches: [main]
schedule:
- cron: "17 4 * * *"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: malware-protection-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ttp-scan:
name: TTP Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: "3.12"
- name: Scanner unit tests
run: python3 -m unittest discover -s tests/malware-scan -v
- name: TTP scan (PR diff)
if: github.event_name == 'pull_request'
env:
SCAN_BASE: ${{ github.base_ref }}
run: >-
python3 scripts/malware-scan/scan.py
--base "origin/$SCAN_BASE"
--head HEAD
--annotations
--summary "$GITHUB_STEP_SUMMARY"
- name: TTP scan (tree)
if: github.event_name != 'pull_request'
run: >-
python3 scripts/malware-scan/scan.py
--paths .
--annotations
--summary "$GITHUB_STEP_SUMMARY"
- name: npm audit (lockfile only, WARN)
# Spec [S3] C1 / [S8] row 5: high/critical advisories are WARN-tier.
# --package-lock-only audits the committed lockfile without
# installing packages or executing project code; continue-on-error
# gives WARN semantics (never fails the job) and the output tail is
# appended to the job summary for reviewers.
continue-on-error: true
run: |
{
echo "## npm audit (lockfile-only, WARN tier)"
echo '```'
npm audit --package-lock-only --audit-level=high 2>&1 | tail -n 40
echo '```'
} >> "$GITHUB_STEP_SUMMARY"

history-scan:
name: History Scan
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: "3.12"
- name: Full history TTP scan
run: >-
python3 scripts/malware-scan/scan.py
--history
--annotations
--summary "$GITHUB_STEP_SUMMARY"

secrets-scan:
name: Secrets Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
persist-credentials: false
- name: Install gitleaks
run: |
set -euo pipefail
VERSION="8.30.1"
curl -fsSL -o /tmp/gitleaks.tar.gz \
"https://github.com/gitleaks/gitleaks/releases/download/v${VERSION}/gitleaks_${VERSION}_linux_x64.tar.gz"
tar -xzf /tmp/gitleaks.tar.gz -C /tmp gitleaks
sudo install -m 0755 /tmp/gitleaks /usr/local/bin/gitleaks
gitleaks version
- name: Detect secrets (PR diff)
if: github.event_name == 'pull_request'
env:
SCAN_BASE: ${{ github.base_ref }}
run: >-
gitleaks detect --source . --redact
--log-opts "origin/$SCAN_BASE..HEAD"
--exit-code 1
- name: Detect secrets
if: github.event_name != 'pull_request'
run: gitleaks detect --source . --redact --exit-code 1

workflow-lint:
name: Workflow Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: "3.12"
- name: Install zizmor
run: pip install zizmor==1.32.0
- name: Install actionlint
run: |
set -euo pipefail
VERSION="1.7.12"
curl -fsSL -o /tmp/actionlint.tar.gz \
"https://github.com/rhysd/actionlint/releases/download/v${VERSION}/actionlint_${VERSION}_linux_amd64.tar.gz"
tar -xzf /tmp/actionlint.tar.gz -C /tmp actionlint
sudo install -m 0755 /tmp/actionlint /usr/local/bin/actionlint
actionlint --version
- name: Lint workflows
run: |
# zizmor is scoped to the workflow this feature owns: pre-existing
# ci.yml findings (unpinned uses/images, artipacked, excessive
# permissions) are out of scope here (spec [S7]) and ci.yml
# hardening is tracked separately. actionlint stays repo-wide —
# it passes on every workflow.
zizmor --persona auditor .github/workflows/malware-protection.yml
actionlint
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ coverage/
!.env.example
!.env.test.example
*.log
.worktrees/
__pycache__/
38 changes: 38 additions & 0 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# gitleaks config — loaded automatically by `gitleaks detect --source .`
#
# NOTE (pinned gitleaks v8.30.1): the array-of-tables form `[[allowlist]]`
# fails to load ("'AllowList' expected a map, got 'slice'") and the singular
# `[allowlist]` table is a deprecated 9.x-removal shim. The supported
# multi-entry form is `[[allowlists]]`.

[extend]
useDefault = true

# --- Scanner's own inert test payloads -------------------------------------
[[allowlists]]
description = "Inert scanner test fixtures"
paths = ['''^tests/malware-scan/fixtures/''']

# --- Baseline: 20 pre-existing generic-api-key findings at c1d9d02 ---------
# Scoped to the exact files that carry them (anchored paths) and to the
# generic-api-key rule, so new leaks of any other rule — and any new leak
# outside these paths — still fail the scan.
[[allowlists]]
description = "pre-existing dummy Stellar env values in legacy ci.yml, baselined at c1d9d02 — remove when ci.yml hardening lands"
paths = ['''^\.github/workflows/ci\.yml$''']
targetRules = ["generic-api-key"]

[[allowlists]]
description = "pre-existing JWT test-secret placeholder in src/config/index.ts, baselined at c1d9d02 — remove when the placeholder is rewritten"
paths = ['''^src/config/index\.ts$''']
targetRules = ["generic-api-key"]

[[allowlists]]
description = "pre-existing VALID_SECRET test fixture value, baselined at c1d9d02 — remove when the fixture is rewritten"
paths = ['''^tests/unit/config/stellar\.test\.ts$''']
targetRules = ["generic-api-key"]

[[allowlists]]
description = "pre-existing test-key-1234567890 idempotency fixture value, baselined at c1d9d02 — remove when the fixture is rewritten"
paths = ['''^tests/unit/services/idempotency\.test\.ts$''']
targetRules = ["generic-api-key"]
Loading
Loading