Limit media download retries to prevent unbounded background rescheduling#1
Open
Szpadel wants to merge 1 commit into
Open
Limit media download retries to prevent unbounded background rescheduling#1Szpadel wants to merge 1 commit into
Szpadel wants to merge 1 commit into
Conversation
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.
Motivation
media_pathremainedNone, enabling unbounded background work and a potential DoS.Description
MAX_RETRY_ATTEMPTS: u8 = 3constant and aretry_attempt: u8field toFetchMediaWorkerArgswith#[serde(default)]so older queued jobs default to0when deserialized. (src/workers/fetch_media.rs)schedule_media_retryto accept the currentretry_attempt, skip scheduling when the cap is reached, and re-enqueue the job withretry_attemptincremented. (src/workers/fetch_media.rs)retry_attempt: 0at explicit enqueue call sites to maintain behavior for new jobs. (src/workers/fetch_source_info.rs,src/controllers/media.rs)retry_attemptdefaults to0on deserialization and thatMAX_RETRY_ATTEMPTSis positive. (src/workers/fetch_media.rstests)Testing
cargo fmt --allwhich completed successfully.cargo test fetch_media_worker_args_retry_attempt_defaults_to_zeroand it passed.cargo test retry_attempt_limit_is_greater_than_zeroand it passed.cargo test executes_action_when_check_passesand they passed, confirming no regression inRetrySchedulerbehavior.Codex Task