Skip to content

Commit

Permalink
Stop leaking ES error info. (#4153)
Browse files Browse the repository at this point in the history
  • Loading branch information
elland authored Jul 19, 2024
1 parent 9a1a176 commit 4787839
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.d/3-bug-fixes/WPB-6865
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Exclude exception message from error response
7 changes: 3 additions & 4 deletions libs/wai-utilities/src/Network/Wai/Utilities/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ import Data.Metrics.GC (spawnGCMetricsCollector)
import Data.Streaming.Zlib (ZlibException (..))
import Data.Text.Encoding qualified as Text
import Data.Text.Encoding.Error (lenientDecode)
import Data.Text.Lazy qualified as LT
import Data.Text.Lazy.Encoding qualified as LT
import Data.UUID qualified as UUID
import Data.UUID.V4 qualified as UUID
Expand Down Expand Up @@ -253,7 +252,7 @@ errorHandlers =
ThreadKilled -> throwIO x
_ ->
pure . Left $
Wai.mkError status500 "server-error" ("Server Error. " <> LT.pack (displayException x)),
Wai.mkError status500 "server-error" "Server Error",
Handler $ \(_ :: InvalidRequest) ->
pure . Left $
Wai.mkError status400 "client-error" "Invalid Request",
Expand All @@ -267,9 +266,9 @@ errorHandlers =
ZlibException _ ->
pure . Left $
Wai.mkError status500 "server-error" "Server Error",
Handler $ \(e :: SomeException) ->
Handler $ \(_ :: SomeException) ->
pure . Left $
Wai.mkError status500 "server-error" ("Server Error. " <> LT.pack (displayException e))
Wai.mkError status500 "server-error" "Server Error"
]
{-# INLINE errorHandlers #-}

Expand Down
2 changes: 1 addition & 1 deletion services/brig/test/integration/API/TeamUserSearch.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type TestConstraints m = (MonadFail m, MonadCatch m, MonadIO m, MonadHttp m)
tests :: Opt.Opts -> Manager -> Galley -> Brig -> IO TestTree
tests opts mgr _galley brig = do
pure $
testGroup "/teams/:tid/search" $
testGroup "teams user search" $
[ testWithNewIndex "can find user by email" (testSearchByEmailSameTeam brig),
testWithNewIndex "empty query returns the whole team sorted" (testEmptyQuerySorted brig),
testWithNewIndex "sorting by some properties works" (testSort brig),
Expand Down

0 comments on commit 4787839

Please sign in to comment.