-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving then reading pw (session token) client-side fails when length is close to MAX_PASSWORD_LEN #5
Comments
I am working around this currently by bypassing the obf module entirely irods_auth_plugin_openid/src/libopenid.cpp Lines 132 to 201 in c83d746
I may stick with this approach regardless of the resolution of the bug in irods, because it enables straightforward session injection (auto-login) to irods by an external application with rodsadmin privileges. Since session tokens used by the openid plugin are completely opaque anyways (not a password, and not reversible to an oauth2 token) the obf functions are not a major priority. |
While upgrading the session token used to identify a logged-in irods session, an issue was encountered in the obf module of irods.
The base64ed sha256 hash used is 44 bytes, which is under the MAX_PASSWORD_LEN (50bytes). When this is passed to obfSavePw, the data written to .irodsA is more than 50 bytes. This should be fine because that is not the raw byte length of the password, so the 'password' value itself does not exceed MAX_PASSWORD_LEN.
However when calling obfGetPw, there is a check
(https://github.com/irods/irods/blob/master/lib/core/src/obf.cpp#L441)
which makes sure the length of the data in .irodsA is not more than MAX_PASSWORD_LEN. The data has not been 'decoded' to its original length and contents yet though, so at that stage of the process if the pw saved in obfSavePw was close to 50 bytes long, obfGetPw will always fail.
In this case a pw of length 44 (from base64(sha256)) created an irodsA of length 51. As a temporary fix I am just truncating the token down to 40 bytes, which results in an irodsA of length 47.
The text was updated successfully, but these errors were encountered: