Skip to content

fix: Add input validation to model load #404

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

mattwittwer
Copy link

@mattwittwer mattwittwer commented Jun 30, 2025

What does the PR do?

Simplify the model load command by invoking the python backend stub without shell interpretation. Additionally add checks for invalid characters in provided model names

Checklist

  • PR title reflects the change and is of format <commit_type>: <Title>
  • Changes are described in the pull request.
  • Related issues are referenced.
  • Populated github labels field
  • Added test plan and verified test passes.
  • Verified that the PR passes existing CI.
  • Verified copyright is correct on all changed files.
  • Added succinct git squash message before merging ref.
  • All template sections are filled out.
  • Optional: Additional screenshots for behavior/output changes with before/after.

Commit Type:

Check the conventional commit type
box here and add the label to the github PR.

  • build
  • ci
  • docs
  • feat
  • fix
  • perf
  • refactor
  • revert
  • style
  • test

Related PRs:

Tests for these changes have been added here: triton-inference-server/server#8276

Where should the reviewer start?

The majority of the changes are in the src/stub_launcher.cc
Review the updated flow for building the model load command.

Test plan:

Added testing to: triton-inference-server/server#8276

  • CI Pipeline ID:

31707450

Caveats:

Background

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • closes GitHub issue: #xxx

@mattwittwer mattwittwer added the PR: fix A bug fix label Jun 30, 2025
@mattwittwer mattwittwer self-assigned this Jun 30, 2025
@mattwittwer mattwittwer added bug Something isn't working and removed PR: fix A bug fix labels Jul 1, 2025
@mattwittwer mattwittwer changed the title draft: add input validation to model load fix: add input validation to model load Jul 16, 2025
@mattwittwer mattwittwer changed the title fix: add input validation to model load fix: Add input validation to model load Jul 16, 2025
@mattwittwer mattwittwer requested review from yinggeh and pskiran1 July 16, 2025 18:50
src/pb_utils.cc Outdated
bool
IsValidIdentifier(const std::string& input)
{
if (input.empty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Merge two ifs into one

Copy link
Author

Choose a reason for hiding this comment

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

Updated is statements to simplify into one

// other than 1, it can indicate a permission issue as a result of
// downloading the stub process from a cloud object storage service.
if (WEXITSTATUS(stub_status_code) != 1) {
if (!IsExecutableFile(python_backend_stub)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, what's python_backend_stub file name?

Copy link
Author

@mattwittwer mattwittwer Jul 18, 2025

Choose a reason for hiding this comment

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

In the default container build this resolves to: /opt/tritonserver/backends/python/triton_python_backend_stub
but this can change based on the python_lib_

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants