Skip to content

Issue warning to folks using old sha256 hashed password #3560

Closed as not planned

Description

@jsjoeio

@jawnsy had a great idea:

I'm not sure where in the code to put it, but it would be nice to issue a warning if someone is using the plain text/cookie/sha256 methods to tell them that their authentication method is insecure, and to consider upgrading to argon2.

See: #3422 (comment)

Will look at after: #3422

Activity

  1. added this to the On Deck milestone on Jun 7, 2021
  2. self-assigned this
    on Jun 7, 2021
  3. finzzz commented on Aug 10, 2021

    @finzzz

    I've tried to use argon2 but apparently it needs salt. But when I use salt, code-server cannot verify it.

  4. jsjoeio commented on Aug 10, 2021

    @jsjoeio
    ContributorAuthor

    Hmm...that doesn't seem right. Can you provide steps to reproduce?

  5. finzzz commented on Aug 10, 2021

    @finzzz

    Sorry my bad, I tried to use

    echo "password" | argon2 passphrase -e
    

    instead of

    echo -n "password" | argon2 passphrase -e
    

    But probably will help if someone encounters similar issue.

  6. jsjoeio commented on Aug 10, 2021

    @jsjoeio
    ContributorAuthor

    You have to use argon2-cli because that's what code-server uses under the hood. I don't think argon2 will work because it uses a different hashing algorithm compared to argon2 the npm package (unless it changed and it does work, but that would be new to me).

    Video

    Here's how you can do it:

    Screen.Recording.2021-08-10.at.1.55.39.PM.mov
  7. finzzz commented on Aug 10, 2021

    @finzzz

    I don't know what's under the hood, but it works with argon2.

  8. jsjoeio commented on Aug 10, 2021

    @jsjoeio
    ContributorAuthor

    Ah, interesting! Maybe I was using it wrong before but hey, glad that works then 🙌

  9. antofthy commented on Dec 20, 2021

    @antofthy

    I for one would love to be able to figure out (or retrieve) the session token! Either from the password, or from the code-server configuration files. So far no luck getting anything to match up to the cookie! Code-Server v3.12.0

  10. jsjoeio commented on Jan 3, 2022

    @jsjoeio
    ContributorAuthor

    So the user declares the password in the code-server config file. The password is then hashed and sent back in the response to the client and stored as a cookie. Here is the logic: https://github.com/coder/code-server/blob/main/src/node/routes/login.ts#L87

  11. antofthy commented on Jan 4, 2022

    @antofthy

    Though I declare the password in an environment variable ($PASSWORD) in a docker instance.
    But after some experiments I validated the URL encoded value of the 'key' cookie, to the given password.
    As such if the cookie can be preset set for that website, I should be able to auto-initialise the login for a already authenticated user.

    One small step... leading to another.
    Of course if the hashing method changes that all gets broken!

  12. jsjoeio commented on Jan 4, 2022

    @jsjoeio
    ContributorAuthor

    @antofthy well keep an eye on any argon2 issues. If it does change, we should be able to add backwards-compatibility. You'll know though from the release notes

  13. code-asher commented on Jul 13, 2024

    @code-asher
    Member

    Merging with #3546

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementSome improvement that isn't a featuresecuritySecurity related

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions