29
29
30
30
package cc .arduino .contributions ;
31
31
32
+ import cc .arduino .Constants ;
32
33
import cc .arduino .utils .FileHash ;
33
34
import cc .arduino .utils .MultiStepProgress ;
34
35
import cc .arduino .utils .Progress ;
@@ -199,11 +200,9 @@ public boolean verifyDomain(URL url) {
199
200
public boolean checkSignature (MultiStepProgress progress , URL signatureUrl , ProgressListener progressListener , SignatureVerifier signatureVerifier , String statusText , File fileToVerify ) throws Exception {
200
201
201
202
final boolean allowInsecurePackages =
202
- PreferencesData .getBoolean ("allow_insecure_packages" , false );
203
- if (allowInsecurePackages ) {
204
- log .info ("Allow insecure packages is true the signature will be skip and return always verified" );
205
- return true ;
206
- }
203
+ PreferencesData .getBoolean (Constants .ALLOW_INSECURE_PACKAGES , false );
204
+ final boolean trustAll = PreferencesData .getBoolean (Constants .PREF_CONTRIBUTIONS_TRUST_ALL );
205
+ final boolean skipVerification = allowInsecurePackages || trustAll ;
207
206
208
207
// Signature file name
209
208
final String signatureFileName = FilenameUtils .getName (signatureUrl .getPath ());
@@ -215,6 +214,12 @@ public boolean checkSignature(MultiStepProgress progress, URL signatureUrl, Prog
215
214
// Download signature
216
215
download (signatureUrl , packageIndexSignatureTemp , progress , statusText , progressListener , true );
217
216
217
+ if (skipVerification ) {
218
+ log .info ("Allowing insecure packages because allow_insecure_packages is set to true in preferences.txt" +
219
+ " but the signature was download" );
220
+ return true ;
221
+ }
222
+
218
223
// Verify the signature before move the files
219
224
final boolean signatureVerified = signatureVerifier .isSigned (fileToVerify , packageIndexSignatureTemp );
220
225
if (signatureVerified ) {
0 commit comments