Skip to content

security risk: password authentication is not enabled by default #1062

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

Closed
natefanaro opened this issue Oct 8, 2019 · 12 comments
Closed

security risk: password authentication is not enabled by default #1062

natefanaro opened this issue Oct 8, 2019 · 12 comments
Labels
enhancement Some improvement that isn't a feature

Comments

@natefanaro
Copy link

Recently downloaded version 2.1523-vsc1.38.1 to try out. From reading the docs I saw there is some form of password auth 👍. After running code-server, the logs state No authentication 👎

This can be a huge security issue for someone who does not understand what they are doing. Password authentication should be enabled by default and disabled via param or environment variable.

I'll spare you the doomsday scenarios that I have been dreaming up for the past hour. I just want to see the internet a little more secure than it has been.

@natefanaro natefanaro added the enhancement Some improvement that isn't a feature label Oct 8, 2019
@sr229
Copy link
Contributor

sr229 commented Oct 8, 2019

We don't want to force down everyone's throats password authentication since people might want to do SSO, which is on another issue. We document already that by setting --auth=password then setting the $PASSWORD variable sets this. Again options are better than forcing something by default since there are a lot of ways to secure code-server already, and it'll be more efficient than simple passwords.

@sr229 sr229 closed this as completed Oct 8, 2019
@natefanaro
Copy link
Author

Ok. Maybe enforcing password authentication isn't the solution. I still think out of the box this is insecure to a novice or someone who is not paying attention. It is trivial to find open instances of this with a tool like shodan.io. I won't post a link to the query here but I was able to find a few unintentionally open instances. This leaves access to the filesystem and terminal open to anyone that finds it.

The different authentication options that code-server provides should be mentioned in README.md, with some kind of warning that a misconfiguration by the user could leave themselves vulnerable.

@Succubussix
Copy link

still a risk for docker users.. I dont know now how to enable this using docker thru portainer

@sr229
Copy link
Contributor

sr229 commented Oct 9, 2019

Again, I'm pretty sure most users are aware how to set them up correctly, and most users who would run it open on the internet can take measures to secure a instance.

@demyxco
Copy link

demyxco commented Oct 9, 2019

@Dj-jom2x you can build your own Dockerfile to have it enabled by default, that's what I did.

@Succubussix
Copy link

how do you change path? example if you had cpanel on.. and you want it to install under his dir only ..

@demyxco
Copy link

demyxco commented Oct 9, 2019

@Dj-jom2x you can see all available commands from the code-server binary.

code-server /default/path/for/code-server --user-data-dir=/home/user/.code/data --extensions-dir=/home/user/.code/extensions --disable-telemetry --auth=password

You can take a look at my Dockerfile (I have 3) for reference: https://github.com/demyxco/code-server

@sr229
Copy link
Contributor

sr229 commented Oct 10, 2019

@Dj-jom2x you can see all available commands from the code-server binary.

code-server /default/path/for/code-server --user-data-dir=/home/user/.code/data --extensions-dir=/home/user/.code/extensions --disable-telemetry --auth=password

You can take a look at my Dockerfile (I have 3) for reference: https://github.com/demyxco/code-server

You forgot setting environment variables and just appending the --auth=password flag would do the job as would your Dockerfile would do, right?

code-asher added a commit that referenced this issue Oct 23, 2019
@code-asher
Copy link
Member

I added a security section to the readme; hopefully that goes a long way. https://github.com/cdr/code-server#security If anyone has any thoughts on how to improve that section lemme know.

For a few reasons I felt it was more natural to enable authentication rather than disable it. Is it common for people to manually expose code-server to the open internet without any authentication while expecting it to be secure in some way? If that's the case it may be prudent to enable password authentication by default. I don't love it but I'd prefer not to expose unaware people's private data.

If we're thinking about being secure by default we might want to re-visit the default of responding to HTTP requests, but perhaps users exposing code-server without HTTPS isn't as common a scenario.

code-asher added a commit that referenced this issue Oct 24, 2019
@code-asher
Copy link
Member

Password authentication is now enabled by default. --auth none to disable it.

@Nosferican
Copy link

Nosferican commented Dec 4, 2019

Post password by default era, how would one set it up for no password?
Example Dockerfile,

version: "3.7"
services:
  vscode:
    image: vscode
    container_name: vscode
    ports:
      - target: 8080
        published: 8080
        protocol: tcp
        mode: host
    volumes:
      - type: bind
        source: ./..
        target: $HOME/coder/project
      - type: bind
        source: ./dev/serve-code/.julia
        target: $HOME/coder/.julia
    environment:
      TZ: AST

How should that be modified for enabling a no authentication?

@demyxco
Copy link

demyxco commented Dec 4, 2019

@Nosferican look at the comment above yours. For docker-compose, use the command key:

image: vscode
container_name: vscode
command: --auth=none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Some improvement that isn't a feature
Projects
None yet
Development

No branches or pull requests

6 participants