Add HANDOVER.md: project history, hurdles, current state, how to continue
Browse files- HANDOVER.md +211 -0
- README.md +2 -0
- tools/check_4bit.py +42 -0
- tools/hf_cleanup_old_releases.py +43 -0
HANDOVER.md
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Arx — project history and handover
|
| 2 |
+
|
| 3 |
+
This file tells the story of Arx from the first line of code to today: what was built, which problems came up, how each
|
| 4 |
+
was solved, and how to carry on. Give it to a new Claude session (or a new developer) first.
|
| 5 |
+
Last updated: **2026-10-14** (app 0.5.4, catalog 0.4).
|
| 6 |
+
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
## 1. What Arx is
|
| 10 |
+
|
| 11 |
+
**Arx** (by Devseis) is a free, open-source security audit for **Mac, Windows and Linux computers**.
|
| 12 |
+
|
| 13 |
+
- A desktop app runs **read-only collectors** (bash on macOS/Linux, PowerShell on Windows) that check **70 settings and
|
| 14 |
+
controls**, mapped to **ISO 27001:2022**, **GDPR** and the **EU AI Act**.
|
| 15 |
+
- A small **fine-tuned AI model** (Qwen2.5-0.5B + LoRA) runs **on the computer** (WebLLM, WebGPU) and writes the report:
|
| 16 |
+
findings, risk, fix steps, summary, AI-tool classification. Every AI answer is checked against the evidence; if it
|
| 17 |
+
fails, a fixed template is used instead.
|
| 18 |
+
- **Fix problems:** on Mac and Linux, Arx can change unsafe settings for you (one click, password prompt, re-check,
|
| 19 |
+
**Undo**). The AI never writes or runs commands; fixes are tested scripts.
|
| 20 |
+
- **Nothing is uploaded.** Reports stay on the computer.
|
| 21 |
+
|
| 22 |
+
The design rule from day one: **code decides pass/fail; the model only explains, prioritises and writes.**
|
| 23 |
+
|
| 24 |
+
## 2. Where everything is
|
| 25 |
+
|
| 26 |
+
| What | Where |
|
| 27 |
+
|---|---|
|
| 28 |
+
| Website + full source (this repo) | Space **[Devseis/Arx](https://huggingface.co/spaces/Devseis/Arx)** — page: https://devseis-arx.static.hf.space |
|
| 29 |
+
| Local working copy | `/Users/umer/Documents/6 - mix/endpoint-audit/` (untracked inside the "6 - mix" git repo; the Space is the real repo) |
|
| 30 |
+
| App installers | dataset **[Devseis/endpoint-auditor-releases](https://huggingface.co/datasets/Devseis/endpoint-auditor-releases)** (`latest.json`, `SHA256SUMS`) |
|
| 31 |
+
| AI model | **[Devseis/endpoint-auditor-0.5b](https://huggingface.co/Devseis/endpoint-auditor-0.5b)** + WebLLM builds `-q0f16-MLC`, `-q4f16_1-MLC`, `-q4f32_1-MLC`; tags **v0.3** and **v0.6** |
|
| 32 |
+
| Training data | dataset **[Devseis/endpoint-auditor-synthetic](https://huggingface.co/datasets/Devseis/endpoint-auditor-synthetic)**; tags v0.3, v0.5 |
|
| 33 |
+
| Vulnerability data | dataset **[Devseis/endpoint-auditor-vulndb](https://huggingface.co/datasets/Devseis/endpoint-auditor-vulndb)** (signed bundle) |
|
| 34 |
+
|
| 35 |
+
Licences: code **Apache-2.0** (+ `NOTICE`), data **CC BY 4.0**, `CITATION.cff`.
|
| 36 |
+
|
| 37 |
+
### Repo map
|
| 38 |
+
|
| 39 |
+
| Folder / file | Purpose |
|
| 40 |
+
|---|---|
|
| 41 |
+
| `collectors/{macos,linux}/audit.sh`, `collectors/windows/audit.ps1` | Read-only audit, writes evidence JSON + software inventory |
|
| 42 |
+
| `collectors/{macos,linux}/fix.sh` | One-click fixes with undo (Mac since 0.5.0, Linux since 0.5.3) |
|
| 43 |
+
| `catalog/checks.json` | All checks (76; 70 on computers), references, catalog version **0.4.0** |
|
| 44 |
+
| `library/` | `check_guidance.json` (why/risk/fix/verify per check), `controls.json` (ISO/GDPR/AI Act), `ai_tools.json`, `fixes.json` (fix catalog) |
|
| 45 |
+
| `schema/evidence.schema.json` | Evidence format shared by collectors, generator, app |
|
| 46 |
+
| `baseline.conf`, `organisational.conf` | Settings companies can edit (copied to the app's settings folder) |
|
| 47 |
+
| `synthetic/generate_evidence.py` | Synthetic audits with the exact collector wording (training data source) |
|
| 48 |
+
| `training/` | `build_dataset.py`, `train_lora.py` (`--qat4`), `evaluate.py` (`--round4`), `merge_lora.py`, `mlc_quantize.py`, `publish_model.py`, `pipeline-v0.*.sh`, `eval/*.json` |
|
| 49 |
+
| `vulndb/` | Builds and signs the offline vulnerability bundle (OSV, NVD, CISA KEV, EPSS) |
|
| 50 |
+
| `app/` | Electron desktop app (`main.cjs`, `preload.cjs`, `renderer/`), build config in `package.json` |
|
| 51 |
+
| `index.html`, `site/` | The website (computers only, no AI in the browser) |
|
| 52 |
+
| `install.sh`, `install.ps1` | One-command installers (macOS/Linux, Windows) |
|
| 53 |
+
| `mobile/` | Phone evidence code, still used by the synthetic generator (the phone web page was retired) |
|
| 54 |
+
| `tools/` | Validators, renderers, `hf_cleanup_old_releases.py`, `check_4bit.py` |
|
| 55 |
+
| `docs/MODEL_LLM.md`, `docs/CONTROLS.md` | Model versions and roles; generated control table |
|
| 56 |
+
| `archive/` | Local only, **never upload** (old web chat copy) |
|
| 57 |
+
|
| 58 |
+
## 3. Current state (2026-10-14)
|
| 59 |
+
|
| 60 |
+
| Part | State |
|
| 61 |
+
|---|---|
|
| 62 |
+
| **Website** | Computers only. Detects the OS and shows **one install command** with Copy; lists all 70 checks; shows a report from the app ("Open report with fixes") or an opened `…-evidence.json`. Hero label "Arx - Fine-tuned AI Model". |
|
| 63 |
+
| **Install** | `curl -fsSL https://devseis-arx.static.hf.space/install.sh \| bash` (macOS, Linux) · `irm https://devseis-arx.static.hf.space/install.ps1 \| iex` (Windows). Checks SHA-256 against `SHA256SUMS`; no "Open Anyway", no SmartScreen. |
|
| 64 |
+
| **App** | **0.5.4**. macOS: tested on a real Intel Mac. Linux: tested in Ubuntu containers (app headless + fixes). Windows: **built, never run on a real PC**. |
|
| 65 |
+
| **Fix problems** | Mac: 9 one-click fixes + Settings pages. Linux: 8 one-click fixes. Windows: not built. |
|
| 66 |
+
| **AI** | `app/model-version.json`: `version` **v0.3** (full-precision `q0f16`, chips with 16-bit maths), `version_4bit` **v0.6** (4-bit builds). Both 24/24 on the catalog-0.4 checks without retraining. |
|
| 67 |
+
| **Vulnerability data** | Built **2026-10-08**; reports flag it as old after 14 days → **refresh before 2026-10-22**. |
|
| 68 |
+
|
| 69 |
+
## 4. Timeline: how we got here
|
| 70 |
+
|
| 71 |
+
### Phase 1 — Foundations (2026-10-07)
|
| 72 |
+
- **Built:** read-only collectors for Windows (PowerShell 5.1), Linux and macOS (bash 3.2), following the user's own
|
| 73 |
+
report samples; evidence schema; check catalog; `baseline.conf` / `organisational.conf`; synthetic evidence generator;
|
| 74 |
+
validator and report renderer.
|
| 75 |
+
- **Library + training data:** control library, per-check guidance, AI tool list; `build_dataset.py` turns evidence into
|
| 76 |
+
chat-format examples for 3 tasks (finding, summary, AI classification), with the reference material in every prompt so
|
| 77 |
+
the model learns to stay grounded. First set: 29,000 template-built examples.
|
| 78 |
+
- **Decisions:** train **offline on this Mac** (Intel i7 4-core, 32 GB, no usable GPU) with **Qwen2.5-0.5B-Instruct +
|
| 79 |
+
LoRA**; client = **Electron + WebLLM** (approval screen, live progress, PDF, auto-save after 60 s).
|
| 80 |
+
- **App built and tested end to end** the same day. The base model failed every grounding check (0/30), so a
|
| 81 |
+
fine-tuned model was required.
|
| 82 |
+
|
| 83 |
+
### Phase 2 — First model and vulnerabilities (2026-10-08 → 10-09)
|
| 84 |
+
- **Hurdle: training went NaN.** Cause: PyTorch 2.2 `sdpa` attention gives wrong gradients with several threads on this
|
| 85 |
+
Intel Mac. **Fix:** `attn_implementation="eager"`, a non-finite-gradient guard, numbered checkpoints.
|
| 86 |
+
- **Catalog 0.2** (68 checks); collectors 0.2 tested on a real Mac and in Ubuntu/Fedora containers (Colima).
|
| 87 |
+
- **Offline vulnerability matching:** collectors save a software inventory; `vulndb/build_bundle.py` builds a **signed**
|
| 88 |
+
bundle (OSV for Linux distros, NVD for 33 apps, CISA KEV, EPSS); the app matches versions exactly — never the model.
|
| 89 |
+
*Hurdle:* python.org's `python3` lacks CA certificates → use `/usr/bin/python3` or the training venv.
|
| 90 |
+
- **Everything made open source and public** (user's choice).
|
| 91 |
+
- **Model v0.1 published.** *Hurdle:* MLC's own converter could not run on this Mac → wrote `training/mlc_quantize.py`
|
| 92 |
+
(verified bit-for-bit against mlc-ai builds). *Hurdle:* WebLLM `json_object` without a schema crashed → constrained
|
| 93 |
+
decoding with per-task schemas (`ANSWER_SCHEMAS`). *Hurdle:* summaries got arithmetic wrong → the prompt now carries the
|
| 94 |
+
computed score and top gaps.
|
| 95 |
+
- **Catalog 0.3** added phones (iOS, Android) with a browser "phone check"; **model v0.3** (3,000 examples, 375 steps):
|
| 96 |
+
**100% valid, grounded and exact fields** on 60 held-out examples; on a real Mac audit it wrote 36/36 report parts.
|
| 97 |
+
- **Desktop apps 0.3.0 released** (Mac universal, Windows beta, Linux AppImage/.deb).
|
| 98 |
+
|
| 99 |
+
### Phase 3 — The web chat experiment (2026-10-10 → 10-13)
|
| 100 |
+
- User chose a Nox-style **chat assistant** as the website front page: WebLLM in the browser, grounded in a 321-passage
|
| 101 |
+
knowledge base (`library/knowledge.json`), audit hand-over from the app.
|
| 102 |
+
- **Renamed to Arx** (fortress icon); Space moved to `Devseis/Arx`.
|
| 103 |
+
- **Model v0.4 = Qwen2.5-1.5B** for chat + reports (~2.5 days of CPU training). *Hurdle:* on this Intel Mac the 1.5B
|
| 104 |
+
WebLLM build wrote junk and the GPU faults **logged the user out twice**. On the CPU the same weights scored 10/10, so
|
| 105 |
+
the fault was the Mac's GPU path. Rule since: no large WebLLM GPU tests on this Mac without asking.
|
| 106 |
+
- **v0.5 = 0.5B for chat + reports** (smaller, phone-friendly), including device-aware examples.
|
| 107 |
+
*Hurdle:* **v0.5 broke when rounded to 4 bits** (the browser build), although it was perfect in full precision.
|
| 108 |
+
Found by simulating the exact q4f16_1 rounding on the CPU.
|
| 109 |
+
- **v0.6 = v0.5 retrained 4-bit-aware** (`train_lora.py --qat4`: every forward pass through the exact rounding).
|
| 110 |
+
Test-set scores were perfect, **but** on naturally worded questions the 4-bit chat invented links and refused
|
| 111 |
+
answerable questions. Lesson: the held-out test set is templated like the training data and overstates real quality.
|
| 112 |
+
- Other chat hurdles: iPhone Safari/Chrome killed the tab (the 950 MB 16-bit model was too big for iOS) and lost the
|
| 113 |
+
chat; the model copied earlier answers when given chat history; Intel Iris graphics froze the Mac during generation.
|
| 114 |
+
|
| 115 |
+
### Phase 4 — Back to the core: an audit tool for computers (2026-10-14)
|
| 116 |
+
- **Decision: remove the web chat.** The AI runs **only inside the desktop app**, on structured report tasks, where the
|
| 117 |
+
small model is excellent. The website was **rebuilt** (style inspired by trustmrr.com): computers only, check list,
|
| 118 |
+
report viewer, no AI in the browser. Chat code archived locally.
|
| 119 |
+
- *Hurdle:* **v0.3 also fails in 4-bit** (21–33% valid), affecting computers whose graphics chip lacks 16-bit maths.
|
| 120 |
+
**Fix:** the app picks the model per build — v0.3 full precision, **v0.6 in 4-bit** (findings 43/43, classification 9/9,
|
| 121 |
+
summaries 7/8; a failed summary falls back to the template).
|
| 122 |
+
- **App 0.4.3:** renamed to **Arx** everywhere (files, app, shortcut); settings folder kept at
|
| 123 |
+
"Devseis Endpoint Auditor" so nothing is lost; installer window with first-open steps.
|
| 124 |
+
- **App 0.5.0 — Fix problems (macOS):** `library/fixes.json` + `collectors/macos/fix.sh`. The app passes only catalog fix
|
| 125 |
+
IDs; old values are saved (root-only state file) for **Undo**; MDM-managed settings are skipped; fixes and the re-audit
|
| 126 |
+
run under **one** password prompt. Tested by the user on their Mac (stealth mode, analytics). *Hurdle:* in development
|
| 127 |
+
mode macOS privacy protection (TCC) hid `~/Documents` from the admin process → scripts are copied to a temp folder.
|
| 128 |
+
- **App 0.5.1 — catalog 0.4 (70 checks):** unique user login, prohibited software (`PROHIBITED_SOFTWARE`), tamper
|
| 129 |
+
protection on Mac (SIP) and Linux (SELinux/AppArmor), encryption product named. Both models handled the new checks
|
| 130 |
+
**without retraining** (24/24). *Hurdle:* "µTorrent" broke Windows PowerShell 5.1 (UTF-8 without BOM) → match "Torrent".
|
| 131 |
+
- *Hurdle:* **macOS 26 "Open Anyway" did nothing** for the unnotarised app → workaround `xattr -dr com.apple.quarantine`.
|
| 132 |
+
- **App 0.5.2:** closing the window left a hidden process; the next launch **froze** (second copy waiting on the settings
|
| 133 |
+
lock). **Fix:** closing the window quits Arx; single-instance lock hands a second launch to the running copy.
|
| 134 |
+
- **App 0.5.3 — Fix problems (Linux):** `collectors/linux/fix.sh` (firewall with SSH kept open, automatic updates,
|
| 135 |
+
network time, guest login, usage reporting, automatic login, ClamAV only where ClamAV runs). Tested fix → re-audit →
|
| 136 |
+
undo in Ubuntu containers; files restored byte-for-byte. Also fixed a false "firewall on" (empty nftables ruleset).
|
| 137 |
+
- **One-command install (user's decision):** website shows only `install.sh` / `install.ps1`. Files fetched by
|
| 138 |
+
curl/PowerShell are not quarantined, so **no Gatekeeper/SmartScreen block** — no notarisation needed for this path.
|
| 139 |
+
- **App 0.5.4:** clearer "Ready to audit" screen (two rows of check groups with descriptions and counts).
|
| 140 |
+
- **Hugging Face clean-up:** only what is used remains (model tags v0.3 + v0.6, data tags v0.3 + v0.5, latest release).
|
| 141 |
+
|
| 142 |
+
## 5. Hurdles and lessons (quick reference)
|
| 143 |
+
|
| 144 |
+
| Problem | Cause | Fix / rule |
|
| 145 |
+
|---|---|---|
|
| 146 |
+
| Training loss NaN | torch 2.2 sdpa on multi-thread Intel CPU | `eager` attention, NaN guard |
|
| 147 |
+
| Model fine in tests, junk in browser | 4-bit rounding (q4) destroys some fine-tunes | Test with `evaluate.py --round4` + `tools/check_4bit.py`; train with `--qat4` |
|
| 148 |
+
| Perfect test scores, bad real answers | Test set is templated like training data | Always add hand-written natural prompts before publishing |
|
| 149 |
+
| Mac logged out during GPU tests | Intel Iris GPU faults with large WebLLM models | No big WebLLM GPU tests on this Mac without asking |
|
| 150 |
+
| iPhone tab reloads | iOS per-tab memory limit vs 950 MB model | No in-browser AI on phones (now no in-browser AI at all) |
|
| 151 |
+
| "Open Anyway" does nothing / app blocked | Unnotarised app + macOS 26 | One-command install (no quarantine); real fix = Apple notarisation |
|
| 152 |
+
| Arx frozen at launch | Hidden first copy holding the settings lock | Quit on close + single-instance lock (0.5.2) |
|
| 153 |
+
| "Operation not permitted" in dev mode | TCC protects ~/Documents from admin process | Dev mode copies collectors to a temp folder |
|
| 154 |
+
| µ character broke PS 5.1 | UTF-8 without BOM | Keep `.ps1` files ASCII |
|
| 155 |
+
| HF deletes/tag removal blocked for Claude | Claude Code permission check | Claude writes dry-run scripts; **the user runs them** with `--apply` |
|
| 156 |
+
| python3 TLS errors | python.org build lacks CA certs | Use `training/.venv/bin/python` or `/usr/bin/python3` |
|
| 157 |
+
|
| 158 |
+
## 6. How to work on it
|
| 159 |
+
|
| 160 |
+
**Build and test the app** (in `app/`):
|
| 161 |
+
```bash
|
| 162 |
+
npm test # prompt parity + vulnerability matcher (55 checks)
|
| 163 |
+
npm run dist; npm run dist:win; npm run dist:linux # Mac universal (+ zip with help file), Windows, Linux
|
| 164 |
+
DEVSEIS_SMOKE=/tmp/s "dist/mac-universal/Arx.app/Contents/MacOS/Arx" # automated audit + report
|
| 165 |
+
DEVSEIS_SMOKE=/tmp/s DEVSEIS_FIX_DRY=1 node_modules/.bin/electron . # also the Fix flow, changing nothing
|
| 166 |
+
CFFIXED_USER_HOME=/tmp/home … # run a test copy beside the user's running Arx (separate settings/lock)
|
| 167 |
+
```
|
| 168 |
+
Linux app headless in Docker: install the `.deb`, then `xvfb-run -a /opt/Arx/arx --no-sandbox` (sandbox flag only for
|
| 169 |
+
Docker). Windows scripts: parse/logic-test in `mcr.microsoft.com/powershell`.
|
| 170 |
+
|
| 171 |
+
**Release** (done by hand so far):
|
| 172 |
+
1. Bump `app/package.json` version; update the version text in `index.html`.
|
| 173 |
+
2. Build all three; smoke-test the Mac app (and the Linux `.deb` in Docker).
|
| 174 |
+
3. Stage `Arx-<v>-*` files; `shasum -a 256` → `SHA256SUMS`; write `latest.json` (version, notes, file/size/sha per OS);
|
| 175 |
+
update the releases `README.md` table and notes.
|
| 176 |
+
4. `hf upload Devseis/endpoint-auditor-releases <stage> . --repo-type dataset`.
|
| 177 |
+
5. Upload changed source to the Space with explicit `--include` paths (never `archive/`, `training/models`, `*/out*`).
|
| 178 |
+
6. Later, the user runs `tools/hf_cleanup_old_releases.py --apply` to keep only the current release.
|
| 179 |
+
|
| 180 |
+
**Model work:** `train_lora.py` (add `--qat4` for 4-bit safety) → `evaluate.py` (full and `--round4`) →
|
| 181 |
+
`tools/check_4bit.py` on natural prompts → `merge_lora.py` → `mlc_quantize.py` (q0f16, q4f16_1, q4f32_1) →
|
| 182 |
+
`publish_model.py`. The `pipeline-v0.*.sh` scripts chain these unattended. Then set `app/model-version.json`.
|
| 183 |
+
|
| 184 |
+
**Vulnerability data refresh:** `/usr/bin/python3 vulndb/build_bundle.py` (≈1 GB of downloads) →
|
| 185 |
+
`node vulndb/sign-bundle.mjs` (private key `~/.devseis/vulndb-ed25519-private.pem`, never in the repo) → upload to
|
| 186 |
+
`Devseis/endpoint-auditor-vulndb`. Installed apps fetch it automatically.
|
| 187 |
+
|
| 188 |
+
## 7. Rules agreed with the user
|
| 189 |
+
- Code decides compliance; the AI only explains. **The AI never writes or runs commands.**
|
| 190 |
+
- **Never upload real audit evidence** (personal data). Training data is synthetic only.
|
| 191 |
+
- Read-only by default; a change happens only after the user ticks a fix, sees what changes and enters a password;
|
| 192 |
+
every fix can be undone. No permanent admin rights or background helper (least privilege).
|
| 193 |
+
- Hugging Face deletions are run by the user (scripts with dry run first).
|
| 194 |
+
- Ask before heavy GPU tests on the Intel Mac.
|
| 195 |
+
- Keep only what is in use on Hugging Face.
|
| 196 |
+
|
| 197 |
+
## 8. Open items / next steps
|
| 198 |
+
1. **Refresh the vulnerability data before 2026-10-22**, then automate a weekly refresh.
|
| 199 |
+
2. **Windows:** first real test on a Windows 10/11 PC or VM (app, audit, `install.ps1` silent install), then
|
| 200 |
+
**Fix problems for Windows** (firewall profiles, Defender, updates, guest account, automatic sign-in…).
|
| 201 |
+
3. **Linux:** test on a real desktop (pkexec prompt) and on Red Hat/Fedora (firewalld, dnf-automatic).
|
| 202 |
+
4. **Apple notarisation** ($99/yr Developer ID) and a **Windows code-signing certificate**, so direct file downloads
|
| 203 |
+
also open without warnings.
|
| 204 |
+
5. Expert review of `library/` wording and fix steps.
|
| 205 |
+
6. Releases repo currently holds 0.5.3 and 0.5.4 → run `tools/hf_cleanup_old_releases.py --apply` when ready.
|
| 206 |
+
|
| 207 |
+
## 9. Starting a new session
|
| 208 |
+
Give Claude this file and say what you want next, for example:
|
| 209 |
+
|
| 210 |
+
> Read `HANDOVER.md` in the Arx repo (Space Devseis/Arx; local copy in `/Users/umer/Documents/6 - mix/endpoint-audit/`).
|
| 211 |
+
> Continue with: refresh the vulnerability data.
|
README.md
CHANGED
|
@@ -11,6 +11,8 @@ license: apache-2.0
|
|
| 11 |
|
| 12 |
# Devseis Endpoint Auditor — stage 1, steps 1–3
|
| 13 |
|
|
|
|
|
|
|
| 14 |
A **read-only** audit of a Windows, Linux or macOS endpoint against a security baseline, GDPR technical
|
| 15 |
controls, EU AI Act controls and organisational controls. It produces:
|
| 16 |
|
|
|
|
| 11 |
|
| 12 |
# Devseis Endpoint Auditor — stage 1, steps 1–3
|
| 13 |
|
| 14 |
+
> **Project history and handover:** see [HANDOVER.md](HANDOVER.md) — what was built, the problems met and how they were solved, the current state and next steps.
|
| 15 |
+
|
| 16 |
A **read-only** audit of a Windows, Linux or macOS endpoint against a security baseline, GDPR technical
|
| 17 |
controls, EU AI Act controls and organisational controls. It produces:
|
| 18 |
|
tools/check_4bit.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Quick 4-bit sanity check of LoRA adapters on hand-written prompts (CPU).
|
| 2 |
+
|
| 3 |
+
Merges each adapter into Qwen2.5-0.5B-Instruct, rounds every weight exactly like the browser's q4f16_1 build
|
| 4 |
+
(training/mlc_quantize.quantize) and prints the first words of each answer. Use it before publishing a model:
|
| 5 |
+
the held-out test set is templated like the training data and can hide 4-bit damage (v0.5 broke this way).
|
| 6 |
+
|
| 7 |
+
TOK=200 training/.venv/bin/python tools/check_4bit.py prompts.jsonl auditor-lora-v0.6/final [more adapters]
|
| 8 |
+
|
| 9 |
+
prompts.jsonl: one {"label": ..., "messages": [...]} per line (chat format, without the answer).
|
| 10 |
+
"""
|
| 11 |
+
import json, os, sys, time
|
| 12 |
+
os.environ["HF_HUB_OFFLINE"] = os.environ["TRANSFORMERS_OFFLINE"] = "1"
|
| 13 |
+
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))); sys.path.insert(0, ROOT + "/training")
|
| 14 |
+
import numpy as np, torch
|
| 15 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 16 |
+
from peft import PeftModel
|
| 17 |
+
from mlc_quantize import quantize
|
| 18 |
+
from build_chat import check_chat
|
| 19 |
+
torch.set_num_threads(os.cpu_count())
|
| 20 |
+
B = ROOT + "/training/models/Qwen2.5-0.5B-Instruct"
|
| 21 |
+
tok = AutoTokenizer.from_pretrained(B, local_files_only=True)
|
| 22 |
+
jobs = [json.loads(l) for l in open(sys.argv[1])]
|
| 23 |
+
def fake(w):
|
| 24 |
+
p, sc = quantize(w.float().numpy(), np.float16)
|
| 25 |
+
q = np.stack([(p >> np.uint32(4*k)) & np.uint32(15) for k in range(8)], -1).reshape(w.shape[0], -1).astype(np.float32) - 7
|
| 26 |
+
return torch.from_numpy((q.reshape(w.shape[0], -1, 32) * sc.astype(np.float32)[..., None]).reshape(w.shape))
|
| 27 |
+
for ad in sys.argv[2:]:
|
| 28 |
+
m = AutoModelForCausalLM.from_pretrained(B, local_files_only=True, torch_dtype=torch.float32, attn_implementation="eager")
|
| 29 |
+
m = PeftModel.from_pretrained(m, ROOT + "/training/models/" + ad).merge_and_unload().half().float().eval()
|
| 30 |
+
with torch.no_grad():
|
| 31 |
+
for n, prm in m.named_parameters():
|
| 32 |
+
if prm.dim() == 2 and prm.shape[1] % 32 == 0: prm.copy_(fake(prm))
|
| 33 |
+
ok = 0
|
| 34 |
+
for job in jobs:
|
| 35 |
+
ids = tok.apply_chat_template(job["messages"], add_generation_prompt=True, return_tensors="pt")
|
| 36 |
+
with torch.no_grad():
|
| 37 |
+
out = m.generate(ids, attention_mask=torch.ones_like(ids), max_new_tokens=int(os.environ.get("TOK","120")), do_sample=False, pad_token_id=tok.eos_token_id)
|
| 38 |
+
r = tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True).strip()
|
| 39 |
+
good = r.startswith(("Full", "A host", "This browser", "I can see", "Your device", "I don't", "An ", "The ")) and "[" in r
|
| 40 |
+
ok += good
|
| 41 |
+
print(f" {ad} | {job['label'][10:45]} | {r[:110]!r}", flush=True)
|
| 42 |
+
print(f"== {ad}: {ok}/{len(jobs)} look right", flush=True)
|
tools/hf_cleanup_old_releases.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Arx releases clean-up: keep only the current release (the version in latest.json) in Devseis/endpoint-auditor-releases.
|
| 2 |
+
|
| 3 |
+
Dry run (default) prints the plan; --apply does it.
|
| 4 |
+
- deletes every Arx installer/blockmap file of an older version
|
| 5 |
+
- updates the README sentence about older files
|
| 6 |
+
- squashes the history, so the deleted files stop using storage
|
| 7 |
+
Stops if the current version's Mac, Windows and Linux files are not all there.
|
| 8 |
+
"""
|
| 9 |
+
import json
|
| 10 |
+
import sys
|
| 11 |
+
from huggingface_hub import HfApi, CommitOperationAdd, CommitOperationDelete, hf_hub_download
|
| 12 |
+
|
| 13 |
+
APPLY = "--apply" in sys.argv
|
| 14 |
+
REPO, KIND = "Devseis/endpoint-auditor-releases", "dataset"
|
| 15 |
+
api = HfApi()
|
| 16 |
+
|
| 17 |
+
keep_version = json.load(open(hf_hub_download(REPO, "latest.json", repo_type=KIND, force_download=True)))["version"]
|
| 18 |
+
files = [f for f in api.list_repo_tree(REPO, repo_type=KIND, recursive=True) if getattr(f, "size", None) is not None]
|
| 19 |
+
names = [f.path for f in files]
|
| 20 |
+
current = [p for p in names if p.startswith(f"Arx-{keep_version}-")]
|
| 21 |
+
for needed in (f"Arx-{keep_version}-mac-universal.dmg", f"Arx-{keep_version}-windows-x64-setup.exe", f"Arx-{keep_version}-linux-x86_64.deb"):
|
| 22 |
+
assert needed in names, f"{needed} is missing; stopping"
|
| 23 |
+
old = [p for p in names if (p.startswith("Arx-") or p.startswith("Devseis-Endpoint-Auditor-")) and p not in current]
|
| 24 |
+
|
| 25 |
+
print(f"Current version (latest.json): {keep_version}")
|
| 26 |
+
print("KEEP ", *[p for p in names if p not in old], sep="\n ")
|
| 27 |
+
print("DELETE", *(old or ["(nothing)"]), sep="\n ")
|
| 28 |
+
if not old:
|
| 29 |
+
print("\nNothing to delete.")
|
| 30 |
+
sys.exit(0)
|
| 31 |
+
print(f"\nFrees about {sum(f.size for f in files if f.path in old) / 1e9:.1f} GB.")
|
| 32 |
+
if not APPLY:
|
| 33 |
+
print("Dry run only. Run again with --apply to do it.")
|
| 34 |
+
sys.exit(0)
|
| 35 |
+
|
| 36 |
+
readme = open(hf_hub_download(REPO, "README.md", repo_type=KIND, force_download=True), encoding="utf-8").read()
|
| 37 |
+
readme = readme.replace("Earlier 0.5.x files are kept for now.", "Only the current version is kept.")
|
| 38 |
+
api.create_commit(REPO, repo_type=KIND, commit_message=f"Keep only Arx {keep_version}: remove older installers",
|
| 39 |
+
operations=[CommitOperationDelete(p) for p in old] + [CommitOperationAdd("README.md", readme.encode())])
|
| 40 |
+
api.super_squash_history(REPO, branch="main", repo_type=KIND, commit_message=f"Arx {keep_version} (older versions removed)")
|
| 41 |
+
left = [f.path for f in api.list_repo_tree(REPO, repo_type=KIND, recursive=True) if getattr(f, "size", None) is not None]
|
| 42 |
+
assert not any(p in left for p in old), "some old files are still there"
|
| 43 |
+
print("Done. Files now:", *left, sep="\n ")
|