Skip to content

[vulnops][misc] fix: Add allowlist validation for _target_ instantiation#3142

Draft
yaoyu-33 wants to merge 1 commit intomainfrom
security/fix-yaml-target-injection
Draft

[vulnops][misc] fix: Add allowlist validation for _target_ instantiation#3142
yaoyu-33 wants to merge 1 commit intomainfrom
security/fix-yaml-target-injection

Conversation

@yaoyu-33
Copy link
Copy Markdown
Contributor

@yaoyu-33 yaoyu-33 commented Apr 3, 2026

Summary

  • Add _ALLOWED_TARGET_PREFIXES allowlist (megatron., torch., nvidia., transformers., numpy., nemo.) to restrict which modules can be instantiated via _target_ in YAML configs
  • Add register_allowed_target_prefix() API so users can extend the allowlist for their use cases
  • Validate target strings before import/resolution, preventing arbitrary code execution via malicious configs (e.g., _target_: os.system)

Test plan

  • Verify existing configs with allowed prefixes still instantiate correctly
  • Verify malicious targets (e.g., os.system, subprocess.run) are rejected
  • Verify register_allowed_target_prefix() works for extending the allowlist
  • Run instantiation unit tests

🤖 Generated with Claude Code

…event arbitrary code execution

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot bot commented Apr 3, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@yaoyu-33 yaoyu-33 changed the title [misc] fix: Add allowlist validation for _target_ instantiation [vulnops][misc] fix: Add allowlist validation for _target_ instantiation Apr 3, 2026
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.

1 participant