-
Notifications
You must be signed in to change notification settings - Fork 883
updates to security guidelines and docker config #2669
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3e82a3c
updates to security guidelines and docker config
agunapal 810e723
updates to security guidelines and docker config
agunapal 73b2acc
updates to security guidelines and docker config
agunapal 7d15438
updates to security guidelines and docker config
agunapal c777bf9
updates to security guidelines
agunapal 851286e
updates to security guidelines
agunapal f4725aa
Update SECURITY.md
msaroufim 05c941e
Merge branch 'master' into docs/update_security_guidelines
lxning File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,23 @@ TorchServe as much as possible relies on automated tools to do security scanning | |
2. Docker Scanning: Using Snyk | ||
3. Code Analysis: Using CodeQL | ||
|
||
## Important Security Guidelines | ||
|
||
1. TorchServe listens on the following ports | ||
1. HTTP - `8080`, `8081`, `8082` | ||
2. gRPC - `7070`, `7071` | ||
|
||
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 configured to expose the ports `8080`, `8081`, `8082`, `7070`, `7071` to the host by default(https://github.com/pytorch/serve/blob/master/docker/Dockerfile). When these ports are mapped to the host, make sure to use `localhost` or a specific ip address. | ||
|
||
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 | ||
|
||
Comment on lines
+27
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
|
||
|
||
|
||
## Reporting a Vulnerability | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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