Skip to content

Add option for disabling file downloads #2426

Closed

Description

@code-asher

Being able to easily download might be an issue in some situations. See some comments on #1386.

Maybe it also makes sense to prevent the HTTP server from serving these files as well so you can't just curl them.

Activity

  1. JammSpread commented on Dec 9, 2020

    @JammSpread
    Contributor

    If I'm correct we just have to patch this with if statements on lines 228 225 and 488 485?

  2. code-asher commented on Dec 10, 2020

    @code-asher
    MemberAuthor
  3. bpmct commented on Dec 21, 2020

    @bpmct
    Member

    I confirmed two sections mentioned above will disable the download option :)

    I was also able to modify the static endpoint, I believe we'll want to use something similar to this check to ensure the user can't curl or visit the page for these static files. For curl in particular, we can do

    if (req.headers["user-agent"] && req.headers["user-agent"].includes("curl")) {
        throw new HttpError("Unauthorized", HttpCode.Unauthorized)
    }
    

    but I assume there is probably a better way to whitelist requests from code-server? Any ideas what headers we should be looking for?

    Also, I've added the flag --disable-download in the CLI but am unsure how to check for that in fileActions.contribution.ts.

  4. lsc196 commented on Dec 22, 2020

    @lsc196

    How to ban downloading files now?

  5. JammSpread commented on Dec 26, 2020

    @JammSpread
    Contributor

    Also, I've added the flag --disable-download in the CLI but am unsure how to check for that in fileActions.contribution.ts.

    I think an easy way for you to check for --disable-download might be by passing the flag as an environment variable.

  6. bpmct commented on Jan 4, 2021

    @bpmct
    Member

    Yeah, I'd love to do it as both (code-server handles most options like this), but I haven't been able to find an example of it implemented somewhere like fileActions

  7. code-asher commented on Jan 4, 2021

    @code-asher
    MemberAuthor
  8. added this to the Backlog milestone on Apr 29, 2021
  9. metalshanked commented on Jun 4, 2021

    @metalshanked

    @jsjoeio Will there be an option to disable file uploads as well ? Example:- To disable people uploading their own .vsix file and installing them manually.

  10. jsjoeio commented on Jun 7, 2021

    @jsjoeio
    Contributor

    I think we could definitely consider it!

    If it's a global thing, like download scenario, then it might be possible to implement here as well.

    To disable people uploading their own .vsix file and installing them manually.

    For that specific use case, we could potentially add that.

    It might help if you could expand on your use case (then we can see if it fits in this issue or should be a separate issue).

  11. metalshanked commented on Jun 8, 2021

    @metalshanked

    I think we could definitely consider it!

    If it's a global thing, like download scenario, then it might be possible to implement here as well.

    To disable people uploading their own .vsix file and installing them manually.

    For that specific use case, we could potentially add that.

    It might help if you could expand on your use case (then we can see if it fits in this issue or should be a separate issue).

    Thanks @jsjoeio. Yes, a global disable upload option would be awesome. The use case is similar to the original requester's disable download request. For Eg:- use cases where we want to disable certain users from uploading files to the code-server (running on Docker) so that they can only operate on the files and items preloaded into the container and nothing external can be uploaded (or downloaded)

  12. jsjoeio commented on Jun 8, 2021

    @jsjoeio
    Contributor

    Ahh okay. Thank you for elaborating! Sounds very similar in which case we can keep here in this issue :)

  13. songhanpoo commented on Oct 11, 2021

    @songhanpoo

    Hi everyone, currently can i use these options ?
    Do i need compile from src ?

  14. 2 remaining items

  15. songhanpoo commented on Oct 28, 2021

    @songhanpoo

    Looking forward to this feature which is can be use for external developer. intergrate LDAP login and code on web. no leak code.

    hopeful anyone improve about that

  16. self-assigned this
    on Mar 2, 2022
  17. greyscaled commented on Mar 12, 2022

    @greyscaled
    Contributor

    [sc-16496]

  18. modified the milestones: March 2022, April 2022 on Mar 22, 2022
  19. jsjoeio commented on Mar 30, 2022

    @jsjoeio
    Contributor

    Seems like all we need to do is:

    1. create new context key like: ContextKeyExpr.and(IsWebContext, HasDownloadFileEnabled)
    2. write expression that returns true by default, or false if CLI flag --disable-file-downloads or something

    Might be worth looking into writing e2e tests.

    Without CLI flag, should show Download File in menu.
    WIth CLI flag, should not show Download File in menu.

  20. modified the milestones: April 2022, 4.3.0 on Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

featureNew user visible featurehigh-priorityThis issue needs to be resolved ASAPsecuritySecurity related

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions