This is a proof-of-concept voting system built to demonstrate an idea and share it with the community.
Important Context:
- Built by a non-developer as a learning project ("vibe coding")
- Demonstrates architecture concepts, not production-ready code
- Has not undergone professional security audits
- Should not be used in real elections without complete rewrite by professionals
Current Status: Functional demo sharing an idea with the security community.
Goal: Share this concept so others can learn from it, improve it, or use it as inspiration. If this can serve as a foundation for something better, that's the objective.
- Reporting Vulnerabilities
- Security Architecture
- Threat Model
- Known Limitations
- Security Assumptions
- Out of Scope
- Roadmap to Production
We welcome security researchers to review this system and report vulnerabilities.
For non-critical issues:
- Open a GitHub Issue with label
security - Email: [your-email-here] with subject "SECURITY: [brief description]"
For critical vulnerabilities:
- Email: [your-email-here] with subject "CRITICAL SECURITY"
- Include:
- Detailed description of the vulnerability
- Steps to reproduce
- Potential impact
- Proof of concept (if available)
- Your recommended remediation
Response Timeline:
- Best effort response - this is a learning project by a non-developer
- Issues will be documented but fixes may take time or require community help
- Community contributions for security fixes are strongly encouraged
Disclosure Policy:
- This is a public learning project - all issues are welcome to be disclosed publicly
- Credit will be given to security researchers (unless anonymity requested)
- Feel free to fork and fix - no need to wait for me!
Contributors who responsibly disclose security issues will be listed here:
- Be the first!
-
Zero PII Storage
- No personally identifiable information stored
- Voter identity not linkable to vote choice
- Only cryptographic hashes stored
-
Hash-Based Authentication
- SHA-256 hashing:
hash = SHA-256(NAS|CODE|LAW_ID) - Offline hash generation (air-gapped security model)
- Pre-computed hash database prevents vote fabrication
- SHA-256 hashing:
-
Duplicate Detection
- Redis SET tracking voted hashes
- Duplicate attempt counter per hash
- Audit trail of all duplicate attempts
-
Complete Audit Trail
- PostgreSQL
vote_audittable (immutable) - Every vote logged with timestamp
- Full traceability without compromising anonymity
- PostgreSQL
-
Separation of Concerns
- Stateless validation workers (horizontal scaling)
- Message queue buffering (RabbitMQ)
- No single point of failure
┌─────────────┐
│ Voter │
│ (NAS+CODE) │
└──────┬──────┘
│ HTTPS (production)
▼
┌─────────────────┐
│ Ingestion API │ ← Rate limiting
│ (FastAPI) │ ← Input validation
└──────┬──────────┘
│ Internal network
▼
┌─────────────────┐
│ RabbitMQ │ ← Message queue isolation
└──────┬──────────┘
│
▼
┌─────────────────┐
│ Validation │ ← Hash verification (Redis)
│ Workers │ ← Duplicate check (Redis)
└──────┬──────────┘
│
├──→ PostgreSQL (audit log)
└──→ RabbitMQ (aggregation queue)
Hashing:
- Algorithm: SHA-256
- Purpose: Voter authentication without PII
- Implementation: Python
hashlib
TLS/SSL (Production):
- Currently: Not implemented in demo
- Production requirement: TLS 1.3
- Certificate management: Let's Encrypt (recommended)
-
External Attackers
- Motivation: Disrupt election, manipulate results
- Capabilities: Network access, DDoS, injection attacks
- Likelihood: High during actual elections
-
Malicious Insiders
- Motivation: Manipulate votes, leak voter data
- Capabilities: Database access, system knowledge
- Likelihood: Low (requires multi-party validation)
-
State-Level Adversaries
- Motivation: Election interference
- Capabilities: Advanced persistent threats, zero-days
- Likelihood: Medium for national elections
-
Opportunistic Script Kiddies
- Motivation: Chaos, reputation
- Capabilities: Automated tools, known exploits
- Likelihood: High if publicly accessible
Attack: Submit fake votes with fabricated hashes
- Mitigation: Offline hash generation, pre-validated hash database in Redis
- Status: ✅ Implemented
- Residual Risk: Hash generation process must be secured
Attack: Replay valid votes (duplicate submission)
- Mitigation: Redis
voted_hashesSET, duplicate detection - Status: ✅ Implemented
- Residual Risk: Redis compromise could disable deduplication
Attack: Modify vote in transit
- Mitigation: TLS encryption (production), message integrity checks
- Status:
⚠️ TLS not implemented in demo - Residual Risk: High without TLS
Attack: Overwhelm API with requests
- Mitigation: Rate limiting, RabbitMQ queue buffering, CDN (production)
- Status:
⚠️ Basic rate limiting, no DDoS protection - Residual Risk: High - needs WAF and DDoS mitigation
Attack: Exhaust database connections
- Mitigation: Connection pooling, worker scaling limits
- Status:
⚠️ Connection pooling implemented, no hard limits - Residual Risk: Medium - needs connection limits
Attack: Fill RabbitMQ queue (queue flooding)
- Mitigation: Queue size limits, message TTL, dead letter queues
- Status: ❌ Not implemented
- Residual Risk: High - unlimited queue growth possible
Attack: Steal hash database from Redis
- Mitigation: Network isolation, Redis authentication, encryption at rest
- Status:
⚠️ No Redis authentication in demo - Residual Risk: High - Redis exposed without auth
Attack: Access PostgreSQL vote audit logs
- Mitigation: Database authentication, encrypted connections, audit logging
- Status:
⚠️ Basic auth, no encrypted connections - Residual Risk: Medium - needs TLS for DB connections
Attack: Link voter identity to vote choice
- Mitigation: Zero PII storage, hash-based system prevents linkage
- Status: ✅ Implemented
- Residual Risk: Low - correlation attacks still possible with metadata
Attack: SQL injection
- Mitigation: Parameterized queries, ORM usage (SQLAlchemy)
- Status: ✅ Implemented
- Residual Risk: Low - needs regular audits
Attack: NoSQL injection (Redis commands)
- Mitigation: Input validation, Redis command whitelisting
- Status:
⚠️ Basic validation - Residual Risk: Medium - needs stricter validation
Attack: Code injection via message payloads
- Mitigation: JSON schema validation, message sanitization
- Status:
⚠️ Basic validation - Residual Risk: Medium - needs comprehensive input validation
Attack: Compromise Docker containers
- Mitigation: Minimal base images, no root users, security scanning
- Status:
⚠️ Standard images, needs hardening - Residual Risk: High - container security not prioritized
Attack: Exploit dependencies
- Mitigation: Dependency scanning, automated updates, minimal dependencies
- Status: ❌ No automated scanning
- Residual Risk: High - needs Dependabot/Snyk
Attack: Kubernetes cluster compromise (production)
- Mitigation: RBAC, network policies, pod security policies
- Status: ❌ Not implemented (demo is Docker Compose)
- Residual Risk: N/A for demo, critical for production
Attack: Malware on voter device
- Mitigation: None (outside system scope)
- Status: ❌ No endpoint security
- Residual Risk: High - voter devices assumed trusted
Attack: Man-in-the-Middle (MITM)
- Mitigation: TLS, certificate pinning (mobile apps)
- Status: ❌ TLS not implemented in demo
- Residual Risk: Critical - all traffic potentially interceptable
-
No TLS/SSL in Demo
- All traffic unencrypted
- Credentials/votes visible to network observers
- Impact: Critical vulnerability
- Remediation: Implement TLS 1.3 before any real deployment
-
No Redis Authentication
- Redis accessible without password
- Hash database exposed
- Impact: Critical vulnerability
- Remediation: Redis AUTH, network isolation
-
No DDoS Protection
- Basic rate limiting insufficient
- No WAF, no CDN
- Impact: System can be overwhelmed
- Remediation: Cloudflare/AWS Shield, rate limiting per IP/subnet
-
Hash Generation Process Not Secured
- Hash generation script has no security controls
- No verification of hash uniqueness
- Impact: Potential for duplicate or invalid hashes
- Remediation: Hardware Security Module (HSM) for production
-
No Intrusion Detection
- No monitoring for suspicious activity
- No alerting on anomalies
- Impact: Attacks may go undetected
- Remediation: IDS/IPS, SIEM integration
-
Limited Input Validation
- Basic format checks only
- No comprehensive sanitization
- Remediation: JSON Schema validation, input sanitization library
-
No Encrypted Connections to Databases
- PostgreSQL connections unencrypted
- Remediation: SSL/TLS for all DB connections
-
No Container Security Scanning
- No vulnerability scanning of Docker images
- Remediation: Trivy, Snyk, Clair integration
-
No Automated Dependency Scanning
- Vulnerable dependencies may exist
- Remediation: Dependabot, Snyk, safety checks
-
No Security Audit Logs
- System events not logged comprehensively
- Remediation: Centralized logging (ELK stack), audit trail
-
Trust Assumptions
- Assumes voter devices are secure
- Assumes hash generation process is trusted
- Assumes network infrastructure is benign (in demo)
-
Scalability vs Security Trade-offs
- Stateless workers = easier scaling, harder to detect coordinated attacks
- Message queue buffering = resilience, but potential message loss
-
Anonymity vs Auditability
- Cannot trace vote to voter (by design)
- Makes forensic investigation difficult
- Trade-off: privacy vs accountability
This system operates under the following assumptions:
-
Network Security
- Production: Private network or VPN for inter-service communication
- Demo: Assumes localhost/trusted network
-
Physical Security
- Servers are physically secure
- No unauthorized physical access to infrastructure
-
Operator Trust
- System administrators are trusted
- No insider threat from operators (mitigated by multi-party controls in production)
-
Offline Hash Generation
- Hashes generated in secure, air-gapped environment
- Hash generation process follows strict protocol
- No hash leakage before distribution
-
Hash Distribution
- Voters receive NAS+CODE via secure channel (postal mail, secure portal)
- Distribution process prevents interception
-
Voter Device Security
- Voter devices free from malware
- Voters use trusted browsers/applications
- No keyloggers or screen recorders on voter devices
-
Voter Behavior
- Voters keep credentials confidential
- Voters do not share NAS+CODE combinations
- Voters verify they're on correct voting website (phishing awareness)
-
Hash Algorithm Security
- SHA-256 remains cryptographically secure
- No practical collision or preimage attacks
-
Randomness
- Hash generation uses cryptographically secure random number generators
- No predictable patterns in NAS or CODE generation
The following are explicitly outside the scope of this system's security model:
-
Voter Coercion
- System cannot prevent coercion or vote selling
- Voters could be forced to vote in presence of coercer
- Mitigation: Requires legal and social measures, not technical
-
Device Compromise
- Voter device security is voter's responsibility
- System assumes endpoint security
-
Phishing Attacks
- Voters may be phished to fake voting sites
- Mitigation: User education, domain verification
-
Social Engineering
- Attackers may trick voters into revealing credentials
- Mitigation: User awareness training
-
Advanced Persistent Threats (APTs)
- No defenses against state-level zero-day exploits
- Requires ongoing security research and hardening
-
Quantum Computing Attacks
- SHA-256 vulnerable to quantum attacks (theoretical)
- Post-quantum cryptography not implemented
-
Supply Chain Attacks
- No verification of dependency integrity
- Needs software bill of materials (SBOM)
Honest Assessment: As a learning project by a non-developer, this code needs significant work to be production-ready. Below is what security professionals would need to implement:
If someone wants to fork this and make it production-ready:
-
TLS/SSL Implementation
- TLS 1.3 for all external connections
- Certificate management automation
- HSTS headers
-
Redis Security
- AUTH password
- Network isolation (internal network only)
- Encrypted connections (TLS)
-
Database Security
- SSL/TLS for PostgreSQL connections
- Strong authentication
- Connection encryption
-
DDoS Protection
- WAF implementation (Cloudflare, AWS WAF)
- Rate limiting per IP/subnet
- CDN for static assets
-
Input Validation
- JSON Schema validation
- Comprehensive sanitization
- Security audit of all endpoints
- Professional Security Audit - Essential before any real use
- Penetration Testing - By qualified security professionals
- Code Review - By experienced developers
- Compliance Assessment - Electoral standards, data protection laws
- Complete Rewrite - Likely needed for production deployment
This is a learning project. If you're a security professional or experienced developer and see potential:
- Fork it and improve it
- Rewrite parts that need it
- Use it as inspiration for a better system
- Share improvements back with the community
I'm still learning and may not be able to implement complex security fixes quickly, but I'll do my best to:
- Document issues
- Review pull requests
- Share knowledge gained
- Support community efforts
The goal is to advance the idea, not to be the sole maintainer.
- Basic functional testing
- Load testing (8M votes capacity)
- Security testing (pending)
Before Production:
-
Penetration Testing
- External penetration test
- Internal penetration test
- Social engineering assessment
-
Vulnerability Assessment
- Automated vulnerability scanning
- Manual code review
- Dependency audit
-
Security Chaos Engineering
- Simulated attacks (red team)
- Failure injection
- Recovery testing
-
Compliance Testing
- Electoral standards verification
- Data protection audit
- Accessibility audit
Project Creator: David Marleau (learning developer, not security expert)
Honest Disclosure:
- I'm still learning and may not be able to fix complex security issues quickly
- Community contributions and forks are highly encouraged
- If you're a security professional, please help improve this or build something better
Response Approach:
- Will respond to issues as able
- May need community help for complex fixes
- Contributions and pull requests very welcome
- Feel free to fork and improve without waiting
This security policy was inspired by:
This SECURITY.md document is licensed under CC BY 4.0.
Last Updated: November 2024 Version: 1.0 Status: Draft - Seeking Community Review