mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-10-01 01:26:10 -04:00
addressing issues found by codacy
This commit is contained in:
parent
0f76b9066d
commit
717e5b0e57
@ -13,7 +13,6 @@ env:
|
|||||||
node: true
|
node: true
|
||||||
|
|
||||||
globals:
|
globals:
|
||||||
sjcl: false
|
|
||||||
DOMPurify: false
|
DOMPurify: false
|
||||||
after: true
|
after: true
|
||||||
before: true
|
before: true
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"bitwise": true,
|
"bitwise": true,
|
||||||
"curly": true,
|
"curly": true,
|
||||||
"eqeqeq": true,
|
"eqeqeq": true,
|
||||||
"esversion": 5,
|
"esversion": 6,
|
||||||
"forin": true,
|
"forin": true,
|
||||||
"freeze": true,
|
"freeze": true,
|
||||||
"futurehostile": true,
|
"futurehostile": true,
|
||||||
@ -39,7 +39,6 @@
|
|||||||
"window": true
|
"window": true
|
||||||
},
|
},
|
||||||
"globals": {
|
"globals": {
|
||||||
"sjcl": true,
|
|
||||||
"DOMPurify": true,
|
"DOMPurify": true,
|
||||||
"kjua": true
|
"kjua": true
|
||||||
}
|
}
|
||||||
|
@ -736,7 +736,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||||||
{name: 'PBKDF2'}, // we use PBKDF2 for key derivation
|
{name: 'PBKDF2'}, // we use PBKDF2 for key derivation
|
||||||
false, // the key may not be exported
|
false, // the key may not be exported
|
||||||
['deriveKey'] // we may only use it for key derivation
|
['deriveKey'] // we may only use it for key derivation
|
||||||
)
|
);
|
||||||
|
|
||||||
// derive a stronger key for use with AES
|
// derive a stronger key for use with AES
|
||||||
const derivedKey = await window.crypto.subtle.deriveKey(
|
const derivedKey = await window.crypto.subtle.deriveKey(
|
||||||
@ -754,7 +754,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||||||
},
|
},
|
||||||
false, // the key may not be exported
|
false, // the key may not be exported
|
||||||
['encrypt'] // we may only use it for decryption
|
['encrypt'] // we may only use it for decryption
|
||||||
)
|
);
|
||||||
|
|
||||||
// finally, encrypt message
|
// finally, encrypt message
|
||||||
const encrypted = await window.crypto.subtle.encrypt(
|
const encrypted = await window.crypto.subtle.encrypt(
|
||||||
@ -767,7 +767,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||||||
},
|
},
|
||||||
derivedKey,
|
derivedKey,
|
||||||
StrToArr(compress(message)) // compressed plain text to encrypt
|
StrToArr(compress(message)) // compressed plain text to encrypt
|
||||||
)
|
);
|
||||||
object.ct = btoa(ArrToStr(encrypted));
|
object.ct = btoa(ArrToStr(encrypted));
|
||||||
return JSON.stringify(object);
|
return JSON.stringify(object);
|
||||||
};
|
};
|
||||||
@ -821,7 +821,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||||||
},
|
},
|
||||||
false, // the key may not be exported
|
false, // the key may not be exported
|
||||||
['decrypt'] // we may only use it for decryption
|
['decrypt'] // we may only use it for decryption
|
||||||
)
|
);
|
||||||
|
|
||||||
// finally, decrypt message
|
// finally, decrypt message
|
||||||
const decrypted = await window.crypto.subtle.decrypt(
|
const decrypted = await window.crypto.subtle.decrypt(
|
||||||
@ -834,7 +834,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||||||
},
|
},
|
||||||
derivedKey,
|
derivedKey,
|
||||||
StrToArr(atob(object.ct)) // cipher text to decrypt
|
StrToArr(atob(object.ct)) // cipher text to decrypt
|
||||||
)
|
);
|
||||||
return decompress(ArrToStr(decrypted));
|
return decompress(ArrToStr(decrypted));
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
return '';
|
return '';
|
||||||
|
@ -70,7 +70,7 @@ if ($MARKDOWN):
|
|||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.7.js" integrity="sha512-VnKJHLosO8z2ojNvWk9BEKYqnhZyWK9rM90FgZUUEp/PRnUqR5OLLKE0a3BkVmn7YgB7LXRrjHgFHQYKd6DAIA==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.7.js" integrity="sha512-VnKJHLosO8z2ojNvWk9BEKYqnhZyWK9rM90FgZUUEp/PRnUqR5OLLKE0a3BkVmn7YgB7LXRrjHgFHQYKd6DAIA==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-op63EWMfaSPghE5cG+5iyYHS8Llg12VRNTQNrX1r/ehT78RFJxN6CTFjxq3E0tHd4iCtAtCA1FwrkvVgbX47zw==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-kn3yqj5KEEjhNS3Z/2WZT/e9vLtpxOXmeBbn1liPgw8EUvlSbDLdrSbcGKrDX16Zochji2pDMNMZOTLuTm9CFA==" crossorigin="anonymous"></script>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
@ -48,7 +48,7 @@ if ($MARKDOWN):
|
|||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.7.js" integrity="sha512-VnKJHLosO8z2ojNvWk9BEKYqnhZyWK9rM90FgZUUEp/PRnUqR5OLLKE0a3BkVmn7YgB7LXRrjHgFHQYKd6DAIA==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.7.js" integrity="sha512-VnKJHLosO8z2ojNvWk9BEKYqnhZyWK9rM90FgZUUEp/PRnUqR5OLLKE0a3BkVmn7YgB7LXRrjHgFHQYKd6DAIA==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-op63EWMfaSPghE5cG+5iyYHS8Llg12VRNTQNrX1r/ehT78RFJxN6CTFjxq3E0tHd4iCtAtCA1FwrkvVgbX47zw==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-kn3yqj5KEEjhNS3Z/2WZT/e9vLtpxOXmeBbn1liPgw8EUvlSbDLdrSbcGKrDX16Zochji2pDMNMZOTLuTm9CFA==" crossorigin="anonymous"></script>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
Loading…
Reference in New Issue
Block a user