Skip to content

Commit

Permalink
Add DOS safeguard in replay retry algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
mendess committed Oct 11, 2023
1 parent a28dee2 commit c730012
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions daphne/src/roles/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,16 @@ pub trait DapHelper<S>: DapAggregator<S> {
// won't happen often enough that it matters.
let (out_shares_count, agg_job_resp) = {
let mut replayed_reports = HashSet::new();
let mut retry_count = 3;
loop {
if retry_count < 1 {
// we need to prevent an attacker from keeping this loop running for too long,
// potentialy enabling an DOS attack.
return Err(DapAbort::BadRequest(
"AggregationJobContinueReq contained too many replays".into(),
));
}
retry_count -= 1;
let (agg_share_span, agg_job_resp) = task_config.vdaf.handle_agg_job_cont_req(
task_id,
task_config,
Expand Down

0 comments on commit c730012

Please sign in to comment.