remote.name.annex-security-allow-unverified-downloads
Added remote.name.annex-security-allow-unverified-downloads, a per-remote setting for annex.security.allow-unverified-downloads. This commit was sponsored by Brock Spratlen on Patreon.
This commit is contained in:
parent
177e45517f
commit
bc31b93c77
8 changed files with 27 additions and 6 deletions
|
@ -18,6 +18,8 @@ git-annex (6.20180914) UNRELEASED; urgency=medium
|
||||||
supporting filenames containing newlines.
|
supporting filenames containing newlines.
|
||||||
* Added annex.maxextensionlength for use cases where extensions longer
|
* Added annex.maxextensionlength for use cases where extensions longer
|
||||||
than 4 characters are needed.
|
than 4 characters are needed.
|
||||||
|
* Added remote.name.annex-security-allow-unverified-downloads, a
|
||||||
|
per-remote setting for annex.security.allow-unverified-downloads.
|
||||||
* More FreeBSD build fixes.
|
* More FreeBSD build fixes.
|
||||||
|
|
||||||
[ Yaroslav Halchenko ]
|
[ Yaroslav Halchenko ]
|
||||||
|
|
|
@ -113,7 +113,7 @@ gen r u c gc
|
||||||
-- and have no protection against redirects to
|
-- and have no protection against redirects to
|
||||||
-- local private web servers, or in some cases
|
-- local private web servers, or in some cases
|
||||||
-- to file:// urls.
|
-- to file:// urls.
|
||||||
, retrievalSecurityPolicy = RetrievalVerifiableKeysSecure
|
, retrievalSecurityPolicy = mkRetrievalVerifiableKeysSecure gc
|
||||||
, removeKey = removeKeyDummy
|
, removeKey = removeKeyDummy
|
||||||
, lockContent = Nothing
|
, lockContent = Nothing
|
||||||
, checkPresent = checkPresentDummy
|
, checkPresent = checkPresentDummy
|
||||||
|
|
|
@ -59,7 +59,7 @@ gen r u c gc = new <$> remoteCost gc veryExpensiveRemoteCost
|
||||||
-- not support file://, as far as we know, but
|
-- not support file://, as far as we know, but
|
||||||
-- there's no guarantee that will continue to be
|
-- there's no guarantee that will continue to be
|
||||||
-- the case, so require verifiable keys.
|
-- the case, so require verifiable keys.
|
||||||
, retrievalSecurityPolicy = RetrievalVerifiableKeysSecure
|
, retrievalSecurityPolicy = mkRetrievalVerifiableKeysSecure gc
|
||||||
, removeKey = removeKeyDummy
|
, removeKey = removeKeyDummy
|
||||||
, lockContent = Nothing
|
, lockContent = Nothing
|
||||||
, checkPresent = checkPresentDummy
|
, checkPresent = checkPresentDummy
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{- helpers for special remotes
|
{- helpers for special remotes
|
||||||
-
|
-
|
||||||
- Copyright 2011-2014 Joey Hess <id@joeyh.name>
|
- Copyright 2011-2018 Joey Hess <id@joeyh.name>
|
||||||
-
|
-
|
||||||
- Licensed under the GNU GPL version 3 or higher.
|
- Licensed under the GNU GPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
module Remote.Helper.Special (
|
module Remote.Helper.Special (
|
||||||
findSpecialRemotes,
|
findSpecialRemotes,
|
||||||
gitConfigSpecialRemote,
|
gitConfigSpecialRemote,
|
||||||
|
mkRetrievalVerifiableKeysSecure,
|
||||||
Preparer,
|
Preparer,
|
||||||
Storer,
|
Storer,
|
||||||
Retriever,
|
Retriever,
|
||||||
|
@ -73,6 +74,15 @@ gitConfigSpecialRemote u c cfgs = do
|
||||||
where
|
where
|
||||||
remotename = fromJust (M.lookup "name" c)
|
remotename = fromJust (M.lookup "name" c)
|
||||||
|
|
||||||
|
-- RetrievalVerifiableKeysSecure unless overridden by git config.
|
||||||
|
--
|
||||||
|
-- Only looks at the RemoteGitConfig; the GitConfig's setting is
|
||||||
|
-- checked at the same place the RetrievalSecurityPolicy is checked.
|
||||||
|
mkRetrievalVerifiableKeysSecure :: RemoteGitConfig -> RetrievalSecurityPolicy
|
||||||
|
mkRetrievalVerifiableKeysSecure gc
|
||||||
|
| remoteAnnexAllowUnverifiedDownloads gc = RetrievalAllKeysSecure
|
||||||
|
| otherwise = RetrievalVerifiableKeysSecure
|
||||||
|
|
||||||
-- Use when nothing needs to be done to prepare a helper.
|
-- Use when nothing needs to be done to prepare a helper.
|
||||||
simplyPrepare :: helper -> Preparer helper
|
simplyPrepare :: helper -> Preparer helper
|
||||||
simplyPrepare helper _ a = a $ Just helper
|
simplyPrepare helper _ a = a $ Just helper
|
||||||
|
@ -168,7 +178,7 @@ specialRemote' cfg c preparestorer prepareretriever prepareremover preparecheckp
|
||||||
-- into the git-annex repository. Verifiable keys
|
-- into the git-annex repository. Verifiable keys
|
||||||
-- are the main protection against this attack.
|
-- are the main protection against this attack.
|
||||||
, retrievalSecurityPolicy = if isencrypted
|
, retrievalSecurityPolicy = if isencrypted
|
||||||
then RetrievalVerifiableKeysSecure
|
then mkRetrievalVerifiableKeysSecure (gitconfig baser)
|
||||||
else retrievalSecurityPolicy baser
|
else retrievalSecurityPolicy baser
|
||||||
, removeKey = \k -> cip >>= removeKeyGen k
|
, removeKey = \k -> cip >>= removeKeyGen k
|
||||||
, checkPresent = \k -> cip >>= checkPresentGen k
|
, checkPresent = \k -> cip >>= checkPresentGen k
|
||||||
|
|
|
@ -51,7 +51,7 @@ gen r u c gc = do
|
||||||
, retrieveKeyFileCheap = retrieveCheap hooktype
|
, retrieveKeyFileCheap = retrieveCheap hooktype
|
||||||
-- A hook could use http and be vulnerable to
|
-- A hook could use http and be vulnerable to
|
||||||
-- redirect to file:// attacks, etc.
|
-- redirect to file:// attacks, etc.
|
||||||
, retrievalSecurityPolicy = RetrievalVerifiableKeysSecure
|
, retrievalSecurityPolicy = mkRetrievalVerifiableKeysSecure gc
|
||||||
, removeKey = removeKeyDummy
|
, removeKey = removeKeyDummy
|
||||||
, lockContent = Nothing
|
, lockContent = Nothing
|
||||||
, checkPresent = checkPresentDummy
|
, checkPresent = checkPresentDummy
|
||||||
|
|
|
@ -234,6 +234,7 @@ data RemoteGitConfig = RemoteGitConfig
|
||||||
, remoteAnnexBare :: Maybe Bool
|
, remoteAnnexBare :: Maybe Bool
|
||||||
, remoteAnnexRetry :: Maybe Integer
|
, remoteAnnexRetry :: Maybe Integer
|
||||||
, remoteAnnexRetryDelay :: Maybe Seconds
|
, remoteAnnexRetryDelay :: Maybe Seconds
|
||||||
|
, remoteAnnexAllowUnverifiedDownloads :: Bool
|
||||||
|
|
||||||
{- These settings are specific to particular types of remotes
|
{- These settings are specific to particular types of remotes
|
||||||
- including special remotes. -}
|
- including special remotes. -}
|
||||||
|
@ -291,6 +292,8 @@ extractRemoteGitConfig r remotename = do
|
||||||
, remoteAnnexRetry = getmayberead "retry"
|
, remoteAnnexRetry = getmayberead "retry"
|
||||||
, remoteAnnexRetryDelay = Seconds
|
, remoteAnnexRetryDelay = Seconds
|
||||||
<$> getmayberead "retrydelay"
|
<$> getmayberead "retrydelay"
|
||||||
|
, remoteAnnexAllowUnverifiedDownloads = (== Just "ACKTHPPT") $
|
||||||
|
getmaybe ("security-allow-unverified-downloads")
|
||||||
, remoteAnnexShell = getmaybe "shell"
|
, remoteAnnexShell = getmaybe "shell"
|
||||||
, remoteAnnexSshOptions = getoptions "ssh-options"
|
, remoteAnnexSshOptions = getoptions "ssh-options"
|
||||||
, remoteAnnexRsyncOptions = getoptions "rsync-options"
|
, remoteAnnexRsyncOptions = getoptions "rsync-options"
|
||||||
|
|
|
@ -1450,7 +1450,7 @@ Here are all the supported configuration settings.
|
||||||
these IP address restrictions to be enforced, curl and youtube-dl will
|
these IP address restrictions to be enforced, curl and youtube-dl will
|
||||||
never be used unless annex.security.allowed-http-addresses=all.
|
never be used unless annex.security.allowed-http-addresses=all.
|
||||||
|
|
||||||
* `annex.security.allow-unverified-downloads`,
|
* `annex.security.allow-unverified-downloads`
|
||||||
|
|
||||||
For security reasons, git-annex refuses to download content from
|
For security reasons, git-annex refuses to download content from
|
||||||
most special remotes when it cannot check a hash to verify
|
most special remotes when it cannot check a hash to verify
|
||||||
|
@ -1487,6 +1487,10 @@ Here are all the supported configuration settings.
|
||||||
It would be a good idea to check that it downloaded the file you expected,
|
It would be a good idea to check that it downloaded the file you expected,
|
||||||
too.
|
too.
|
||||||
|
|
||||||
|
* `remote.name.annex-security-allow-unverified-downloads`
|
||||||
|
|
||||||
|
Per-remote configuration of annex.security.allow-unverified-downloads.
|
||||||
|
|
||||||
* `annex.secure-erase-command`
|
* `annex.secure-erase-command`
|
||||||
|
|
||||||
This can be set to a command that should be run whenever git-annex
|
This can be set to a command that should be run whenever git-annex
|
||||||
|
|
|
@ -3,3 +3,5 @@ Sometimes I _know_ that a given external special remote doesn't do redirects, or
|
||||||
git -c annex.security.allow-unverified-downloads=ACKTHPPT annex get myfile
|
git -c annex.security.allow-unverified-downloads=ACKTHPPT annex get myfile
|
||||||
every time is another thing to think about, when the whole point of git-annex is to not have to think about where things are :) While configuring
|
every time is another thing to think about, when the whole point of git-annex is to not have to think about where things are :) While configuring
|
||||||
annex.security.allow-unverified-downloads=ACKTHPPT permanently opens security holes.
|
annex.security.allow-unverified-downloads=ACKTHPPT permanently opens security holes.
|
||||||
|
|
||||||
|
> [[done]] --[[Joey]]
|
||||||
|
|
Loading…
Reference in a new issue