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

updates to security guidelines and docker config #2669

Merged
merged 8 commits into from
Oct 4, 2023

Conversation

agunapal
Copy link
Collaborator

@agunapal agunapal commented Oct 3, 2023

Description

Update Security guidelines for using TorchServe

Fixes #(issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Feature/Issue validation/testing

Please describe the Unit or Integration tests that you ran to verify your changes and relevant result summary. Provide instructions so it can be reproduced.
Please also list any relevant details for your test configuration.

  • Test A
    Logs for Test A

  • Test B
    Logs for Test B

Checklist:

  • Did you have fun?
  • Have you added tests that prove your fix is effective or that this feature works?
  • Has code been commented, particularly in hard-to-understand areas?
  • Have you made corresponding changes to the documentation?

These ports are accessible to `localhost` by default. The address can be configured by following the [guide](https://github.com/pytorch/serve/blob/master/docs/configuration.md#configure-torchserve-listening-address-and-port)
TorchServe does not prevent users from configuring the address to be `0.0.0.0`. Please be aware of the security risks if you use `0.0.0.0`
2. TorchServe's Docker image is conigured to listen to `localhost` by [default](https://github.com/pytorch/serve/blob/master/docker/config.properties)

Copy link
Member

Choose a reason for hiding this comment

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

also mention that torchserve can run arbitrary python files so don't download mar files you don't trust from the internet

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@msaroufim msaroufim Oct 3, 2023

Choose a reason for hiding this comment

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

the updated language is good but please explicitly also mention that torchserve executes arbitrary python files when running a mar file, the risk is not just in downloading. There's a risk in downloading, unzipping and finally running

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Got it. So, how do they verify it? We should mention that too

Copy link
Member

Choose a reason for hiding this comment

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

There is no generic way to verify if a piece of python code is safe, they key is that it needs to be code from a source they trust

@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

Merging #2669 (9d29cef) into master (7b36a5d) will not change coverage.
The diff coverage is n/a.

❗ Current head 9d29cef differs from pull request most recent head 05c941e. Consider uploading reports for the commit 05c941e to get more accurate results

@@           Coverage Diff           @@
##           master    #2669   +/-   ##
=======================================
  Coverage   71.34%   71.34%           
=======================================
  Files          85       85           
  Lines        3905     3905           
  Branches       58       58           
=======================================
  Hits         2786     2786           
  Misses       1115     1115           
  Partials        4        4           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@agunapal agunapal changed the title (WIP)updates to security guidelines and docker config updates to security guidelines and docker config Oct 3, 2023
@agunapal agunapal requested a review from lxning October 3, 2023 23:05
SECURITY.md Outdated Show resolved Hide resolved
@msaroufim msaroufim self-requested a review October 3, 2023 23:36
@msaroufim msaroufim added this pull request to the merge queue Oct 4, 2023
Merged via the queue into master with commit 88a19de Oct 4, 2023
11 of 12 checks passed
@agunapal agunapal deleted the docs/update_security_guidelines branch October 4, 2023 16:25
Comment on lines +27 to +30
3. Be sure to validate the authenticity of the `.mar` file being used with TorchServe.
1. A `.mar` file being downloaded from the internet from an untrusted source may have malicious code, compromising the integrity of your application
2. TorchServe executes arbitrary python code packaged in the `mar` file. Make sure that you've either audited that the code you're using is safe and/or is from a source that you trust

Copy link
Collaborator

Choose a reason for hiding this comment

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

archiver can support mar, tgz and folder. we can make it more generic at this section to let cx know they are responsible for the security of the code in model artifacts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants