Exploit databaseDownload repository ZIP
GH-0796e1841535bb9008bc5c3b1e3baf27
42bytelabs/konarr
Sources for CVE-2021-44228
465 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files3
42bytelabs/konarrRevision ead94a5a437a
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
server/src/guards/limit.rs
Rust · 706 bytes//! Rate limiting guard.
use rocket::serde::json::Json;
use rocket_governor::{Method, Quota, RocketGovernable};
use crate::api::{ApiError, ApiErrorResponse};
pub struct RateLimit;
#[rocket::catch(429)]
pub async fn rate_limit() -> ApiErrorResponse {
ApiErrorResponse::TooManyRequests {
inner: (
rocket::http::Status::TooManyRequests,
Json(ApiError {
message: "Rate limit exceeded".to_string(),
details: None,
status: 429,
}),
),
}
}
impl<'r> RocketGovernable<'r> for RateLimit {
fn quota(_method: Method, _route_name: &str) -> Quota {
Quota::per_second(Self::nonzero(1u32))
}
}