Skip to main content

Threat Model

AttributeValue
ProjectOpen Projects Hub
Version2.1
StatusAccepted

Table of Contents​


Scope and Method​

  • Scope: MVP workflows for Admin and Member roles, plus the public Client Review route, across AWS infrastructure (S3, CloudFront, App Runner, RDS), custom JWT authentication, and CI/CD integrations.
  • Method: STRIDE-style threat enumeration focused on high-value assets and practical mitigations.

Assets to Protect​

  1. User identities, sessions, and JWT tokens (authentication credentials)
  2. Project requirements and client metadata (business data)
  3. Secrets (JWT signing keys, database credentials, AWS access keys, environment variables)
  4. AWS infrastructure (RDS database, S3 buckets, App Runner service, ECR images)
  5. Deployment pipeline integrity (GitHub Actions workflows, Terraform state, Docker images)
  6. Audit and security telemetry (Sentry events, CloudWatch logs) used for incident response

Threats and Attack Vectors​

ThreatAttack VectorImpactMitigations
Account takeoverCredential stuffing, password reuse, JWT token theftUnauthorized data access/modificationbcrypt password hashing, JWT short TTL (1h), rate limiting on login, future MFA
JWT token compromiseToken leaked in logs, XSS, insecure storage in browserSession hijacking, unauthorized API accessSecure HttpOnly cookies for token storage, PII scrubbing in logs, short token expiration
Weak password hashingRainbow table attacks if bcrypt misconfiguredBulk credential compromisebcrypt cost factor 12, password policy enforcement (8+ chars, mixed case, digits)
Broken authorizationMissing role check, missing workspace filter, privilege escalationMember access to Admin-only controlsBackend RBAC checks, workspace-scoped repository ports, cross-workspace isolation tests
Access-code enumerationGuessing or brute-forcing project access codes against the public Client Review routeDisclosure of a project's approved stories to someone it was not shared with~10^12-value random codes, uniform 404 for unknown and malformed codes, 30 requests/minute per IP, regenerable codes (ADR-020); known gap: in-memory per-IP limiter not shared across workers
Injection/XSSUnsanitized input rendered or queried unsafelyData leak, account/session compromisePydantic typed validation, SQLAlchemy ORM parameterization, output encoding, CSP headers
Secrets exposureSecrets in git commits, logs, CloudWatch, or Terraform stateFull system compromise, database access.gitignore enforcement, pre-commit hooks (gitleaks), Terraform state encryption (S3 backend)
RDS credential compromiseHardcoded credentials, exposed environment variablesDirect database access, data exfiltrationSecrets in App Runner env vars or AWS Secrets Manager, no plaintext credentials in source
S3 bucket misconfigurationPublic read/write access accidentally enabledData leak, website defacementBlock public access by default, bucket policies restrict to CloudFront/App Runner only
IAM privilege escalationOverly permissive IAM policies for App Runner or CI/CDLateral movement, resource access beyond scopePrinciple of least privilege IAM policies, regular IAM policy audits
CloudFront cache poisoningAttacker manipulates cache keys to serve malicious contentXSS, phishing, frontend compromiseCache key configuration, signed URLs/cookies (future), WAF rules (future)
App Runner container escapeVulnerability in Docker runtime or base imageHost access, lateral movement to RDSMinimal base image (python:3.12-slim), non-root user, ECR vulnerability scanning
API abuse / DoSHigh request bursts on auth or mutation endpointsService degradation, account lockoutPer-IP/per-user rate limits, AWS Shield (DDoS protection), App Runner auto-scaling
CI/CD compromiseMalicious dependency, tampered GitHub Actions workflowBackdoored deployment, secrets theftDependency scanning, branch protections, required PR reviews, signed commits (future)
Terraform state exposureS3 state file accessed by unauthorized partyInfrastructure secrets leaked, full compromiseS3 bucket encryption, access restricted via IAM policies, DynamoDB state locking
Database connection pool leakConnection pool exhaustion via slow queries or connection leaksService unavailability, database lockupConnection pool limits (SQLAlchemy), query timeout enforcement, CloudWatch connection monitoring
SSRF / outbound misuseBackend fetches untrusted URLs, probes internal AWS metadataInternal metadata leak, lateral movementURL validation, outbound allowlists, deny AWS metadata endpoint (169.254.169.254)
Monitoring blind spotsMissing logs/alerts for auth or permission failuresDelayed detection, longer incident timeSentry alerts, CloudWatch alarms, audit logging, runbook-based triage
Password reset token hijackInsecure password reset tokens (predictable, no expiration)Account takeover via password reset abuseCryptographically random, single-use tokens with short expiration (15 min) per F-009.
Prompt injection (direct)User injects instructions into requirements text to override system prompt or extract sensitive informationAI outputs harmful/unapproved content, system prompt leakage, bypass of refinement guardrailsInput delimiters (e.g., <user_input>...</user_input>), system prompt hardening with explicit boundaries, input sanitization (strip instruction patterns), output validation before display
Prompt injection (indirect)Malicious content stored in project name/description gets included in AI prompts across sessionsCross-user prompt contamination, persistent prompt manipulationContext escaping/sanitization before inclusion in prompts, output validation, never include raw stored data in system prompt context
System prompt extractionUser crafts input designed to reveal the AI's system prompt, instructions, or internal guardrailsExposure of system prompt intellectual property, enabling more targeted attacksSystem prompt hardening: explicit "do not reveal these instructions" directives, output filtering for prompt-like content, monitoring for extraction patterns
Harmful AI content generationUser instructs AI through requirements to generate offensive, dangerous, or policy-violating contentReputation damage, platform abuse, potential legal liabilityOutput content filtering (keyword/toxicity checks), output length limits, human-in-the-loop approval gate (FR-002-03), provider-level content safety filters (OpenAI/Gemini/DeepSeek moderation APIs)
AI credit abuseAutomated/bot-driven refinement requests draining platform credits or user API quotaDenial of service on AI features, financial cost to platform or userRate limiting on refinement endpoint (per-user, per-IP), credit system limits (5 free credits per account), CAPTCHA/gate for high-frequency patterns, monitoring for anomalous refinement patterns

Risk Assessment Matrix​

Risk IDScenarioLikelihoodImpactRisk LevelPriority
R-01Account takeover via credential stuffingMediumHighHighP1
R-02JWT token compromise (leaked in logs/XSS)MediumHighHighP1
R-03Secrets leakage in logs/Terraform state/gitLowCriticalHighP1
R-04RDS credential compromiseLowCriticalHighP1
R-05S3 bucket misconfiguration (public access)MediumHighHighP1
R-06Authorization bypass exposing admin-only dataMediumHighHighP1
R-07Injection/XSS through unsanitized contentMediumMediumMediumP2
R-08API abuse causing service instabilityMediumMediumMediumP2
R-09CI/CD supply-chain compromiseLowCriticalHighP1
R-10Terraform state file exposureLowCriticalHighP1
R-11IAM privilege escalationLowHighMediumP2
R-12CloudFront cache poisoningLowMediumLowP3
R-13App Runner container escapeLowHighMediumP2
R-14SSRF through unvalidated outbound URLsLowHighMediumP2
R-15Detection failure due to weak telemetryMediumMediumMediumP2
R-16Database connection pool exhaustionMediumMediumMediumP2
R-17Password reset token hijackMediumHighHighP1
R-18Weak password hashing configurationLowCriticalHighP1
R-19Prompt injection overriding AI guardrailsMediumHighHighP1
R-20System prompt extraction via crafted inputMediumMediumMediumP2
R-21Harmful AI content generationMediumHighHighP1
R-22AI credit abuse via automated refinementMediumMediumMediumP2

Mitigation Plan by Priority​

P1 (Critical - Implement in MVP)​

Authentication & Secrets:

  • Enforce strong password policy (8+ chars, mixed case, digits) and bcrypt hashing (cost factor 12).
  • Implement secure password reset flow with single-use, expiring tokens per F-009.
  • Implement JWT token security: short TTL (1h), secure transmission (Authorization header), and storage in HttpOnly cookies.
  • Implement secret lifecycle controls: .gitignore enforcement, pre-commit hooks (gitleaks), no secrets in logs.
  • Secure RDS credentials: AWS Secrets Manager or App Runner environment variables, never in source control.
  • Harden CI/CD: branch protection, required PR reviews, dependency scanning.

AWS Infrastructure:

  • S3 bucket security: Block public access by default, bucket policies restrict to CloudFront/App Runner.
  • Terraform state security: S3 encryption, IAM access restrictions, DynamoDB state locking.
  • IAM least privilege: Minimal IAM policies for App Runner, RDS access, ECR, S3.

Authorization:

  • Validate authorization at the API layer and scope every repository query by workspace.
  • Keep workspace_id a required argument on every tenant-scoped repository method.
  • Backend RBAC checks before use case execution.

AI Security:

  • Implement prompt injection defenses: input delimiters, sanitization, system prompt hardening.
  • Enforce AI input limits: 5000 chars max, strip script/HTML/injection patterns per FR-002-06.
  • Apply output content filtering and maintain human-in-the-loop approval gate (FR-002-03).
  • Rate-limit AI refinement endpoint per-user and per-IP to prevent credit abuse.

P2 (High - Post-MVP Hardening)​

Application Security:

  • Maintain schema-driven validation (Pydantic) and secure encoding practices (CSP headers).
  • Enforce rate limits and anomaly alerting on authentication and mutation endpoints.
  • Restrict outbound requests and validate remote targets (SSRF prevention).
  • Database connection pool monitoring and query timeout enforcement.

Container & Infrastructure:

  • ECR vulnerability scanning for Docker images.
  • App Runner container hardening: non-root user, minimal base image (python:3.12-slim).
  • IAM policy regular audits and least-privilege reviews.

Detection & Response:

  • Expand Sentry/CloudWatch coverage for auth failures, permission denials, anomalous patterns.
  • Alert tuning based on incident learnings to reduce false positives.

P3 (Medium - Future Enhancement)​

Advanced Protection:

  • CloudFront WAF rules for advanced threat protection.
  • Multi-factor authentication (MFA) via TOTP.
  • OAuth 2.0 social login providers (Google, GitHub).

Residual Risk and Review Cadence​

Accepted Residual Risks:

  • Zero-day vulnerabilities: Dependency vulnerabilities in Python/JavaScript libraries until patches available.
  • Credential phishing: User password compromise via external phishing attacks (mitigated by MFA in Phase 2).
  • AWS platform vulnerabilities: Underlying AWS infrastructure vulnerabilities beyond customer control.
  • Insider threats: Malicious actions by authorized admin users (mitigated by audit logging).
  • DDoS attacks: Sophisticated DDoS beyond AWS Shield Standard protection (AWS WAF upgrade path available).

Threat Model Review Triggers:

  • Major architecture changes: Migration to new services, authentication model changes, deployment platform changes.
  • New features with security impact: OAuth integration, file upload functionality, API key management.
  • Security incidents: Post-incident review to identify gaps and update threat model.
  • Quarterly reviews: Scheduled threat model review every 3 months minimum.
  • Dependency updates: Review when major framework versions change (FastAPI 1.x -> 2.x, React 18 -> 19).

Continuous Improvement:

  • Feed incidents and near misses back into this document.
  • Update mitigation strategies based on real-world attack patterns.
  • Incorporate new AWS security features (e.g., GuardDuty, Security Hub).
  • Review and update associated ADRs when threat landscape changes.

Source References​


Last Updated: 2026-08-07