summaryrefslogtreecommitdiffstats
path: root/atuin-server/src/handlers
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@elliehuxtable.com>2023-05-10 09:02:35 -0400
committerGitHub <noreply@github.com>2023-05-10 13:02:35 +0000
commitbf7432f3924f81c5edcc7ff39f1fc3cba021eea4 (patch)
tree293f32bc338d2b625cec9fb5151449c561ef43de /atuin-server/src/handlers
parent4a9a626e1783bd66f7300ee4b97b459b70d2525c (diff)
Patch bash history import regression (#970)
* At least patch this on the server side so we don't loop forever * Postgres doesn't support <microsecond precision Use millis - almost everything should support them and they are still faster than a human can reasonably spam a button.
Diffstat (limited to 'atuin-server/src/handlers')
-rw-r--r--atuin-server/src/handlers/history.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/atuin-server/src/handlers/history.rs b/atuin-server/src/handlers/history.rs
index 9a7cb245..3e84074c 100644
--- a/atuin-server/src/handlers/history.rs
+++ b/atuin-server/src/handlers/history.rs
@@ -53,6 +53,14 @@ pub async fn list<DB: Database>(
)
.await;
+ if req.sync_ts.timestamp_nanos() < 0 || req.history_ts.timestamp_nanos() < 0 {
+ error!("client asked for history from < epoch 0");
+ return Err(
+ ErrorResponse::reply("asked for history from before epoch 0")
+ .with_status(StatusCode::BAD_REQUEST),
+ );
+ }
+
if let Err(e) = history {
error!("failed to load history: {}", e);
return Err(ErrorResponse::reply("failed to load history")