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

Fix empty ssh key importing in ldap #5984



Copy link

commented Feb 6, 2019

The current implementation assumes that any LDAP will either return a valid SSH public key or none at all. It appears that some LDAPs will simply return "" which will cause an out of bounds in our code.

This code protects the importation of public keys by checking that these can be split in to a space separated string (presumably key type and key content - checked later). If the string provided cannot do this it is ignored.

Many thanks to @silverwind for their excellent bug report.

Fix #5975


This comment has been minimized.

Copy link

commented Feb 6, 2019

Codecov Report

❗️ No coverage uploaded for pull request base (master@44d6a90). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #5984   +/-   ##
  Coverage          ?   38.79%           
  Files             ?      330           
  Lines             ?    48731           
  Branches          ?        0           
  Hits              ?    18904           
  Misses            ?    27088           
  Partials          ?     2739
Impacted Files Coverage Δ
models/user.go 48.89% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 44d6a90...e7c1d68. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 label Feb 6, 2019


lafriks approved these changes Feb 7, 2019

@GiteaBot GiteaBot added lgtm/need 1 and removed lgtm/need 2 labels Feb 7, 2019


lunny approved these changes Feb 7, 2019

@GiteaBot GiteaBot added lgtm/done and removed lgtm/need 1 labels Feb 7, 2019

@techknowlogick techknowlogick merged commit cc48c12 into go-gitea:master Feb 7, 2019

2 checks passed

approvals/lgtm this commit looks good
continuous-integration/drone/pr the build was successful

This comment has been minimized.

Copy link

commented Feb 7, 2019

@zeripath please backport 😄

zeripath added a commit to zeripath/gitea that referenced this pull request Feb 8, 2019


This comment has been minimized.

Copy link
Contributor Author

commented Feb 8, 2019

I've finally put up the backport as #6009

@zeripath zeripath deleted the zeripath:issue-5975-fix-LDAP-SSH-problem branch Feb 8, 2019

lafriks added a commit that referenced this pull request Feb 9, 2019

Mikescher added a commit to Mikescher/gitea that referenced this pull request Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
6 participants
You can’t perform that action at this time.