Version: 1.0 Last Updated: 2025-11-22 Status: Active
UbiCity is a privacy-first learning capture system. This threat model identifies security risks, threat actors, attack vectors, and mitigations to protect learner data and system integrity.
Primary Asset: Learning experience data (WHO/WHERE/WHAT) Security Goal: Confidentiality, integrity, availability of learner data
┌─────────────┐
│ Learner │ (captures experiences via CLI)
└──────┬──────┘
│
v
┌─────────────┐
│ CLI │ (TypeScript/Deno runtime)
│ (src/*.ts) │
└──────┬──────┘
│
v
┌─────────────┐
│ Validator │ (Rust/WASM, ReScript)
│ (WASM) │
└──────┬──────┘
│
v
┌─────────────┐
│ Storage │ (Local JSON files)
│ (./data) │
└─────────────┘
Motivation: Access private learning data, modify experiences Capability: Filesystem access, command execution Likelihood: Medium Impact: High (privacy violation)
Motivation: Supply chain attack, data exfiltration Capability: Code execution during install/runtime Likelihood: Low (zero npm dependencies) Impact: Critical
Motivation: None (unintentional) Capability: User error (sharing private data) Likelihood: Medium Impact: Medium (privacy violation)
Motivation: Code execution, memory corruption Capability: Exploit WASM sandbox escape Likelihood: Very Low Impact: High
Threat: Malicious user reads private learning data Attack Vector:
- Direct filesystem access to
./ubicity-data/ - Memory dump while CLI running
- Shared computer access
Mitigations:
- ✅ File permissions (user-only read/write)
- ✅ No cloud sync by default (local-only)
- ✅ Privacy levels (private/anonymous/public)
⚠️ Encryption at rest (not implemented - future)
Risk: MEDIUM → LOW (with mitigations)
Threat: Malicious modification of experiences Attack Vector:
- Direct JSON file editing
- CLI command injection
- WASM validator bypass
Mitigations:
- ✅ WASM validation (integrity checks)
- ✅ Deno permissions (
--allow-writelimited to data dir) - ✅ TypeScript compile-time checks
⚠️ Cryptographic signatures (not implemented - future)
Risk: LOW
Threat: Malicious dependency exfiltrates data Attack Vector:
- Compromised npm package
- Malicious Deno module
- Backdoored compiler
Mitigations:
- ✅ ZERO npm dependencies (production)
- ✅ Deno JSR registry (cryptographically signed)
- ✅ Nix reproducible builds (pinned dependencies)
- ✅ GitLab CI verification on every commit
- ✅
cargo auditfor Rust dependencies
Risk: VERY LOW
Threat: Attacker executes arbitrary commands via CLI Attack Vector:
- Malicious input in description field
- Filename injection (
../../etc/passwd) - Shell metacharacters
Mitigations:
- ✅ Deno sandboxing (explicit permissions)
- ✅ Path validation (no directory traversal)
- ✅ Input sanitization (Zod schemas)
- ✅ No
eval()or dynamic code execution
Risk: VERY LOW
Threat: User accidentally shares private data Attack Vector:
- Exporting with private experiences included
- Publishing dataset without anonymization
- Sharing visualization with PII
Mitigations:
- ✅ Privacy levels enforced in exports
- ✅ Anonymization tools (hash IDs, fuzz location)
- ✅ PII removal (emails, phones)
- ✅ Shareable dataset generator (excludes private)
⚠️ User education (documentation, warnings)
Risk: MEDIUM
Threat: WASM code escapes sandbox, accesses host system Attack Vector:
- WASM exploit (CVE in Deno's V8 engine)
- Unsafe Rust code in WASM module
Mitigations:
- ✅ Deno WASM sandbox (linear memory isolation)
- ✅ Zero
unsafeblocks in Rust code - ✅
cargo clippyenforces safety - ✅ Deno auto-updates (security patches)
⚠️ Regular dependency updates
Risk: VERY LOW
Threat: Malicious input causes CLI crash or hang Attack Vector:
- Extremely large JSON files
- Infinite loops in mapper logic
- Memory exhaustion
Mitigations:
- ✅ File size limits (implicit via memory)
- ✅ Async I/O (non-blocking)
- ✅ WASM memory limits
⚠️ Explicit resource quotas (not implemented)
Risk: LOW
User Input → Deno CLI → WASM Validator → JSON File
↓ ↓ ↓ ↓
[PII?] [Sanitize] [Validate] [Encrypt?]
Threats:
- PII in description field → Mitigated by user control + anonymization tools
- Path traversal in filename → Mitigated by path validation
JSON Files → Mapper → Privacy Filter → Export (CSV/GeoJSON/DOT)
↓ ↓ ↓ ↓
[Private?] [Analyze] [Exclude] [Share]
Threats:
- Private data in export → Mitigated by privacy level enforcement
- Location precision → Mitigated by coordinate fuzzing
- ✅ Deno explicit permissions (
--allow-read,--allow-write) - ✅ WASM sandboxing (linear memory isolation)
- ✅ Input validation (Zod + WASM validators)
- ✅ Zero npm dependencies (supply chain risk reduction)
- ✅ Offline-first (no network calls)
- ✅ Security audit script (
security/audit.sh) - ✅
cargo audit(Rust dependency CVEs) - ✅ Trivy filesystem scanner
- ✅ GitLab CI security checks
- ✅ Test suite (including security tests)
- ✅ CVE disclosure process (
.well-known/security.txt) - ✅ Coordinated disclosure (90-day window)
⚠️ Incident response plan (not documented - future)
Sensitive Data:
- Learner names, emails, phone numbers
- Precise GPS coordinates (< 100m)
- Demographic information
Mitigations:
- ✅ Minimal data collection (WHO/WHERE/WHAT only)
- ✅ Privacy by default (no demographic fields in schema)
- ✅ Location fuzzing (round to ~1km)
- ✅ Learner ID hashing (SHA-256)
- ✅ PII removal tools (regex-based)
Threat: Anonymized data re-identified via correlation Example: Unique location + timestamp + domain → identifies individual
Mitigations:
- ✅ k-anonymity consideration (documentation)
⚠️ Automated k-anonymity checks (not implemented - future)
- GDPR (EU): ✅ Data minimization, privacy by design
- CCPA (California): ✅ User data ownership (local storage)
- COPPA (US, children):
⚠️ Age-gated features (not implemented)
- OWASP Top 10: ✅ Mitigations for injection, broken access control
- CWE Top 25: ✅ No common weaknesses (verified via Clippy)
- Encryption at rest (AES-256 for sensitive fields)
- Cryptographic signatures (verify data integrity)
- External security audit (penetration testing)
- Bug bounty program (coordinated vulnerability disclosure)
- Incident response plan (documented procedures)
- Multi-factor authentication (if adding sync features)
- End-to-end encryption (for shared datasets)
- Audit logging (immutable append-only log)
Review Cadence: Quarterly or on major releases
Owner: Maintainers (see MAINTAINERS.md)
Process:
- Identify new features/changes
- Enumerate new threats
- Assess risk (likelihood × impact)
- Implement mitigations
- Update this document
Found a vulnerability? See .well-known/security.txt
- Contact: security@ubicity.example.org
- PGP Key: [Future: public key]
- Disclosure Policy: 90-day coordinated disclosure
- Bounty: No cash bounty (community project)
Document Classification: Public Version History:
- v1.0 (2025-11-22): Initial threat model for Platinum RSR tier