filter out control characters in error messages
giveup changed to filter out control characters. (It is too low level to make it use StringContainingQuotedPath.) error still does not, but it should only be used for internal errors, where the message is not attacker-controlled. Changed a lot of existing error to giveup when it is not strictly an internal error. Of course, other exceptions can still be thrown, either by code in git-annex, or a library, that include some attacker-controlled value. This does not guard against those. Sponsored-by: Noam Kremen on Patreon
This commit is contained in:
parent
063c00e4f7
commit
cd544e548b
69 changed files with 142 additions and 103 deletions
|
@ -34,7 +34,7 @@ notCurrentRepo uuid a = do
|
|||
then redirect DeleteCurrentRepositoryR
|
||||
else go =<< liftAnnex (Remote.remoteFromUUID uuid)
|
||||
where
|
||||
go Nothing = error "Unknown UUID"
|
||||
go Nothing = giveup "Unknown UUID"
|
||||
go (Just _) = a
|
||||
|
||||
getDeleteRepositoryR :: UUID -> Handler Html
|
||||
|
@ -45,7 +45,7 @@ getDeleteRepositoryR uuid = notCurrentRepo uuid $ do
|
|||
|
||||
getStartDeleteRepositoryR :: UUID -> Handler Html
|
||||
getStartDeleteRepositoryR uuid = do
|
||||
remote <- fromMaybe (error "unknown remote")
|
||||
remote <- fromMaybe (giveup "unknown remote")
|
||||
<$> liftAnnex (Remote.remoteFromUUID uuid)
|
||||
liftAnnex $ do
|
||||
trustSet uuid UnTrusted
|
||||
|
|
|
@ -203,7 +203,7 @@ editForm new (RepoUUID uuid)
|
|||
mremote <- liftAnnex $ Remote.remoteFromUUID uuid
|
||||
when (mremote == Nothing) $
|
||||
whenM ((/=) uuid <$> liftAnnex getUUID) $
|
||||
error "unknown remote"
|
||||
giveup "unknown remote"
|
||||
curr <- liftAnnex $ getRepoConfig uuid mremote
|
||||
liftAnnex $ checkAssociatedDirectory curr mremote
|
||||
mrepo <- liftAnnex $
|
||||
|
|
|
@ -216,10 +216,10 @@ startLocalPairing stage oncancel alert muuid displaysecret secret = do
|
|||
- background. -}
|
||||
thread <- liftAssistant $ asIO $ do
|
||||
keypair <- liftIO $ genSshKeyPair
|
||||
let pubkey = either error id $ validateSshPubKey $ sshPubKey keypair
|
||||
let pubkey = either giveup id $ validateSshPubKey $ sshPubKey keypair
|
||||
pairdata <- liftIO $ PairData
|
||||
<$> getHostname
|
||||
<*> (either error id <$> myUserName)
|
||||
<*> (either giveup id <$> myUserName)
|
||||
<*> pure reldir
|
||||
<*> pure pubkey
|
||||
<*> (maybe genUUID return muuid)
|
||||
|
|
|
@ -67,7 +67,7 @@ customPage' with_longpolling navbaritem content = do
|
|||
addScript $ StaticR js_longpolling_js
|
||||
$(widgetFile "page")
|
||||
withUrlRenderer $(Hamlet.hamletFile $ hamletTemplate "bootstrap")
|
||||
Just msg -> error msg
|
||||
Just msg -> giveup msg
|
||||
where
|
||||
navdetails i = (navBarName i, navBarRoute i, Just i == navbaritem)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue