piwik-usersmanagerencrypted's People
piwik-usersmanagerencrypted's Issues
Add "use strict" to JavaScript functions
As good coding practice, add use strict
to all JavaScript functions added or modified by me for this plugin. (The ones not modified by me should stay equal to the original Piwik code.) I.e., in:
- usersSettings.js:
- usersManager.js: Similarly.
Infos:
- http://www.w3schools.com/js/js_strict.asp
- https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Strict_mode
But caution! It must be done in functions only, not on the file level. Because in Piwik, all plugin JS is concatenated, which would make use strict
apply to all concatenated files. From the above Mozilla link:
Consider concatenating a strict mode script with a non-strict mode script: the entire concatenation looks strict! [...] It is thus recommended that you enable strict mode on a function-by-function basis (at least during the transition period).
"Salting" passwords before encryption
The missing but crucial feature is "salting" passwords before encryption. The salt does not need to be secret, it only needs to have a defined limited validity time, and to be known to both, the client and the server. For UsersManagementEncrypted, the PHP session ID would fit, but can't be accessed from client-side JavaScript (and it shouldn't). I would need to find a work-around for UsersManagementEncrypted. Like sending a nonce or a strong hash of the session ID to the page, or something.)
P.S.: The reason for the need to salt is that, as of now, encrypted passwords can be used in replay attacks. Similarly to a pass-the-hash attack, but passing the encrypted password.
For the LoginEncrypted plugin, see Joey3000/piwik-LoginEncrypted#1.
Piwik integration
This is to track Piwik platform updates needed for this plugin to work.
- Piwik update: matomo-org/matomo#8781
Use constant-time password string comparison
The current password string comparison in https://github.com/Joey3000/piwik-UsersManagerEncrypted/blob/master/Controller.php#L46 is not constant-time. (See http://codahale.com/a-lesson-in-timing-attacks/ for implications.) See also Piwik issue 9456.
Constant-time examples:
- https://github.com/phpseclib/phpseclib/blob/2.0.0/phpseclib/Crypt/RSA.php#L2201-L2213
- https://github.com/defuse/php-encryption/blob/399fc4c4798b301681888c2608b0ddd060d477da/src/Crypto.php#L409
- https://github.com/phpecc/phpecc/pull/114/files (explanation for usage of
mb_strlen()
instead ofstrlen()
: phpecc/phpecc#115)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.