|
1 | 1 | ---
|
2 | 2 | title: Secure code best practices
|
3 | 3 | titleSuffix: Azure Machine Learning
|
4 |
| -description: Learn about potential security threats that may exist when developing for Azure Machine Learning, mitigations, and best practices. |
| 4 | +description: Learn about potential security threats that exist when developing for Azure Machine Learning, mitigations, and best practices. |
5 | 5 | services: machine-learning
|
6 | 6 | ms.service: machine-learning
|
7 | 7 | ms.subservice: enterprise-readiness
|
8 | 8 | ms.topic: conceptual
|
9 | 9 | ms.author: larryfr
|
10 | 10 | author: Blackmist
|
11 | 11 | ms.reviewer: deeikele
|
12 |
| -ms.date: 03/11/2024 |
| 12 | +ms.date: 04/02/2024 |
13 | 13 | ---
|
14 | 14 |
|
15 |
| -# Secure code best practices with Azure Machine Learning |
| 15 | +# Best practices for secure code |
16 | 16 |
|
17 |
| -In Azure Machine Learning, you can upload files and content from any source into Azure. Content within Jupyter notebooks or scripts that you load can potentially read data from your sessions, access data within your organization in Azure, or run malicious processes on your behalf. |
| 17 | +In Azure Machine Learning, you can upload files and content from any source into Azure. Content within Jupyter notebooks or scripts that you load can potentially read data from your sessions, access sensitive data within your organization in Azure, or run malicious processes on your behalf. |
18 | 18 |
|
19 | 19 | > [!IMPORTANT]
|
20 | 20 | > Only run notebooks or scripts from trusted sources. For example, where you or your security team have reviewed the notebook or script.
|
21 | 21 |
|
22 | 22 | ## Potential threats
|
23 | 23 |
|
24 |
| -Development with Azure Machine Learning often involves web-based development environments (Notebooks & Azure Machine Learning studio). When you use web-based development environments, the potential threats are: |
| 24 | +Development with Azure Machine Learning often involves web-based development environments, such as notebooks or the Azure Machine Learning studio. When you use web-based development environments, the potential threats are: |
25 | 25 |
|
26 |
| -* [Cross site scripting (XSS)](https://owasp.org/www-community/attacks/xss/) |
| 26 | +* [Cross-site scripting (XSS)](https://owasp.org/www-community/attacks/xss/) |
27 | 27 |
|
28 | 28 | * __DOM injection__: This type of attack can modify the UI displayed in the browser. For example, by changing how the run button behaves in a Jupyter Notebook.
|
29 |
| - * __Access token/cookies__: XSS attacks can also access local storage and browser cookies. Your Microsoft Entra authentication token is stored in local storage. An XSS attack could use this token to make API calls on your behalf, and then send the data to an external system or API. |
| 29 | + * __Access token or cookies__: XSS attacks can also access local storage and browser cookies. Your Microsoft Entra authentication token is stored in local storage. An XSS attack could use this token to make API calls on your behalf, and then send the data to an external system or API. |
30 | 30 |
|
31 |
| -* [Cross site request forgery (CSRF)](https://owasp.org/www-community/attacks/csrf): This attack may replace the URL of an image or link with the URL of a malicious script or API. When the image is loaded, or link clicked, a call is made to the URL. |
| 31 | +* [Cross-site request forgery (CSRF)](https://owasp.org/www-community/attacks/csrf): This attack could replace the URL of an image or link with the URL of a malicious script or API. When the image is loaded, or link clicked, a call is made to the URL. |
32 | 32 |
|
33 | 33 | ## Azure Machine Learning studio notebooks
|
34 | 34 |
|
35 |
| -Azure Machine Learning studio provides a hosted notebook experience in your browser. Cells in a notebook can output HTML documents or fragments that contain malicious code. When the output is rendered, the code can be executed. |
| 35 | +Azure Machine Learning studio provides a hosted notebook experience in your browser. Cells in a notebook can output HTML documents or fragments that contain malicious code. When the output is rendered, the code can be executed. |
36 | 36 |
|
37 | 37 | __Possible threats__:
|
38 |
| -* Cross site scripting (XSS) |
39 |
| -* Cross site request forgery (CSRF) |
| 38 | +* Cross-site scripting (XSS) |
| 39 | +* Cross-site request forgery (CSRF) |
40 | 40 |
|
41 | 41 | __Mitigations provided by Azure Machine Learning__:
|
42 | 42 | * __Code cell output__ is sandboxed in an iframe. The iframe prevents the script from accessing the parent DOM, cookies, or session storage.
|
43 | 43 | * __Markdown cell__ contents are cleaned using the dompurify library. This blocks malicious scripts from executing with markdown cells are rendered.
|
44 |
| -* __Image URL__ and __Markdown links__ are sent to a Microsoft owned endpoint, which checks for malicious values. If a malicious value is detected, the endpoint rejects the request. |
| 44 | +* __Image URL__ and __markdown links__ are sent to a Microsoft-owned endpoint, which checks for malicious values. If a malicious value is detected, the endpoint rejects the request. |
45 | 45 |
|
46 | 46 | __Recommended actions__:
|
47 |
| -* Verify that you trust the contents of files before uploading to studio. When uploading, you must acknowledge that you're uploading trusted files. |
48 |
| -* When selecting a link to open an external application, you'll be prompted to trust the application. |
| 47 | +* Verify that you trust the contents of files before uploading to the studio. You must acknowledge that you're uploading trusted files. |
| 48 | +* When selecting a link to open an external application, you're prompted to trust the application. |
49 | 49 |
|
50 | 50 | ## Azure Machine Learning compute instance
|
51 | 51 |
|
52 |
| -Azure Machine Learning compute instance hosts __Jupyter__ and __Jupyter Lab__. When you use either, cells in a notebook or code in can output HTML documents or fragments that contain malicious code. When the output is rendered, the code can be executed. The same threats also apply when you use __RStudio__ and __Posit Workbench (formerly RStudio Workbench)__ hosted on a compute instance. |
| 52 | +Azure Machine Learning compute instance hosts Jupyter and JupyterLab. When you use either, code inside notebook cells can output HTML documents or fragments that contain malicious code. When the output is rendered, the code can be executed. The same threats apply when you use RStudio or Posit Workbench (formerly RStudio Workbench) hosted on a compute instance. |
53 | 53 |
|
54 | 54 | __Possible threats__:
|
55 |
| -* Cross site scripting (XSS) |
56 |
| -* Cross site request forgery (CSRF) |
| 55 | +* Cross-site scripting (XSS) |
| 56 | +* Cross-site request forgery (CSRF) |
57 | 57 |
|
58 | 58 | __Mitigations provided by Azure Machine Learning__:
|
59 |
| -* None. Jupyter and Jupyter Lab are open-source applications hosted on the Azure Machine Learning compute instance. |
| 59 | +* None. Jupyter and JupyterLab are open-source applications hosted on the Azure Machine Learning compute instance. |
60 | 60 |
|
61 | 61 | __Recommended actions__:
|
62 |
| -* Verify that you trust the contents of files before uploading to studio. When uploading, you must acknowledge that you're uploading trusted files. |
| 62 | +* Verify that you trust the contents of files before uploading. You must acknowledge that you're uploading trusted files. |
63 | 63 |
|
64 |
| -## Report security issues or concerns |
| 64 | +## Report security issues or concerns |
65 | 65 |
|
66 | 66 | Azure Machine Learning is eligible under the Microsoft Azure Bounty Program. For more information, visit [https://www.microsoft.com/msrc/bounty-microsoft-azure](https://www.microsoft.com/msrc/bounty-microsoft-azure).
|
67 | 67 |
|
68 |
| -## Next steps |
| 68 | +## Related content |
69 | 69 |
|
70 |
| -* [Enterprise security for Azure Machine Learning](concept-enterprise-security.md) |
| 70 | +* [Enterprise security and governance for Azure Machine Learning](concept-enterprise-security.md) |
0 commit comments