Skip to content

Add documentation comment warning to only load trusted models#7611

Open
svick wants to merge 1 commit into
dotnet:mainfrom
svick:models-are-untrusted
Open

Add documentation comment warning to only load trusted models#7611
svick wants to merge 1 commit into
dotnet:mainfrom
svick:models-are-untrusted

Conversation

@svick
Copy link
Copy Markdown
Member

@svick svick commented May 22, 2026

ML.NET assumes that loaded models are trusted. We should explicitly document this assumption and warn users not to load untrusted models.

Companion PR to change conceptual docs: dotnet/docs#53999

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds explicit XML documentation warnings across ML.NET model-loading/apply APIs to clarify the security assumption that models must come from trusted sources.

Changes:

  • Added <remarks> warnings to TensorFlow model loading APIs.
  • Added trusted-model warnings to ONNX ApplyOnnxModel overloads.
  • Added trusted-model warnings to core ModelOperationsCatalog.Load* and PredictionEnginePoolBuilder model-source helpers.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Microsoft.ML.TensorFlow/TensorflowCatalog.cs Adds security warning remarks to LoadTensorFlowModel overloads.
src/Microsoft.ML.OnnxTransformer/OnnxCatalog.cs Adds security warning text in <remarks> across ApplyOnnxModel overloads.
src/Microsoft.ML.Data/Model/ModelOperationsCatalog.cs Adds security warning remarks to Load / LoadWithDataLoader APIs.
src/Microsoft.Extensions.ML/Builder/BuilderExtensions.cs Adds security warning remarks to builder methods that source models from URI/file.

/// The name/type of input columns must exactly match name/type of the ONNX model inputs.
/// The name/type of the produced output columns will match name/type of the ONNX model outputs.
/// If the gpuDeviceId value is <see langword="null" /> the <see cref="P:MLContext.GpuDeviceId"/> value will be used if it is not <see langword="null" />.
///
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.59%. Comparing base (4c8b357) to head (46964ee).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7611   +/-   ##
=======================================
  Coverage   69.59%   69.59%           
=======================================
  Files        1484     1484           
  Lines      273606   273606           
  Branches    27949    27949           
=======================================
+ Hits       190408   190410    +2     
+ Misses      75836    75833    -3     
- Partials     7362     7363    +1     
Flag Coverage Δ
Debug 69.59% <ø> (+<0.01%) ⬆️
production 63.84% <ø> (+<0.01%) ⬆️
test 89.63% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...crosoft.Extensions.ML/Builder/BuilderExtensions.cs 22.72% <ø> (ø)
.../Microsoft.ML.Data/Model/ModelOperationsCatalog.cs 53.60% <ø> (ø)
src/Microsoft.ML.OnnxTransformer/OnnxCatalog.cs 58.90% <ø> (ø)
src/Microsoft.ML.TensorFlow/TensorflowCatalog.cs 100.00% <ø> (ø)

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants