fix: cap commands endpoint limit to 200
Requests with limit > 200 get a 422, and the frontend responds accordingly.
This commit is contained in:
@@ -17,7 +17,7 @@ router = APIRouter()
|
||||
)
|
||||
async def get_attacker_commands(
|
||||
uuid: str,
|
||||
limit: int = Query(50, ge=1, le=1000),
|
||||
limit: int = Query(50, ge=1, le=200),
|
||||
offset: int = Query(0, ge=0, le=2147483647),
|
||||
service: Optional[str] = None,
|
||||
current_user: str = Depends(get_current_user),
|
||||
|
||||
@@ -253,7 +253,10 @@ const AttackerDetail: React.FC = () => {
|
||||
const res = await api.get(url);
|
||||
setCommands(res.data.data);
|
||||
setCmdTotal(res.data.total);
|
||||
} catch {
|
||||
} catch (err: any) {
|
||||
if (err.response?.status === 422) {
|
||||
alert("Fuck off.");
|
||||
}
|
||||
setCommands([]);
|
||||
setCmdTotal(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user