Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/models/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,18 @@

std::string custom_library_file_prefix = config_session_options.custom_ops_library.value();

// If relative path, try to resolve using multiple search locations
// Security: reject absolute paths and path traversal to prevent loading arbitrary libraries
fs::path custom_library_path{custom_library_file_prefix};
if (custom_library_path.is_absolute()) {

Check failure on line 641 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-webgpu-x64-build

'is_absolute': is not a member of 'fs::path'

Check failure on line 641 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-cuda-x64-build

'is_absolute': is not a member of 'fs::path'

Check failure on line 641 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-cpu-x64-build

'is_absolute': is not a member of 'fs::path'
throw std::runtime_error("custom_ops_library must be a relative path, got absolute path: " + custom_library_file_prefix);
}
Comment thread
apsonawane marked this conversation as resolved.
Outdated
for (const auto& component : custom_library_path) {

Check failure on line 644 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-webgpu-x64-build

you cannot dereference an operand of type 'int'

Check failure on line 644 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-webgpu-x64-build

'<end>$L1': cannot be used before it is initialized

Check failure on line 644 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-webgpu-x64-build

'<begin>$L1': cannot be used before it is initialized

Check failure on line 644 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-webgpu-x64-build

'end': no matching overloaded function found

Check failure on line 644 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-webgpu-x64-build

'begin': no matching overloaded function found

Check failure on line 644 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-cuda-x64-build

you cannot dereference an operand of type 'int'

Check failure on line 644 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-cuda-x64-build

'<end>$L1': cannot be used before it is initialized

Check failure on line 644 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-cuda-x64-build

'<begin>$L1': cannot be used before it is initialized

Check failure on line 644 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-cuda-x64-build

'end': no matching overloaded function found

Check failure on line 644 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-cuda-x64-build

'begin': no matching overloaded function found

Check failure on line 644 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-cpu-x64-build

you cannot dereference an operand of type 'int'

Check failure on line 644 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-cpu-x64-build

'<end>$L1': cannot be used before it is initialized

Check failure on line 644 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-cpu-x64-build

'<begin>$L1': cannot be used before it is initialized

Check failure on line 644 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-cpu-x64-build

'end': no matching overloaded function found

Check failure on line 644 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-cpu-x64-build

'begin': no matching overloaded function found
if (component == "..") {

Check failure on line 645 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-webgpu-x64-build

'==': no conversion from 'const char

Check warning on line 645 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-webgpu-x64-build

'==': logical operation on address of string constant

Check failure on line 645 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-cuda-x64-build

'==': no conversion from 'const char

Check warning on line 645 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-cuda-x64-build

'==': logical operation on address of string constant

Check failure on line 645 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-cpu-x64-build

'==': no conversion from 'const char

Check warning on line 645 in src/models/model.cpp

View workflow job for this annotation

GitHub Actions / windows-cpu-x64-build

'==': logical operation on address of string constant
throw std::runtime_error("custom_ops_library must not contain path traversal (..): " + custom_library_file_prefix);
}
}

// If relative path, try to resolve using multiple search locations
if (custom_library_path.is_relative()) {
bool resolved = false;

Expand Down
Loading