Repository navigation
fix(security): add retry and error handling for PCP upload to prevent biometric data loss - #30
Open
failsafesecurity wants to merge 1 commit into
Open
failsafesecurity wants to merge 1 commit into
failsafesecurity wants to merge 1 commit into
Conversation
… biometric data loss The PCP (Personal Custody Package) upload was fire-and-forget — after a successful signup, the PCP upload ran asynchronously without retry limits, backoff, or failure surfacing. Network errors retried infinitely without backoff (hammering a failing server), and 4xx client errors silently dropped biometric data with no recovery path. Fix: - Add exponential backoff (1s base, 30s max) between retries - Add max retry limit (5 attempts) to prevent infinite retry loops - Surface failures with error logs and metrics on exhaustion - Log retry attempts with backoff duration for observability - 4xx errors still break (non-retryable) but now log operator intervention guidance Severity: Medium Finding ID: cmsdegzmm003tob01xjqt0r8f Signed-off-by: Yajat Kapur Failsafe <yajat@getfailsafe.com>
This branch has not been deployed
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.
Security Fix: Fire-and-Forget PCP Upload Race Condition Allows Biometric Data Loss
Severity: Medium
Finding ID:
cmsdegzmm003tob01xjqt0r8fProblem
The PCP (Personal Custody Package) upload in
src/agents/data_uploader.rsis fire-and-forget. After a successful signup, the PCP upload runs asynchronously viaFuturesUnorderedwith these issues:breakand drop the biometric data — no log, no metric, no recovery path(tier, id)regardless of success or failureCode Location
Fix
1. Exponential backoff: Added
PCP_RETRY_INITIAL_BACKOFF(1s) with exponential growth, capped atPCP_RETRY_MAX_BACKOFF(30s). Each retry logs the backoff duration.2. Max retry limit: Added
PCP_MAX_RETRIES(5 attempts). After exhausting retries, the failure is surfaced via:PCP upload tier {tier} failed after {N} retries. Biometric data may be lost. Operator intervention required.main.count.signup.result.failure.upload_custody_imageswithtype:max_retries_exceeded3. Better error logging for 4xx: Client errors now log
Biometric data may be lost. Manual intervention required.instead of silently dropping.4. Retry attempt tracking: Each retry logs the attempt number (
attempt {N}/{MAX_RETRIES}) for observability.Constants
Testing
Submitted by FailSafe Security Research