Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: user passwords cleanup#1202

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
coadler merged 3 commits intomainfromcolin/password-cleanup
Apr 28, 2022
Merged

fix: user passwords cleanup#1202

coadler merged 3 commits intomainfromcolin/password-cleanup
Apr 28, 2022

Conversation

coadler
Copy link
Contributor

@coadlercoadler commentedApr 27, 2022
edited
Loading

  1. Adds benchmarks comparing bcrypt and our pbkdf2 settings
  2. Changes the pbkdf2 hash iterations back to 65k. 1024 is insecure
  3. Gets rid of the short circuit when the user isn't found, preventing
    timing attacks which can reveal which emails exist on a deployment
$ go test -bench .goos: linuxgoarch: amd64pkg: github.com/coder/coder/coderd/userpasswordcpu: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHzBenchmarkBcryptMinCost-16            1651    702727 ns/op    5165 B/op      10 allocs/opBenchmarkPbkdf2MinCost-16            1669    714843 ns/op     804 B/op      10 allocs/opBenchmarkBcryptDefaultCost-16          27  42676316 ns/op    5246 B/op      10 allocs/opBenchmarkPbkdf2-16                     26  45902236 ns/op     804 B/op      10 allocs/opPASSok  github.com/coder/coder/coderd/userpassword5.036s

1. Adds benchmarks comparing bcrypt and our pbkdf2 settings1. Changes the pbkdf2 hash iterations back to 65k. 1024 is insecure1. Gets rid of the short circuit when the user isn't found, preventing   timing attacks which can reveal which emails exist on a deployment
@coadlercoadler self-assigned thisApr 27, 2022
@codecov
Copy link

codecovbot commentedApr 27, 2022
edited
Loading

Codecov Report

Merging#1202 (449947f) intomain (8661f92) willdecrease coverage by0.91%.
The diff coverage is82.35%.

@@            Coverage Diff             @@##             main    #1202      +/-   ##==========================================- Coverage   66.27%   65.35%   -0.92%==========================================  Files         265      261       -4       Lines       16681    16750      +69       Branches      157      157              ==========================================- Hits        11055    10947     -108- Misses       4484     4658     +174- Partials     1142     1145       +3
FlagCoverage Δ
unittest-go-macos-latest53.02% <82.35%> (-0.54%)⬇️
unittest-go-postgres-64.54% <82.35%> (-0.97%)⬇️
unittest-go-ubuntu-latest55.50% <82.35%> (-0.64%)⬇️
unittest-go-windows-2022?
unittest-js66.50% <ø> (ø)
Impacted FilesCoverage Δ
coderd/users.go60.86% <40.00%> (-2.41%)⬇️
coderd/userpassword/userpassword.go70.00% <89.65%> (+6.58%)⬆️
cli/configssh.go61.19% <0.00%> (-6.72%)⬇️
cli/cliui/agent.go77.19% <0.00%> (-5.27%)⬇️
pty/ptytest/ptytest.go86.95% <0.00%> (-4.35%)⬇️
peerbroker/proxy.go58.72% <0.00%> (-3.49%)⬇️
cli/templateinit.go58.62% <0.00%> (-3.45%)⬇️
agent/agent.go63.12% <0.00%> (-3.20%)⬇️
provisioner/echo/serve.go56.80% <0.00%> (-2.41%)⬇️
... and15 more

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last update8661f92...449947f. Read thecomment docs.

@coadlercoadler requested a review fromkylecarbsApril 27, 2022 22:45
Copy link
Member

@kylecarbskylecarbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Great job improving this. I didn't realize 1024 was insecure, but I'm sure happy you did. 🌮 to you@coadler !

// https://csrc.nist.gov/csrc/media/templates/cryptographic-module-validation-program/documents/security-policies/140sp2261.pdf
func Compare(hashed string, password string) (bool, error) {
// If the hased password provided is empty, simulate comparing a real hash.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Is this so attackers can't use a timing attack to check if the user has no password set?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It's for users that don't exist, so that there's no difference in response times based on if the user exists or not.

kylecarbs reacted with thumbs up emoji
@coadlercoadlerenabled auto-merge (squash)April 28, 2022 18:18
@coadlercoadler merged commit1661588 intomainApr 28, 2022
@coadlercoadler deleted the colin/password-cleanup branchApril 28, 2022 18:22
@missknissmisskniss added this to theV2 Beta milestoneMay 15, 2022
kylecarbs pushed a commit that referenced this pull requestJun 10, 2022
1. Adds benchmarks comparing bcrypt and our pbkdf2 settings1. Changes the pbkdf2 hash iterations back to 65k. 1024 is insecure1. Gets rid of the short circuit when the user isn't found, preventing   timing attacks which can reveal which emails exist on a deployment```$ go test -bench .goos: linuxgoarch: amd64pkg: github.com/coder/coder/coderd/userpasswordcpu: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHzBenchmarkBcryptMinCost-16            1651    702727 ns/op    5165 B/op      10 allocs/opBenchmarkPbkdf2MinCost-16            1669    714843 ns/op     804 B/op      10 allocs/opBenchmarkBcryptDefaultCost-16          27  42676316 ns/op    5246 B/op      10 allocs/opBenchmarkPbkdf2-16                     26  45902236 ns/op     804 B/op      10 allocs/opPASSok  github.com/coder/coder/coderd/userpassword5.036s```
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@kylecarbskylecarbskylecarbs approved these changes

Assignees

@coadlercoadler

Labels
None yet
Projects
None yet
Milestone
V2 Beta
Development

Successfully merging this pull request may close these issues.

3 participants
@coadler@kylecarbs@misskniss

[8]ページ先頭

©2009-2025 Movatter.jp