Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Fri, 25 Aug 2017 13:52:07
Message-Id: 1503669114.2b46203c6c3e47fdf4e1ff99e9f3fb267314acd7.mgorny@gentoo
1 commit: 2b46203c6c3e47fdf4e1ff99e9f3fb267314acd7
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Aug 19 08:23:47 2017 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 25 13:51:54 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2b46203c
7
8 git-r3.eclass: Explicitly warn about unsecure protocols
9
10 Explicitly warn about any URI that uses an unsecure protocol (git, http)
11 even if it's a fallback URI. This is necessary because an attacker may
12 block HTTPS connections, effectively forcing the fallback to
13 the unsecure protocol.
14
15 eclass/git-r3.eclass | 12 +++++++++++-
16 1 file changed, 11 insertions(+), 1 deletion(-)
17
18 diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass
19 index a0aa004caa2..ee6050c3cdd 100644
20 --- a/eclass/git-r3.eclass
21 +++ b/eclass/git-r3.eclass
22 @@ -570,6 +570,16 @@ git-r3_fetch() {
23
24 [[ ${repos[@]} ]] || die "No URI provided and EGIT_REPO_URI unset"
25
26 + local r
27 + for r in "${repos[@]}"; do
28 + if [[ ${r} == git:* || ${r} == http:* ]]; then
29 + ewarn "git-r3: ${r%%:*} protocol is completely unsecure and may render the ebuild"
30 + ewarn "easily suspectible to MITM attacks (even if used only as fallback). Please"
31 + ewarn "use https instead."
32 + ewarn "[URI: ${r}]"
33 + fi
34 + done
35 +
36 local -x GIT_DIR
37 _git-r3_set_gitdir "${repos[0]}"
38
39 @@ -582,7 +592,7 @@ git-r3_fetch() {
40 fi
41
42 # try to fetch from the remote
43 - local r success saved_umask
44 + local success saved_umask
45 if [[ ${EVCS_UMASK} ]]; then
46 saved_umask=$(umask)
47 umask "${EVCS_UMASK}" || die "Bad options to umask: ${EVCS_UMASK}"