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
Executable
+102
@@ -0,0 +1,102 @@
|
||||
#!/usr/bin/env bash
|
||||
# Seeds one representative violation per privacy rule and asserts privacy-check.sh fails.
|
||||
set -euo pipefail
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
CHECK="$HERE/privacy-check.sh"
|
||||
if ! command -v rg >/dev/null; then echo "skip: ripgrep not installed"; exit 0; fi
|
||||
root="$(mktemp -d "${TMPDIR:-/tmp}/sprachmittler-privacy.XXXXXX")"
|
||||
trap 'find "$root" -depth -delete 2>/dev/null || true' EXIT
|
||||
|
||||
mkdir -p "$root/App" "$root/Packages/SprachmittlerKit/Sources/SprachmittlerCore" "$root/Packages/SprachmittlerKit/Sources/SprachmittlerEngines" "$root/Packages/SprachmittlerKit/Sources/SprachmittlerCapture" "$root/Packages/SprachmittlerKit/Sources/SprachmittlerOllama"
|
||||
seed="$root/Packages/SprachmittlerKit/Sources/SprachmittlerCore/Seed.swift"
|
||||
|
||||
write_base() {
|
||||
: > "$seed"
|
||||
cat > "$root/project.yml" <<'EOF'
|
||||
name: PrivacySelfTest
|
||||
EOF
|
||||
cat > "$root/Packages/SprachmittlerKit/Package.swift" <<'EOF'
|
||||
// swift-tools-version:6.0
|
||||
import PackageDescription
|
||||
let package = Package(name: "PrivacySelfTest")
|
||||
EOF
|
||||
cat > "$root/App/Info.plist" <<'EOF'
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0"><dict><key>LSUIElement</key><true/></dict></plist>
|
||||
EOF
|
||||
cat > "$root/App/Sprachmittler.entitlements" <<'EOF'
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0"><dict><key>com.apple.security.app-sandbox</key><false/></dict></plist>
|
||||
EOF
|
||||
}
|
||||
|
||||
expect_fail() {
|
||||
if SPRACHMITTLER_PRIVACY_ROOT="$root" "$CHECK" >/dev/null 2>&1; then
|
||||
echo "✗ seeded violation was not detected: $1"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ detected: $1"
|
||||
write_base
|
||||
}
|
||||
|
||||
write_base
|
||||
if ! SPRACHMITTLER_PRIVACY_ROOT="$root" "$CHECK" >/dev/null 2>&1; then
|
||||
echo "✗ clean fixture failed privacy-check"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ clean fixture passes"
|
||||
|
||||
echo 'let watcher = "FSEventStreamCreate"' > "$seed"
|
||||
expect_fail "SP-1 file watching"
|
||||
|
||||
echo 'Log.error("\(text)")' > "$seed"
|
||||
expect_fail "SP-2 content logging"
|
||||
|
||||
printf '\n// firebase\n' >> "$root/Packages/SprachmittlerKit/Package.swift"
|
||||
expect_fail "SP-3 telemetry dependency"
|
||||
|
||||
echo 'let session = URLSession.shared' > "$seed"
|
||||
expect_fail "SP-4 networking outside Ollama"
|
||||
|
||||
python3 - "$root/App/Info.plist" <<'PY'
|
||||
import sys
|
||||
from pathlib import Path
|
||||
p=Path(sys.argv[1])
|
||||
s=p.read_text().replace('<dict><key>LSUIElement</key><true/></dict>','<dict><key>LSUIElement</key><true/><key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/></dict></dict>')
|
||||
p.write_text(s)
|
||||
PY
|
||||
expect_fail "SP-5 arbitrary loads"
|
||||
|
||||
echo 'let config = URLSessionConfiguration.default' > "$seed"
|
||||
expect_fail "SP-6 default URL session"
|
||||
|
||||
echo 'UserDefaults.standard.set("text", forKey: "x")' > "$seed"
|
||||
expect_fail "SP-7 text persistence"
|
||||
|
||||
python3 - "$root/App/Sprachmittler.entitlements" <<'PY'
|
||||
import sys
|
||||
from pathlib import Path
|
||||
p=Path(sys.argv[1])
|
||||
s=p.read_text().replace('<key>com.apple.security.app-sandbox</key><false/>','<key>com.apple.security.app-sandbox</key><false/><key>com.apple.security.network.client</key><true/>')
|
||||
p.write_text(s)
|
||||
PY
|
||||
expect_fail "SP-10 extra entitlement"
|
||||
|
||||
echo 'let prompt = "Translate the following text into German."' > "$seed"
|
||||
expect_fail "ADR-002 prompt literal"
|
||||
|
||||
echo 'let pasteboard = NSPasteboard.general' > "$seed"
|
||||
expect_fail "boundary pasteboard"
|
||||
|
||||
echo 'let ax = AXUIElementCreateApplication(1)' > "$seed"
|
||||
expect_fail "boundary Accessibility"
|
||||
|
||||
echo 'try "text".write(to: URL(fileURLWithPath: "/tmp/x"), atomically: true, encoding: .utf8)' > "$seed"
|
||||
expect_fail "persistence write"
|
||||
|
||||
echo 'let image = CGWindowListCreateImage(.zero, .optionOnScreenOnly, kCGNullWindowID, [])' > "$seed"
|
||||
expect_fail "forbidden capture API"
|
||||
|
||||
echo "✓ privacy self-test passed"
|
||||
Reference in new issue
Block a user