Skip to content

Commit

Permalink
fix: handle expired secrets just like non existing secrets
Browse files Browse the repository at this point in the history
To avoid leaking information the user should not know why she can't read
a secret because it's expired or has no more remaining reads, so return
404.
  • Loading branch information
Ajnasz committed Apr 15, 2024
1 parent 66eca62 commit ac902d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/views/entryread.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (e EntryReadView) Render(w http.ResponseWriter, r *http.Request, response E

func (e EntryReadView) RenderError(w http.ResponseWriter, r *http.Request, err error) {
if errors.Is(err, services.ErrEntryExpired) {
http.Error(w, "Gone", http.StatusGone)
http.Error(w, "Gone", http.StatusNotFound)
return
}

Expand All @@ -61,7 +61,7 @@ func (e EntryReadView) RenderError(w http.ResponseWriter, r *http.Request, err e
}

if errors.Is(err, services.ErrEntryNoRemainingReads) {
http.Error(w, "Gone", http.StatusGone)
http.Error(w, "Gone", http.StatusNotFound)
return
}

Expand Down

0 comments on commit ac902d0

Please sign in to comment.