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

Bcrypt.verify() throws compiler error #2265

Closed
simonedelmann opened this issue Mar 25, 2020 · 6 comments
Closed

Bcrypt.verify() throws compiler error #2265

simonedelmann opened this issue Mar 25, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@simonedelmann
Copy link
Contributor

simonedelmann commented Mar 25, 2020

When running Bcrypt.verify() via swift run Run this always throws a compiler error.

Steps to reproduce

Add one of these lines to main.swift:

// Test BCrypt
let correctHash = try! Bcrypt.verify("password", created: "$2b$12$Ju7bigpFfjGCiIbqgx7W/uvieIMgj4.ppGLlsFN8j5KW2kOGavljS")

Expected behavior

This should result either true or false.
This should result true.

Actual behavior

When running via command-line (via swift run Run), this throws an compiler error:

Correct hash:

[1]    15147 segmentation fault  swift run Run

Wrong hash

Environment

I've used a fresh Vapor 4 template (March 25th 18:00 UTC), Xcode 11.4 Release, Swift 5.2 Release

@simonedelmann
Copy link
Contributor Author

Here is a zip file:
vaporBug.zip

@0xTim
Copy link
Member

0xTim commented Mar 26, 2020

@simonedelmann that's expected behaviour because WRONG isn't a valid hash so it's throwing an error. If the has wash valid, but was a hash for say password1234 then you'd get false.

@simonedelmann
Copy link
Contributor Author

@0xTim I see! Still the segmentation fault seems to be a bug. I will edit the issue above.

@tanner0101 tanner0101 added the bug Something isn't working label Mar 26, 2020
@tanner0101
Copy link
Member

I'm able to re-create this but I have no idea what could be causing it. It seems to crash when calling bcrypt_hashpass which is part of the CBcrypt module.

I've opened an SR here: https://bugs.swift.org/browse/SR-12424

@tanner0101
Copy link
Member

Closing this here since there's an SR-12424 tracking the issue.

@vojtarylko
Copy link

If somebody stumbles across this: The original issue SR-12424 regressed, follow https://bugs.swift.org/browse/SR-14543

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants