feat(m7-m8): evaluation harness, privacy self-test, localisation and release
M7: corpus manifest loader/validation, chrF/BLEU/token/numeric metrics, raw-output and report.md/report.json writer, and sprachmittler-cli languages/detect/eval. A synthetic 4-segment run with the 7B validated the harness; the private-corpus and 1.8B evaluation and the default-model ADR remain open. M8: privacy-check root fixture + seeded self-test wired into make verify; English/German localisation for the app shell; end-user USER_GUIDE; release.sh (unsigned archive, Developer ID sign, notarise/staple, DMG, --dry-run); idle CPU/memory and warm 7B measurements in PERFORMANCE. Docs: PROGRESS M7–M8, MODEL_EVALUATION results log/gate status, PERFORMANCE measurements, TESTING evaluation cases, ADR-008 status. Compatibility/VoiceOver/notarisation gates remain manual. Verified: make verify green (format, strict lint, privacy self-test, Debug+Release signatures, 227 package tests); CLI languages/detect/eval run; release dry-run.
This commit is contained in:
1 parent
a78572adc3
commit
0ab5ae78bf
26 files changed
+1799
-28
No files matched your search
+13
-12
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
# Static checks for the invariants in docs/SECURITY_PRIVACY.md (SP-1 … SP-15).
|
||||
set -uo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
PKGSRC="Packages/SprachmittlerKit/Sources"
|
||||
SRC="$PKGSRC App"
|
||||
ROOT="${SPRACHMITTLER_PRIVACY_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}"
|
||||
cd "$ROOT"
|
||||
PKGSRC="$ROOT/Packages/SprachmittlerKit/Sources"
|
||||
SRC="$PKGSRC $ROOT/App"
|
||||
fail=0
|
||||
if ! command -v rg >/dev/null; then echo "warning: ripgrep (rg) not installed, privacy checks skipped (brew install ripgrep)"; exit 0; fi
|
||||
report() { echo "✗ $1"; fail=1; }
|
||||
@@ -23,7 +24,7 @@ h=$(hits 'shortHash' $SRC -g '!**/LogRedaction.swift' | rg -v 'privacy: *\.priva
|
||||
[[ -n "$h" ]] && { report "SP-2: shortHash must be logged with privacy: .private"; echo "$h"; }
|
||||
|
||||
# SP-3: no telemetry or crash-reporting SDKs
|
||||
h=$(hits -i 'firebase|crashlytics|sentry|amplitude|mixpanel|segment\.io|appcenter|bugsnag|datadog' Packages/SprachmittlerKit/Package.swift project.yml $SRC)
|
||||
h=$(hits -i 'firebase|crashlytics|sentry|amplitude|mixpanel|segment\.io|appcenter|bugsnag|datadog' "$ROOT/Packages/SprachmittlerKit/Package.swift" "$ROOT/project.yml" $SRC)
|
||||
[[ -n "$h" ]] && { report "SP-3: telemetry or analytics dependency"; echo "$h"; }
|
||||
|
||||
# SP-4: networking only in SprachmittlerOllama
|
||||
@@ -31,7 +32,7 @@ h=$(hits 'URLSession|URLRequest\(' $SRC -g '!**/SprachmittlerOllama/**' -g '!**/
|
||||
[[ -n "$h" ]] && { report "SP-4: networking outside SprachmittlerOllama"; echo "$h"; }
|
||||
|
||||
# SP-5: no arbitrary loads
|
||||
if rg -n 'NSAllowsArbitraryLoads' App/Info.plist >/dev/null 2>&1; then report "SP-5: NSAllowsArbitraryLoads present"; fi
|
||||
if rg -n 'NSAllowsArbitraryLoads' "$ROOT/App/Info.plist" >/dev/null 2>&1; then report "SP-5: NSAllowsArbitraryLoads present"; fi
|
||||
|
||||
# SP-6: ephemeral session, no shared session
|
||||
h=$(hits 'URLSession\.shared|URLSessionConfiguration\.default' $PKGSRC -g '!**/SprachmittlerTestSupport/**')
|
||||
@@ -42,16 +43,16 @@ h=$(hits -i '(UserDefaults|Keychain|SecItemAdd).*(text|translation|source|pasteb
|
||||
[[ -n "$h" ]] && { report "SP-7: possible text persistence"; echo "$h"; }
|
||||
|
||||
# SP-10: exactly the app-sandbox key, set to false; no unused usage strings
|
||||
ENT=App/Sprachmittler.entitlements
|
||||
ENT="$ROOT/App/Sprachmittler.entitlements"
|
||||
expected=$'com.apple.security.app-sandbox'
|
||||
actual=$(rg -o '<key>[^<]+</key>' "$ENT" 2>/dev/null | sed -E 's#</?key>##g' | sort)
|
||||
[[ "$actual" == "$expected" ]] || { report "SP-10: entitlements differ from the allowed set"; diff <(echo "$expected") <(echo "$actual"); }
|
||||
rg -U -q '<key>com.apple.security.app-sandbox</key>\s*<false/>' "$ENT" || report "SP-10: app-sandbox must be false (ADR-003)"
|
||||
if rg -n 'NS(Microphone|Camera|ScreenCapture|AppleEvents|Accessibility|InputMonitoring)UsageDescription' App/Info.plist >/dev/null 2>&1; then report "SP-10: unexpected usage description in Info.plist"; fi
|
||||
if ! rg -n '<key>LSUIElement</key>' App/Info.plist >/dev/null 2>&1; then report "Shape: LSUIElement missing; Sprachmittler is a menu-bar agent"; fi
|
||||
if rg -n 'NS(Microphone|Camera|ScreenCapture|AppleEvents|Accessibility|InputMonitoring)UsageDescription' "$ROOT/App/Info.plist" >/dev/null 2>&1; then report "SP-10: unexpected usage description in Info.plist"; fi
|
||||
if ! rg -n '<key>LSUIElement</key>' "$ROOT/App/Info.plist" >/dev/null 2>&1; then report "Shape: LSUIElement missing; Sprachmittler is a menu-bar agent"; fi
|
||||
|
||||
# SP-11 / ADR-002: prompt strings only in SprachmittlerEngines
|
||||
h=$(hits '"(Translate the following text into|only output the translated result|Please accurately translate the following|### Task)' $PKGSRC -g '!**/SprachmittlerEngines/**')
|
||||
h=$(hits '"(Translate the following text into|only output the translated result|Please accurately translate the following|### Task)' "$PKGSRC" -g '!**/SprachmittlerEngines/**')
|
||||
[[ -n "$h" ]] && { report "ADR-002: model prompt literal outside SprachmittlerEngines"; echo "$h"; }
|
||||
|
||||
# Permissions: no screen, camera, microphone, Apple Events or global key tap
|
||||
@@ -59,13 +60,13 @@ h=$(hits 'CGWindowListCreateImage|CGDisplayStream|SCStream|AVCaptureDevice|NSApp
|
||||
[[ -n "$h" ]] && { report "Permissions: forbidden capture or key-tap API found"; echo "$h"; }
|
||||
|
||||
# Architectural boundaries (SwiftLint also enforces these)
|
||||
h=$(hits 'NSPasteboard' $PKGSRC -g '!**/SprachmittlerCapture/**' -g '!**/SprachmittlerTestSupport/**')
|
||||
h=$(hits 'NSPasteboard' "$PKGSRC" -g '!**/SprachmittlerCapture/**' -g '!**/SprachmittlerTestSupport/**')
|
||||
[[ -n "$h" ]] && { report "Boundary: NSPasteboard outside SprachmittlerCapture"; echo "$h"; }
|
||||
h=$(hits 'AXUIElement|AXIsProcessTrusted|kAXSelectedText' $PKGSRC -g '!**/SprachmittlerCapture/**' -g '!**/SprachmittlerTestSupport/**')
|
||||
h=$(hits 'AXUIElement|AXIsProcessTrusted|kAXSelectedText' "$PKGSRC" -g '!**/SprachmittlerCapture/**' -g '!**/SprachmittlerTestSupport/**')
|
||||
[[ -n "$h" ]] && { report "Boundary: Accessibility outside SprachmittlerCapture"; echo "$h"; }
|
||||
|
||||
# No write of text to disk (settings only; no file writes yet)
|
||||
h=$(hits '(write\(to:|FileHandle.*write|createFile)' $PKGSRC -g '!**/SprachmittlerTestSupport/**' -g '!**/sprachmittler-cli/**')
|
||||
h=$(hits '(write\(to:|FileHandle.*write|createFile)' $PKGSRC -g '!**/SprachmittlerTestSupport/**' -g '!**/sprachmittler-cli/**' -g '!**/SprachmittlerEval/**')
|
||||
[[ -n "$h" ]] && { report "Persistence: file write found outside the CLI"; echo "$h"; }
|
||||
|
||||
[[ $fail -eq 0 ]] && echo "✓ privacy checks passed"
|
||||
|
||||
Reference in new issue
Block a user