filter out control characters in warning messages
authorJoey Hess <joeyh@joeyh.name>
Mon, 10 Apr 2023 18:47:32 +0000 (14:47 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 10 Apr 2023 19:55:44 +0000 (15:55 -0400)
commit3290a09a70ef907dec89d38728f22f9916a614f3
tree52b055769f8b1a4f79c2833a33e5c45368483fb9
parent007e30263777163d72db5380ff25744cf6eda314
filter out control characters in warning messages

Converted warning and similar to use StringContainingQuotedPath. Most
warnings are static strings, some do refer to filepaths that need to be
quoted, and others don't need quoting.

Note that, since quote filters out control characters of even
UnquotedString, this makes all warnings safe, even when an attacker
sneaks in a control character in some other way.

When json is being output, no quoting is done, since json gets its own
quoting.

This does, as a side effect, make warning messages in json output not
be indented. The indentation is only needed to offset warning messages
underneath the display of the file they apply to, so that's ok.

Sponsored-by: Brett Eisenberg on Patreon
75 files changed:
Annex/Action.hs
Annex/AdjustedBranch.hs
Annex/BloomFilter.hs
Annex/Common.hs
Annex/Content.hs
Annex/Content/LowLevel.hs
Annex/Difference.hs
Annex/Export.hs
Annex/Hook.hs
Annex/Import.hs
Annex/Ingest.hs
Annex/Init.hs
Annex/Link.hs
Annex/LockPool/PosixOrPid.hs
Annex/MetaData.hs
Annex/SpecialRemote.hs
Annex/Ssh.hs
Annex/Transfer.hs
Annex/Url.hs
Annex/Verify.hs
Annex/YoutubeDl.hs
Assistant/Threads/Committer.hs
Assistant/Threads/MountWatcher.hs
Assistant/Threads/NetWatcher.hs
Assistant/Threads/PairListener.hs
Assistant/Threads/SanityChecker.hs
Assistant/Threads/Watcher.hs
Backend.hs
Backend/External.hs
Backend/Hash.hs
CmdLine/Action.hs
CmdLine/GitAnnex/Options.hs
CmdLine/Seek.hs
Command/Add.hs
Command/AddUrl.hs
Command/DropUnused.hs
Command/EnableTor.hs
Command/Export.hs
Command/FromKey.hs
Command/Fsck.hs
Command/Import.hs
Command/ImportFeed.hs
Command/Multicast.hs
Command/P2P.hs
Command/ReKey.hs
Command/Reinject.hs
Command/Smudge.hs
Command/Sync.hs
Command/TestRemote.hs
Command/TransferKey.hs
Command/TransferKeys.hs
Command/Transferrer.hs
Command/Trust.hs
Command/Undo.hs
Command/View.hs
Command/Whereis.hs
Creds.hs
Messages.hs
Messages/Internal.hs
Messages/Serialized.hs
Remote/Adb.hs
Remote/External.hs
Remote/External/AsyncExtension.hs
Remote/GCrypt.hs
Remote/Git.hs
Remote/GitLFS.hs
Remote/Helper/Chunked/Legacy.hs
Remote/Helper/Ssh.hs
Remote/Hook.hs
Remote/P2P.hs
Remote/S3.hs
Upgrade/V1.hs
Upgrade/V5.hs
Upgrade/V9.hs
doc/todo/terminal_escapes_in_filenames.mdwn