Favicon of python-kwargs-setattr-security

python-kwargs-setattr-security Skill

AI Agent SkillC++Open source

When reviewing or fixing Python code that uses setattr() with user-controlled kwargs to configure C++ extension objects (SessionOptions, RunOptions, etc.) in ONNX Runtime. Use this to apply the allowlist pattern that prevents arbitrary file writes and other attacks via reflected property access. Published by microsoft in onnxruntime.

What is python-kwargs-setattr-security Skill?

When reviewing or fixing Python code that uses setattr() with user-controlled kwargs to configure C++ extension objects (SessionOptions, RunOptions, etc.) in ONNX Runtime. Use this to apply the allowlist pattern that prevents arbitrary file writes and other attacks via reflected property access. Published by microsoft in onnxruntime. This profile combines repository metadata with install, compatibility, and usage signals so developers can quickly decide whether it fits their agent workflow before opening the source repository.

Trust signal
95/100
Maintenance signal
90/100
Adoption signal
100/100

Automated repository signals based on public metadata such as recency, license, installation evidence, and adoption. These are not a security audit or endorsement.

Key capabilities

  • Includes SKILL.md support
  • Reusable instructions support
  • Security review
  • Security review use cases

Technical details

Copy skill directory
  • Install or run with Copy skill directory

When to use python-kwargs-setattr-security Skill

  • Use it for security review.

Built with

C++Copy skill directory

Editorial notes

Source

  • Creator: microsoft
  • Repository: microsoft/onnxruntime
  • Skill file: .agents/skills/python-kwargs-setattr-security/SKILL.md

What it does

When reviewing or fixing Python code that uses setattr() with user-controlled kwargs to configure C++ extension objects (SessionOptions, RunOptions, etc.) in ONNX Runtime. Use this to apply the allowlist pattern that prevents arbitrary file writes and other attacks via reflected property access.

Skill instructions

Problem Pattern Using hasattr(obj, k) / setattr(obj, k, v) with user-controlled kwargs is insecure. The hasattr check is NOT a security guard — it returns True for ALL exposed properties including dangerous ones. python INSECURE — do not use for k, v in kwargs.items(): if hasattr(options, k): setattr(options, k, v) Fix: Explicit Allowlist Define a module-level frozenset of safe attribute names. Raise RuntimeError for known-but-blocked attrs; silently ignore unknown keys. python Define at module level, before the class ALLOWEDSESSIONOPTIONS = frozenset({ "enablecpumemarena", "enablemempattern", ... only explicitly reviewed safe attrs }) In the method for k, v in kwargs.items(): if k in ALLOWEDSESSIONOPTIONS: setattr(options, k, v) elif hasattr(options, k): reuse the existing instance, don't create new raise RuntimeError( f"SessionOptions attribute '{k}' is not permitted via the backend API. " f"Allowed attributes: {', '.join(sorted(ALLOWEDSESSIONOPTIONS))}" ) else: silently ignore (may

Explore related resources

Frequently asked questions

What is python-kwargs-setattr-security?

python-kwargs-setattr-security is a open-source AI agent skill with Copy skill directory. When reviewing or fixing Python code that uses setattr() with user-controlled kwargs to configure C++ extension objects (SessionOptions, RunOptions, etc.) in ONNX Runtime.

Who is python-kwargs-setattr-security best for?

python-kwargs-setattr-security is best for reusing agent instructions, scripts, and references, security review workflows.

How do I install python-kwargs-setattr-security?

Install or run python-kwargs-setattr-security using Copy skill directory. Check python-kwargs-setattr-security for the latest setup command.

Is python-kwargs-setattr-security actively maintained?

python-kwargs-setattr-security may need a closer maintenance check before production use.

Share:

Stars
21,083
Forks
4,049
Last commit
9 days ago
Repository age
8 years
License
MIT

Auto-fetched from GitHub.

Ad
Favicon

 

  
 

Similar to python-kwargs-setattr-security