Skip to content
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

Strip whitespace from username #32

Open
andla46 opened this issue Oct 7, 2014 · 1 comment
Open

Strip whitespace from username #32

andla46 opened this issue Oct 7, 2014 · 1 comment

Comments

@andla46
Copy link

andla46 commented Oct 7, 2014

I'm using omniauth-cas together with Gitlab and an external CAS 2.0 server, which works very well besides one issue:

The server happily authenticates usernames with trailing whitespaces (i.e. the server obviously strips ws internally before validating) but then sends the whole username string (including ws) on to the cas module.

This caused us some issues, since gitlab then updates the users table with the new username string (again, inc ws).

This is the first time I've seen this issue, since most of our other CASified systems are behind apache/mod_auth_cas which filters ws before handing on the username.

This fixes it pretty thoroughly, even though it does a bit more than ws-strip uid:

       def prune!(hash)
         hash.delete_if do |_, value|
+          value.strip! if value.is_a?(String)
           prune!(value) if value.is_a?(Hash)
           value.nil? || (value.respond_to?(:empty?) && value.empty?)
         end

Is this a suitable fix? Should I fix a PR?

@dlindahl
Copy link
Owner

I no longer have access to a CAS server and therefore am no longer fit to maintain this project.

If you would like to volunteer to be a maintainer of this project, please let me know by opening an Issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants