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

Update security documentation to include security scanning tools #3084

Merged
merged 5 commits into from
Apr 17, 2024

Conversation

namannandan
Copy link
Collaborator

@namannandan namannandan commented Apr 11, 2024

Description

Include security scanning tools in security documentation

Clamd: https://pypi.org/project/clamd/
VirusTotal: https://virustotal.github.io/vt-py/
Fickling: https://github.com/trailofbits/fickling

Link security documentation from the main Readme.

Fixes: #3065

Type of change

  • Documentation update

- `use_env_allowed_urls=true` is required in config.properties to read `allowed_urls` from environment variable
1. A `.mar` file being downloaded from the internet from an untrustworthy 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.
3. Torchserve supports custom [plugins](https://github.com/pytorch/serve/tree/master/plugins) and [handlers](https://github.com/pytorch/serve/blob/master/docs/custom_service.md).
Copy link
Member

Choose a reason for hiding this comment

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

Are we using these plugins?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Plugins are not loaded by default but can be enabled by configuring the plugins_path and placing the plugin JAR in that path. For example, this is how the token authorization is implemented: https://github.com/pytorch/serve/blob/master/docs/token_authorization_api.md

Source code: https://github.com/pytorch/serve/blob/master/plugins/endpoints/src/main/java/org/pytorch/serve/plugins/endpoint/Token.java

msaroufim
msaroufim previously approved these changes Apr 16, 2024
- `use_env_allowed_urls=true` is required in config.properties to read `allowed_urls` from environment variable
1. A `.mar` file being downloaded from the internet from an untrustworthy 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.
3. Torchserve supports custom [plugins](https://github.com/pytorch/serve/tree/master/plugins) and [handlers](https://github.com/pytorch/serve/blob/master/docs/custom_service.md).
Copy link
Collaborator

@agunapal agunapal Apr 16, 2024

Choose a reason for hiding this comment

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

Its not clear what the suggestion is in 3). Could you please elaborate

Copy link
Collaborator Author

@namannandan namannandan Apr 17, 2024

Choose a reason for hiding this comment

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

The goal is to show that a custom TorchServe security scanning plugin can be created which makes use of existing tools such as clamd, virstotal and fickling. For example, it could be an endpoint plugin which:

  1. Accepts a model archive name or url as input
  2. Scans the model archive contents for security issues
  3. Places model archive in model store only once security scanning has passed

The above is just an example of functionality that an endpoint plugin can provide but can be customized based on the runtime security scanning requirements.

Copy link
Collaborator

@agunapal agunapal left a comment

Choose a reason for hiding this comment

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

LGTM

@namannandan namannandan added this pull request to the merge queue Apr 17, 2024
Merged via the queue into pytorch:master with commit 953f252 Apr 17, 2024
12 of 13 checks passed
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.

improve security doc for model security check
3 participants