fix: harden security — PBKDF2 iterations, JWT validation, health endpoint, A2A auth, notification limit - #182
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Conversation
…oint, A2A auth, notification limit - Increase PBKDF2-SHA256 iterations from 10,000 to 600,000 (OWASP recommendation) with backward-compatible password verification for existing hashes - Reject empty/placeholder JWT_SECRET_KEY values at runtime - Remove internal component details from public /health endpoint - Add @login_required to A2A message-sending and conversation endpoints - Cap notification list limit to 100 to prevent large query DoS - Replace bare except: clauses with except Exception: - Add TODO for encrypting OAuth tokens at rest Co-Authored-By: Haohao <2227625024@qq.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Security hardening across six files, addressing findings from a codebase security audit:
password.py): Increased from 10,000 → 600,000 (OWASP minimum for SHA-256).compare_passwordtries the new count first, then falls back to legacy 10,000 so existing password hashes continue to work.jwt_service.py): New_get_secret_key()rejects empty or known-placeholder values (e.g."your-random-secret-key-here-change-this") with an error log + 401 response instead of silently signing/verifying withNone.app_handler.py): Public/healthresponse no longer exposes internalcomponents(database/Redis/Weaviate/Celery status) ormetrics. Onlystatusandserviceare returned. Component probes still run internally for alerting.public_app_handler.py): Added@login_requiredtosend_public_app_a2a_message,get_public_app_a2a_conversation_messages, andget_latest_public_app_a2a_conversation. The read-only agent card endpoint remains public.notification_handler.py):limitquery param clamped to max 100 to prevent unbounded DB reads.except:→except Exception:in three places inpublic_app_handler.py.oauth_service.pyflagging thatencrypted_tokenis stored in plaintext.Review & Testing Checklist for Human
@login_requiredis the intended auth mechanism for these endpoints — if A2A clients don't carry a user session token, this will break them. Consider whether API-key auth via theopenapiblueprint would be more appropriate.componentsormetricsfrom/healthwill stop receiving those fields. Confirm no monitoring depends on them, or plan a migration._INSECURE_PLACEHOLDER_KEYScovers all placeholder values actually used across deployment environments (e.g. Docker Compose defaults, CI fixtures).pytest) — tests could not be fully executed locally due to deep dependency chain; CI results should be verified.Notes
get_public_app_a2a_cardendpoint was intentionally left without@login_requiredsince agent cards are typically public metadata in the A2A protocol.Link to Devin session: https://app.devin.ai/sessions/66b5b2fccab74dbf862f5c4e1321fe35
Requested by: @Haohao-end