SIDIK-ML: Explainable Non-Neural ML Extension
Ekstensi Machine Learning Klasik Non-Neural Terjelaskan untuk Reduksi False Positive Deteksi Hardcoded Secret SIDIK
Explainable Classical Non-ANN Machine Learning Extension for False Positive Reduction in SIDIK Static Secret Detection
🇮🇩 Bahasa Indonesia
📌 Ikhtisar Proyek & Filosofi Desain
SIDIK-ML adalah paket perangkat lunak Python independen yang memperluas kemampuan pemindai deterministik SIDIK (>=v1.3.4) dengan lapisan penyaringan false positive berbasis klasifikasi klasik Non-Artificial Neural Network (Non-ANN) yang terjelaskan.
Alih-alih mengganti mesin aturan deterministik SIDIK atau menyisipkan model deep neural network berbobot ratusan megabita, SIDIK-ML bekerja sebagai plugin opsional melalui kontrak data aman SecretCandidate (schema_version = "1.0.0") dan entry point standar sidik.plugins. Ketika dijalankan melalui sidik-ml gui, sidik-ml interactive, maupun --enable-ml, antarmuka menampilkan tema khusus Amber Orange (#f59e0b / #ea580c) lengkap dengan lencana NON-ANN ML, prompt sidik-ml>, serta dasbor HTML bernuansa kuning-oranye agar langsung terbedakan dari mode deterministik standar Ocean Blue (#3b82f6) milik SIDIK.
✨ Fitur dan Kapabilitas Utama
- Lima Model Klasik Non-ANN dengan Penjaga Penolak Arsitektur Neural:
- Mendukung eksklusif Logistic Regression, Decision Tree, Random Forest, Extra Trees, dan Gradient Boosting via
create_non_ann_model(). - Fungsi
validate_non_ann_model_name()secara eksplisit menolak model neural (ann,mlp,cnn,rnn,lstm,transformer,codebert) demi menjamin transparansi keputusan dan bobot ringan.
- Mendukung eksklusif Logistic Regression, Decision Tree, Random Forest, Extra Trees, dan Gradient Boosting via
- Rekayasa
30Fitur Statis Bebas Target Leakage (FEATURE_SCHEMA_VERSION = "1.0.0"):- Mengekstrak tujuh dimensi fitur murni dari konteks pemindaian (
string_stats,entropy,pattern_evidence,lexical_context,code_context,file_context, sertadeterministic_signal) tanpa pernah menyimpan nilai kredensial mentah (hanyamasked_valuedanvalue_sha256).
- Mengekstrak tujuh dimensi fitur murni dari konteks pemindaian (
- Validasi Silang Anti-Kebocoran Data (Zero Data Leakage):
- Menyediakan
deduplicate_records(),resolve_cross_repo_value_duplicates()berbasis SHA-256,stratified_repository_split()(StratifiedGroupKFold), sertaassert_no_leakage()yang memastikan nol tumpang-tindihrepo_idmaupunvalue_sha256antara himpunan latih dan uji.
- Menyediakan
- Kebijakan Triage Hibrida Fail-Safe (
TriagePolicy):- Secara default beroperasi pada mode konsultatif (
suppress_false_positives=False) sehingga seluruh temuan deterministikSIDIKtetap ditampilkan bersama probabilitas rahasia dan kontribusi fitur pendorongnya (explain_single_candidate()). - Saat supresi diaktifkan,
never_suppress_severities=("CRITICAL",)melindungi temuan kritis agar tidak pernah dibungkam diam-diam oleh model ML.
- Secara default beroperasi pada mode konsultatif (
- Integrasi Penuh Plugin (
sidik.plugins) & Thin Launcher TUI/GUI/SCA:- Terdaftar ke grup
sidik.pluginsmelalui plugin.py, sehingga perintahsidik-ml interactive,sidik-ml gui, dansidik-ml-guimembuka antarmuka TUI serta Desktop GUISIDIKdengan kontrol ML Triage aktif. sidik-ml scanmendukung paritas CI/CD (--fail-on,--severity,--mode,--baseline,--sarif-output),--include-deps(OSV SCA),fetch-model, serta 8 format laporan (console,compact,sarif,github,html,markdown,json,csv).
- Terdaftar ke grup
- Serialisasi Luring Terverifikasi SHA-256 (
skops):- Artefak
.skopsselalu diverifikasi checksum SHA-256-nya (verify_artifact_sha256atau otomatis dari<model>.manifest.json) dan diperiksa terhadap daftar putih tipe aman (SAFE_SKOPS_TYPE_PREFIXES) tanpapickle/joblibmentah.
- Artefak
🏗️ Arsitektur Integrasi Hibrida
Kode Sumber & Manifes Target
│
▼
SIDIK Core (>=v1.3.4, SAST 12 Aturan Regex + Entropi + Konteks + Offline OSV SCA)
│
├──[Kontrak SecretCandidate v1.0.0 (masked_value + value_sha256)]──┐
│ ▼
│ SIDIK-ML Plugin
│ (30 Fitur Statis -> skops + SHA-256
│ -> Probabilitas + Explainability)
│ │
◄──[sisipan metadata ml_triage & TriagePolicy Fail-Safe CRITICAL]───┘
│
▼
CLI Interaktif (TUI) │ Desktop GUI │ 8 Format Laporan (Console, Compact, HTML, SARIF v2.1.0, GitHub, MD, JSON, CSV)
📊 Ringkasan Hasil Empiris Terverifikasi
Seluruh angka di bawah tercatat pada eksperimen reproduksibel SIDIK-ML dengan seed = 42, 5-fold StratifiedGroupKFold, 1.000 bootstrap resamples, dan uji McNemar pada dataset terbuka Samsung/CredData (258 latih di 86 repo, 64 held-out test di 23 unseen repo), 25 repositori Python eksternal, serta 1.094 sampel zero-shot CredDetX:
1. Baseline SIDIK v1.1.0 vs Lima Model Non-ANN (CredData Held-Out, N = 64)
| Model / Kondisi | 5-Fold CV F1 | Precision Uji | Recall Uji | F1-Score Uji | MCC Uji | FPR Uji | McNemar p vs SIDIK |
|---|---|---|---|---|---|---|---|
Kondisi A: SIDIK v1.1.0 |
- | 0,8103 |
0,8868 |
0,8468 |
-0,1465 |
1,0000 |
- |
| Logistic Regression | 0,8550 +- 0,0444 |
1,0000 |
0,8302 |
0,9072 |
0,6757 |
0,0000 |
0,15159 |
| Decision Tree | 0,8146 +- 0,1020 |
0,9000 |
0,8491 |
0,8738 |
0,3600 |
0,4545 |
0,45450 |
| Random Forest | 0,8949 +- 0,0236 |
0,9298 |
1,0000 |
0,9636 |
0,7692 |
0,3636 |
0,000244 |
| Extra Trees | 0,8957 +- 0,0408 |
0,9400 |
0,8868 |
0,9126 |
0,5604 |
0,2727 |
0,11532 |
Gradient Boosting (Pilihan CV) |
0,9028 +- 0,0249 |
0,9038 |
0,8868 |
0,8952 |
+0,4178 |
0,4545 |
0,21011 |
- Integrasi Hibrida & Pengaman Fail-Safe
CRITICAL: Pada Kondisi C1 (Post-SIDIK Triage), Gradient Boosting menekan FP sebesar36,36%dan memulihkan MCC ke+0,1597sembari melindungi3temuanCRITICAL; pada Kondisi C2 (Candidate-Wide), Recall mencapai0,9057, F10,8889, dan MCC+0,2923. - Generalisasi Eksternal (
E1&E2): Pada 25 repository Python publik (1.193berkas.py), model menandai7 / 20(35,0%) temuan deterministik sebagai false positive dengan tambahan latensi hanya+3,6 ms(+0,15%) dan melindungi4temuanCRITICAL(REVIEW_PRIORITY). Pada uji zero-shot CredDetX (1.094kandidat) yang mengalami domain shift, konfigurasi hibridaC1menjaga stabilitasF1 = 0,7969danMCC = +0,2075, mengungguliSIDIK v1.1.0murni (MCC = +0,1999) maupun model tunggal (MCC = -0,2052). - Overhead Inferensi Luring: Inferensi batch
Gradient Boostinghanya1,00 ms(0,0156 ms/kandidat), puncak memori12,76 KB, dan ukuran artefak2.533,63 KB(.skops).
📁 Struktur Paket
SIDIK-ML/
├── .github/workflows/sidik-ml-ci.yml # CI otomatis pytest, plugin discovery, & CLI
├── action.yml # Composite GitHub Action (SARIF & PR annotations)
├── sidik_ml/
│ ├── __init__.py # Ekspor publik paket SIDIK-ML
│ ├── __main__.py # Titik masuk modul (python -m sidik_ml)
│ ├── cli.py # CLI scan, train, ekstrak fitur, TUI & GUI launchers
│ ├── plugin.py # Adapter entry point sidik.plugins (SidikMLPlugin)
│ ├── schemas.py # MLPrediction, HybridFinding, TriagePolicy
│ ├── features.py # 30 fitur statis bebas target leakage
│ ├── models.py # 5 model Non-ANN & neural exclusion guard
│ ├── dataset.py # JSONL I/O, deduplikasi SHA-256, StratifiedGroupKFold
│ ├── evaluation.py # F1, MCC, bootstrap CI, McNemar test, ablasi fitur
│ ├── explainability.py # Bobot model, permutation importance, penjelasan kandidat
│ ├── serialization.py # Save/load .skops aman terverifikasi SHA-256
│ ├── training.py # Pipeline pelatihan reproduksibel & provenans JSON
│ └── integration.py # HybridTriagePipeline (SIDIK + opsional ML classifier)
├── tests/ # Unit & integration tests (pytest)
├── pyproject.toml # Konfigurasi paket, dependencies, & entry points
├── CHANGELOG.md
├── LICENSE
└── README.md
🚀 Panduan Instalasi & Pemakaian Cepat
1. Instalasi Global via PyPI (Pengguna Umum & CI/CD)
SIDIK-ML secara otomatis memasang dependensi inti SIDIK (sidik>=1.3.4), sehingga pengembang dapat langsung memasang satu perintah dari PyPI:
# Pemindai CLI & plugin Non-ANN ML
pip install sidik-ml
# Lengkap dengan antarmuka Desktop GUI (Pillow + Matplotlib)
pip install "sidik-ml[gui]"
Untuk pengembangan lokal dari source repository:
..\SIDIK\.venv\Scripts\Activate.ps1 # Windows PowerShell
# source ../SIDIK/.venv/bin/activate # Linux / macOS
pip install -e "..\SIDIK[gui]"
pip install -e .
Catatan Windows PowerShell: Apabila Anda membuka langsung folder
SIDIK\.venv\Scriptstanpa menjalankanActivate.ps1, PowerShell tidak memuat perintah dari folder aktif secara otomatis. Gunakan awalan.\(misalnya.\sidik-ml -i,.\sidik-ml --gui,.\sidik -i, atau.\sidik --gui), atau aktifkan virtual environment terlebih dahulu dengan.\Activate.ps1. Jika skrip aktivasi terblokir kebijakan eksekusi PowerShell, jalankan lewatpython -m sidik_ml ...atau gunakan peluncurrun_sidik_ml.bat/run_sidik_ml_cli.bat.
2. Perintah Harian (Selaras sidik dan sidik-ml)
Melalui entry point sidik.plugins, perintah sidik-ml dan sidik kini mendukung pola argumen yang simetris untuk TUI, Desktop GUI, pemindaian one-shot, modul python -m, serta 8 format laporan:
# 1. Periksa versi atau luncurkan TUI / Desktop GUI (simetris dengan sidik -i / sidik --gui)
sidik-ml --version
sidik-ml -i # atau: sidik-ml interactive / python -m sidik_ml -i / run_sidik_ml_cli.bat
sidik-ml --gui # atau: sidik-ml gui / sidik-ml-gui / python -m sidik_ml --gui / run_sidik_ml.bat
# 2. Pindai langsung (konsol Amber-Orange + exit code CI/CD --fail-on)
sidik-ml . --fail-on high
sidik-ml --target path/to/project --include-deps --model model.skops --format html -o hasil_ml.html
sidik-ml scan path/to/project --include-deps --model model.skops --format html -o hasil_ml.html
# 3. Pindai dengan output ringkas / JSON (tanpa supresi default)
sidik-ml scan path/to/project --format compact --fail-on none
sidik-ml scan path/to/project --json --fail-on none
# 4. Atau gunakan langsung dari perintah standar SIDIK
sidik --list-plugins
sidik --target path/to/project --enable-ml --ml-model model.skops
# 5. Unduh model .skops terverifikasi SHA-256 ke cache pengguna
sidik-ml fetch-model https://example.com/gradient_boosting.skops --sha256 <hex_digest>
# 6. Ekspor fitur bebas leakage dari kandidat untuk anotasi / eksperimen
sidik-ml extract-features path/to/project --output candidates.jsonl --repo-id my_repo
# 7. Verifikasi integritas checksum SHA-256 artefak model .skops
sidik-ml verify-model model.skops --sha256 <hex_digest>
# 8. Latih & bandingkan 5 model Non-ANN menggunakan StratifiedGroupKFold
sidik-ml train dataset.jsonl --output-dir artifacts/ --stratified
# 9. Jalankan seluruh unit & integration tests
pytest tests -v
# 10. Atau jalankan lewat GitHub Container Registry (ghcr.io) tanpa setup Python
docker run --rm -v "${PWD}:/workspace" ghcr.io/radityobw/sidik-ml:latest /workspace --include-deps
🗺️ Ekosistem Perangkat Lunak Publik (Public Software Ecosystem)
| Repositori | Peran Utama | Versi Terkini | Tautan |
|---|---|---|---|
| SIDIK | Mesin pemindai deterministik SAST & OSV SCA + host plugin UI | github.com/radityobw/SIDIK |
|
| SIDIK-ML | Perangkat lunak ekstensi Explainable Non-ANN ML & plugin | github.com/radityobw/SIDIK-ML |
🇬🇧 English
📌 Project Overview
SIDIK-ML is an independent Python package extending the deterministic SIDIK (>=v1.3.4) security analyzer with explainable classical Non-Artificial Neural Network (Non-ANN) machine learning for false-positive reduction in hardcoded secret detection.
Instead of forking SIDIK's UI or introducing heavy deep learning weights, SIDIK-ML integrates through the leak-safe SecretCandidate (schema_version = "1.0.0") contract and the standard sidik.plugins entry-point group. When launched via sidik-ml gui, sidik-ml interactive, or --enable-ml, the shared UI switches cleanly into an Amber Orange (#f59e0b / #ea580c) identity with NON-ANN ML badges, amber-yellow sidik-ml> console prompts, and warm orange-themed HTML/Markdown triage dashboards, clearly distinguishing hybrid ML analysis from Core SIDIK's Ocean Blue (#3b82f6) deterministic edition.
✨ Key Capabilities
- Strict Non-ANN Model Suite: Evaluates Logistic Regression, Decision Tree, Random Forest, Extra Trees, and Gradient Boosting, backed by
validate_non_ann_model_name()to reject neural network architectures. - 30 Leakage-Free Static Features (
FEATURE_SCHEMA_VERSION = "1.0.0"): Extracts string statistics, Shannon entropy metrics, rule indicators, lexical cues, code structure, and file context without persisting raw credentials. - Zero Data Leakage Splitting & Verification: Enforces cross-repo
value_sha256collision resolution,StratifiedGroupKFoldgrouped byrepo_id, and explicitassert_no_leakage()checks. - Fail-Safe Hybrid
TriagePolicy: Runs in advisory mode by default (suppress_false_positives=False) and shieldsCRITICALfindings (never_suppress_severities=("CRITICAL",)). - Hardened Offline
skopsLoading: Validates.skopsmodel digests against explicit SHA-256 checksums or companion.manifest.jsonfiles and restricts deserialization toSAFE_SKOPS_TYPE_PREFIXES.
📊 Verified Empirical Highlights (CredData Held-Out N = 64, 25 Repos, & CredDetX)
| Model / Configuration | 5-Fold CV F1 | Test Precision | Test Recall | Test F1 | Test MCC | Test FPR |
|---|---|---|---|---|---|---|
Condition A: SIDIK v1.1.0 |
- | 0.8103 |
0.8868 |
0.8468 |
-0.1465 |
1.0000 |
| Logistic Regression | 0.8550 |
1.0000 |
0.8302 |
0.9072 |
0.6757 |
0.0000 |
| Random Forest | 0.8949 |
0.9298 |
1.0000 |
0.9636 |
0.7692 |
0.3636 |
Gradient Boosting (CV Winner) |
0.9028 |
0.9038 |
0.8868 |
0.8952 |
+0.4178 |
0.4545 |
On 25 external Python repositories (1,193 .py files), the CV-selected model flags 35.0% (7/20) of deterministic alerts as false positives with only +3.6 ms (+0.15%) runtime overhead. Under zero-shot domain shift on CredDetX (1,094 candidates), fail-safe Hybrid Condition C1 preserves F1 = 0.7969 and MCC = +0.2075, outperforming both standalone deterministic SIDIK and unguarded ML classifiers.
🚀 Quick Start
# Global install from PyPI (Core SIDIK is installed automatically)
pip install sidik-ml
pip install "sidik-ml[gui]"
# Check version and launch Amber-Orange SIDIK-ML Interactive CLI (TUI) or Desktop GUI
sidik-ml --version
sidik-ml -i --lang en # or: sidik-ml interactive / python -m sidik_ml -i / run_sidik_ml_cli.bat
sidik-ml --gui # or: sidik-ml gui / sidik-ml-gui / python -m sidik_ml --gui / run_sidik_ml.bat
# Run unified Secret + SCA scan (defaults to console output and --fail-on any)
sidik-ml . --fail-on high
sidik-ml --target path/to/project --include-deps --model model.skops --format html -o ml_report.html --lang en
sidik-ml fetch-model https://example.com/gradient_boosting.skops --sha256 <hex_digest>
# Run tests
pytest tests -v
# Run via GitHub Container Registry (ghcr.io) or install .whl from GitHub Releases
docker run --rm -v "${PWD}:/workspace" ghcr.io/radityobw/sidik-ml:latest /workspace --include-deps
Windows PowerShell Note: When running executables directly inside
SIDIK\.venv\Scriptswithout activating.venvfirst, prefix commands with.\(e.g.,.\sidik-ml -i,.\sidik-ml --gui) or invoke viapython -m sidik_ml ...(orrun_sidik_ml.bat/run_sidik_ml_cli.bat).
📄 License
Distributed under the MIT License. See LICENSE.
Metadata
Release files for sidik-ml 0.5.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sidik_ml-0.5.6.tar.gz | 48.1 kB | With provenance | Details for sidik_ml-0.5.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sidik_ml-0.5.6-py3-none-any.whl | Python 3 | none | any | Details for sidik_ml-0.5.6-py3-none-any.whl |
Total release size: 85.9 kB
Release files / sidik_ml-0.5.6.tar.gz
| Download URL | sidik_ml-0.5.6.tar.gz |
|---|---|
| Size | 48.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da8df3abcfde20099b54d481477c20549b64900a4252cc40b8ed5d65aee9cb56
|
|
BLAKE2b-256 checksum How to use checksums |
c5d153200293d16591f675b54200e66ec0e2e089908d2db03906a567ae69d795
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logRelease files / sidik_ml-0.5.6-py3-none-any.whl
| Download URL | sidik_ml-0.5.6-py3-none-any.whl |
|---|---|
| Size | 37.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a22dc10f58363ed33398a921bf7112e982b10f17de603a1c8c7c6087fcca1101
|
|
BLAKE2b-256 checksum How to use checksums |
fd5c4d7bb58c8aab89c1a196087c244f8eee8ae7a554679b28154c0ddc5c5d38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logSecurity for sidik-ml 0.5.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sidik_ml-0.5.6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.