File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 19
19
# an attacker could construct a pull-req that results in a commit object that
20
20
# they've created a collision for. Not the most likely attack, but preventing
21
21
# it is pretty easy so we do so as a "belt-and-suspenders" measure.
22
-
23
- GPG_RES=" $( echo " $INPUT " | gpg --trust-model always --weak-digest sha1 " $@ " 2> /dev/null) "
22
+ GPG_RES=" "
23
+ for LINE in " $( gpg --version) " ; do
24
+ case " $LINE " in
25
+ " gpg (GnuPG) 1.4.1" * |" gpg (GnuPG) 2.0." * )
26
+ echo " Please upgrade to at least gpg 2.1.10 to check for weak signatures" > /dev/stderr
27
+ GPG_RES=" $( echo " $INPUT " | gpg --trust-model always " $@ " 2> /dev/null) "
28
+ ;;
29
+ # We assume if you're running 2.1+, you're probably running 2.1.10+
30
+ # gpg will fail otherwise
31
+ # We assume if you're running 1.X, it is either 1.4.1X or 1.4.20+
32
+ # gpg will fail otherwise
33
+ esac
34
+ done
35
+ [ " $GPG_RES " = " " ] && GPG_RES=" $( echo " $INPUT " | gpg --trust-model always --weak-digest sha1 " $@ " 2> /dev/null) "
24
36
fi
25
37
for LINE in $( echo " $GPG_RES " ) ; do
26
38
case " $LINE " in
@@ -40,7 +52,7 @@ if ! $VALID; then
40
52
exit 1
41
53
fi
42
54
if $VALID && $REVSIG ; then
43
- echo " $INPUT " | gpg --trust-model always " $@ " | grep " \[GNUPG:\] \(NEWSIG\|SIG_ID\|VALIDSIG\)" 2> /dev/null
55
+ echo " $INPUT " | gpg --trust-model always " $@ " 2> /dev/null | grep " \[GNUPG:\] \(NEWSIG\|SIG_ID\|VALIDSIG\)"
44
56
echo " $GOODREVSIG "
45
57
else
46
58
echo " $INPUT " | gpg --trust-model always " $@ " 2> /dev/null
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ IS_SIGNED () {
43
43
export BITCOIN_VERIFY_COMMITS_ALLOW_REVSIG=0
44
44
fi
45
45
46
- if ! git -c " gpg.program=${DIR} /gpg.sh" verify-commit $1 > /dev/null 2>&1 ; then
46
+ if ! git -c " gpg.program=${DIR} /gpg.sh" verify-commit $1 > /dev/null; then
47
47
return 1;
48
48
fi
49
49
You can’t perform that action at this time.
0 commit comments