Closed taniwallach closed 3 years ago
During followup work after a discussion with @mgage I noticed that
lib/WeBWorK/ContentGenerator/Instructor/AddUsers.pm
lib/WeBWorK/ContentGenerator/CourseAdmin.pm
use trim_spaces() from lib/WeBWorK/Utils.pm
to remove leading and trailing white-space from several form input values, including:add_initial_password
student_id
(used as an initial password)new_user_id
add_initial_userID
so at least those manners of creating a password (and a user_id
) apparently do trim leading/trailing white-space.Adding new users and setting passwords via the ClassList Editor apparently do not trim leading/trailing white-space.
The following seems to be a complete list of files where the DB modules addPassword()
or putPassword()
function is used on input which may need to be trimmed. These are the candidates for examination and possible modification.
bin/newpassword
bin/change_user_id
lib/WebworkWebservice/CourseActions.pm
lib/WebworkSOAP.pm
lib/WeBWorK/Authen.pm
lib/WeBWorK/ContentGenerator/Instructor/AddUsers.pm
lib/WeBWorK/ContentGenerator/Instructor/UserList.pm
lib/WeBWorK/ContentGenerator/Instructor/UserList2.pm
lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm
lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm
lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm
lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail2.pm
lib/WeBWorK/ContentGenerator/CourseAdmin.pm
lib/WeBWorK/ContentGenerator/Options.pm
lib/WeBWorK/Utils/CourseManagement.pm
lib/WeBWorK/Utils/DBImportExport.pm
Did we make a decision about this for including in ww2.16?
Did we make a decision about this for including in ww2.16?
I think we decided that one of us should try to make the changes to be consistent. Too much other work was going on... but we can consider this for RC2.
I think this does need to make it into ww2.16. I just did a test, and discovered that students can change their passwords on the user settings page to a password that starts or ends with a space (or more), and then can not sign in with that password.
So how did we decide to make this consistent? Do we make it always trim, or always not trim?
So how did we decide to make this consistent? Do we make it always trim, or always not trim?
I think we decided to trim everywhere.
Pros:
Cons:
I think we decided that the rare cases where we DoS a user who intentionally set an external password with leading or trailing whits-space can be told to change their password to avoid that. I certainly feel that this is likely to cause less total human time-cost in the long run.
This is being fixed in #1290
Issue:
Release 2.14 added a trim() function to the code of lib/WeBWorK/Authen.pm and it is used to remove leading and trailing white-space from passwords submitted and processed by the "regular" local authentication code.
On the other hand, (most/all of???) the code which puts passwords into the database does no such trimming to the value before it is crypted and stored in the database. For example, the Classlist editor can be used to set a password which has leading/trailing white-space.
Due to this conflict, passwords may be set in the database which cannot actually be used to access the system.
Options:
cryptPassword()
inlib/WeBWorK/Utils.pm
.This issue was raised, somewhat in passing, in the discussed in https://github.com/openwebwork/webwork2/pull/911
Also related:
wwassignment
and LTI only users, and such special cases should still be allowed to set the access-forbidden empty password.