-
Notifications
You must be signed in to change notification settings - Fork 0
Security Audit Remediation Report (2026-02-14) #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
da8542a
docs: add security audit
Scetrov 9cd8e56
SEC-04: Remove INTERNAL_SECRET default value
Scetrov 11d1ac9
SEC-01: Add OAuth2 state parameter for CSRF protection
Scetrov c698cb3
SEC-03: Externalize Murmur ICE secrets and remove weak defaults
Scetrov a7ee560
SEC-02: Remove JWT from URL redirect
Scetrov cd39eed
SEC-06: Run containers as non-root user
Scetrov c692a82
SEC-07: Sanitize database error responses
Scetrov 25ec865
SEC-09: Add Content-Security-Policy and security headers
Scetrov 9c67121
SEC-08: Add TTL validation to wallet nonces
Scetrov fd0b9d7
SEC-10: Add input length validation
Scetrov 7d85b86
SEC-11: Configure Dependabot for automated dependency and action updates
Scetrov 4805787
SEC-12: Remove is_super_admin from JWT claims and re-validate in get_me
Scetrov 34a4e3c
SEC-05: Add rate limiting to authentication endpoints
Scetrov cb69a3c
fix: Remove empty environment stanzas from docker-compose.yml
Scetrov 44c8687
docs: Add Docker Compose deployment guide
Scetrov c6d08e3
fix: Point docker-compose to workspace root .env file
Scetrov 3e3269f
fix: Gracefully handle missing git in frontend vite.config
Scetrov ae8ed8b
fix: Use SmartIpKeyExtractor for rate limiting in Docker
Scetrov 0d947b0
docs: Add comprehensive security audit remediation report
Scetrov 9597282
docs: Update environment variable documentation for security audit re…
Scetrov 2ae3a5c
fix: tidy up remediation doc
Scetrov 9a94aed
fix: Murmur authenticator ICE secret and rate limiter Docker compatib…
Scetrov a346d05
fix: Increase auth code TTL and use API_URL config in callback
Scetrov 4e86184
feat: Add /ping endpoint to replace /docs for health checks
Scetrov cc9da50
docs: fix inconsistencies in security documentation
Scetrov cad3533
fix(backend): prevent unbounded memory growth in auth token storage
Scetrov d40cbcd
fix(murmur): make ICE secret configuration idempotent
Scetrov ab7f522
fix(e2e): update test fixtures for authorization code exchange flow
Scetrov 50533f6
fix: Address PR #20 review comments - CSP and grammar consistency
Scetrov 47bc4e4
fix: tidy up env
Scetrov 997abfe
fix: finish clean up
Scetrov 36d31c8
fix: prevent React Strict Mode double auth exchange & sed delimiter i…
Scetrov 15c4aa0
fix: address PR #20 review comments
Scetrov 165737d
docs: formatting
Scetrov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,44 @@ | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "cargo" | ||
| directory: "/src/rust" | ||
| # GitHub Actions - automatically update and SHA-pin per SEC-11 | ||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" | ||
| day: "monday" | ||
| open-pull-requests-limit: 10 | ||
| commit-message: | ||
| prefix: "ci" | ||
| include: "scope" | ||
| labels: | ||
| - "dependencies" | ||
| - "github-actions" | ||
| - "security" | ||
|
|
||
| - package-ecosystem: "npm" | ||
| directory: "/src/sui" | ||
| # Backend Rust dependencies | ||
| - package-ecosystem: "cargo" | ||
| directory: "/src/backend" | ||
| schedule: | ||
| interval: "weekly" | ||
| day: "monday" | ||
| open-pull-requests-limit: 10 | ||
| commit-message: | ||
| prefix: "deps(backend)" | ||
| include: "scope" | ||
| labels: | ||
| - "dependencies" | ||
| - "rust" | ||
|
|
||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| # Frontend npm dependencies (Bun) | ||
| - package-ecosystem: "npm" | ||
| directory: "/src/frontend" | ||
| schedule: | ||
| interval: "weekly" | ||
| day: "monday" | ||
| open-pull-requests-limit: 10 | ||
| commit-message: | ||
| prefix: "deps(frontend)" | ||
| include: "scope" | ||
| labels: | ||
| - "dependencies" | ||
| - "javascript" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| --- | ||
| description: Security Audit Prompt: VoID Electronic Identity (eID) | ||
| --- | ||
|
|
||
| **Role:** You are a Senior Security Researcher and DevSecOps Engineer specializing in Rust (Axum/SQLx), React, and Docker security. | ||
|
|
||
| **Objective:** Conduct a deep-dive security audit of the VoID eID project. Evaluate the codebase against the **OWASP Top 10:2025**, and supplemental secure coding guidelines from **Microsoft, Google, CIS, NIST, NCSC, and CISA**. | ||
|
|
||
| **Scope of Analysis:** | ||
|
|
||
| 1. **Backend (Rust):** Authentication logic, JWT handling, SQLx queries, CORS configuration, and internal API secrets. | ||
| 2. **Frontend (React/Vite):** Environment variable usage, routing guards, and wallet connection security. | ||
| 3. **Infrastructure:** `docker-compose.yml`, GitHub Actions CI/CD workflows, and Murmur/Mumble authenticator scripts. | ||
|
|
||
| **Instructions:** | ||
|
|
||
| 1. Identify specific violations with **file paths** and **line numbers**. | ||
| 2. Provide a description of the vulnerability and its potential impact. | ||
| 3. Map each finding to the **MITRE ATT&CK Framework**. | ||
| 4. Provide actionable **remediation guidance** for developers. | ||
| 5. Summarize findings in the **Standardized Security Audit Report** format provided below. | ||
|
|
||
| --- | ||
|
|
||
| ### Audit Criteria & High-Priority Checks | ||
|
|
||
| - **OWASP A01:2025 – Broken Access Control:** Check `src/backend/src/auth.rs` and `roster.rs`. Ensure `AuthenticatedUser` extractor properly validates sessions and that admin-only routes (like `grant_admin`) verify the `is_admin` flag in the database, not just the token. | ||
| - **OWASP A02:2025 – Cryptographic Failures:** Evaluate the JWT implementation in `auth.rs`. Check for hardcoded secrets, weak signing algorithms, or lack of expiration validation. Inspect Sui wallet signature verification in `wallet.rs`. | ||
| - **OWASP A03:2025 – Injection:** Verify that all SQLx queries use parameterized inputs and not string interpolation (check `01_init.sql` through `04_unique_wallets_address.sql` and `db.rs`). | ||
| - **OWASP A05:2025 – Security Misconfiguration:** Review `docker-compose.yml` for insecure defaults (e.g., SQLite file permissions, exposed ports). Check `main.rs` for overly permissive CORS policies. | ||
| - **OWASP A07:2025 – Identification and Authentication Failures:** Analyze the Discord OAuth2 flow in `auth.rs`. Check for "State" parameter usage to prevent CSRF in OAuth. | ||
| - **Supply Chain Security:** Review `.github/workflows/ci.yml` for insecure action versions or lack of integrity checks. | ||
|
|
||
| --- | ||
|
|
||
| ### Standardized Security Audit Report Format | ||
|
|
||
| #### 1. Executive Summary | ||
|
|
||
| - Overall Risk Rating (Critical/High/Medium/Low) | ||
| - Summary of top 3 critical risks. | ||
|
|
||
| #### 2. Detailed Findings | ||
|
|
||
| | ID | Vulnerability Name | Severity | Location (File:Line) | OWASP 2025 Mapping | MITRE ATT&CK ID | | ||
| | ------ | --------------------- | -------- | -------------------------- | ------------------ | --------------- | | ||
| | SEC-01 | [e.g., SQL Injection] | Critical | `src/backend/src/db.rs:45` | A03:2025 | T1190 | | ||
|
|
||
| **Description:** [Detailed explanation of the vulnerability] | ||
| **Impact:** [What an attacker can achieve] | ||
| **Guidance/Fix:** [Code snippet or configuration change to resolve the issue] | ||
|
|
||
| #### 3. Infrastructure & CI/CD Review | ||
|
|
||
| - **Docker Security:** Analysis of `Dockerfile` and `docker-compose.yml`. | ||
| - **CI/CD Pipeline:** Analysis of `ci.yml` (e.g., secrets handling, binary signing). | ||
|
|
||
| #### 4. Compliance Check | ||
|
|
||
| - Adherence to **NIST SP 800-53** (Access Control) or **CIS Benchmarks** (Docker/Linux). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,25 @@ | ||
| { | ||
| "chat.tools.terminal.autoApprove": { | ||
| "bun": true | ||
| } | ||
| }, | ||
| "cSpell.words": [ | ||
| "appuser", | ||
| "backdoors", | ||
| "changeme", | ||
| "chrono", | ||
| "CISA", | ||
| "clickjacking", | ||
| "Dockerfiles", | ||
| "eprintln", | ||
| "HEALTHCHECK", | ||
| "HSTS", | ||
| "icesecretread", | ||
| "icesecretwrite", | ||
| "jlumbroso", | ||
| "nosniff", | ||
| "Referer", | ||
| "sigstore", | ||
| "trixie", | ||
| "urlencoding" | ||
| ] | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| # Void eID Docker Compose Deployment | ||
|
|
||
| ## Quick Start | ||
|
|
||
| This deployment uses the workspace root `.env` file. | ||
|
|
||
| 1. **Ensure `.env` is configured** in the workspace root (two levels up from this directory) | ||
| - The `.env` file should already exist with your configuration | ||
| - If not, copy from `.env.example` in the workspace root | ||
|
|
||
| 2. **Start the services:** | ||
| ```bash | ||
| docker compose up -d | ||
| ``` | ||
|
|
||
| ## Environment Configuration | ||
|
|
||
| This compose file references `../../.env` (the workspace root `.env` file). | ||
|
|
||
| ### Required Discord OAuth Configuration | ||
|
|
||
| Register an application at https://discord.com/developers/applications | ||
|
|
||
| - **`DISCORD_CLIENT_ID`**: Your Discord Application's Client ID | ||
| - Found in: OAuth2 → General → Client ID | ||
|
|
||
| - **`DISCORD_CLIENT_SECRET`**: Your Discord Application's Client Secret | ||
| - Found in: OAuth2 → General → Client Secret | ||
| - Click "Reset Secret" if needed | ||
|
|
||
| - **OAuth2 Redirect URL**: Add this to your Discord app: | ||
| - `http://localhost:5038/api/auth/discord/callback` | ||
| - Found in: OAuth2 → Redirects | ||
|
|
||
| ### Required Admin Configuration | ||
|
|
||
| - **`INITIAL_ADMIN_ID`**: Your Discord User ID | ||
| - Enable Developer Mode in Discord (Settings → Advanced → Developer Mode) | ||
| - Right-click your username → Copy User ID | ||
|
|
||
| ### Required Secrets (Generate Random Values) | ||
|
|
||
| Generate secure random strings for these values using `openssl rand -base64 32`: | ||
|
|
||
| - **`JWT_SECRET`**: Secret for signing JWT tokens | ||
|
|
||
| ```bash | ||
| openssl rand -base64 32 | ||
| ``` | ||
|
|
||
| - **`IDENTITY_HASH_PEPPER`**: Secret pepper for hashing denylisted identifiers | ||
|
|
||
| ```bash | ||
| openssl rand -base64 32 | ||
| ``` | ||
|
|
||
| - **`INTERNAL_SECRET`**: **REQUIRED** - Shared secret for backend-to-Murmur authenticator API calls | ||
|
|
||
| ```bash | ||
| openssl rand -base64 32 | ||
| ``` | ||
|
|
||
| ⚠️ The application will **fail to start** if this is not set. | ||
|
|
||
| - **`ICE_SECRET_READ`**: **REQUIRED for Mumble** - ICE read secret for Murmur server | ||
|
|
||
| ```bash | ||
| openssl rand -base64 32 | ||
| ``` | ||
|
|
||
| - **`ICE_SECRET_WRITE`**: **REQUIRED for Mumble** - ICE write secret for Murmur server | ||
| ```bash | ||
| openssl rand -base64 32 | ||
| ``` | ||
|
|
||
| ### Optional Configuration | ||
|
|
||
| - **`SUPER_ADMIN_DISCORD_IDS`**: Comma-separated Discord IDs for super admins | ||
| - Example: `123456789,987654321` | ||
| - Leave empty if only using `INITIAL_ADMIN_ID` | ||
|
|
||
| - **`SUPER_ADMIN_AUDIT_WEBHOOK`**: Discord webhook URL for super admin audit logs | ||
| - Leave empty to disable | ||
|
|
||
| - **`MUMBLE_REQUIRED_TRIBE`**: Tribe required for Mumble account creation | ||
| - Default: `Fire` | ||
|
|
||
| ## Pre-configured Values (No Changes Needed) | ||
|
|
||
| The following are already set correctly in `.env.example` (repository root): | ||
|
|
||
| - `DISCORD_REDIRECT_URI=http://localhost:5038/api/auth/discord/callback` | ||
| - `FRONTEND_URL=http://localhost:5173` | ||
| - `DATABASE_URL=sqlite:///data/void-eid.db?mode=rwc` | ||
| - `BACKEND_URL=http://backend:5038/api/internal/mumble` | ||
| - `VITE_API_URL=http://localhost:5038` | ||
| - `PORT=5038` | ||
|
|
||
| ## Starting the Services | ||
|
|
||
| ```bash | ||
| docker compose up -d | ||
| ``` | ||
|
|
||
| ## Checking Logs | ||
|
|
||
| ```bash | ||
| # All services | ||
| docker compose logs -f | ||
|
|
||
| # Specific service | ||
| docker compose logs -f backend | ||
| docker compose logs -f frontend | ||
| docker compose logs -f murmur | ||
| ``` | ||
|
|
||
| ## Stopping the Services | ||
|
|
||
| ```bash | ||
| docker compose down | ||
| ``` | ||
|
|
||
| ## Security Notes | ||
|
|
||
| - **Never commit `.env` to version control** (it's in `.gitignore`) | ||
| - Generate unique secrets for each deployment | ||
| - Use strong random values for all secret keys | ||
| - Restrict `SUPER_ADMIN_DISCORD_IDS` to trusted users only | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.