Skip to content

feat: detect trust_remote_code model loading#57

Merged
ParzivalHack merged 1 commit into
ParzivalHack:mainfrom
ynachiket:ynachiket/add-trust-remote-code-rule-20260601
Jun 2, 2026
Merged

feat: detect trust_remote_code model loading#57
ParzivalHack merged 1 commit into
ParzivalHack:mainfrom
ynachiket:ynachiket/add-trust-remote-code-rule-20260601

Conversation

@ynachiket
Copy link
Copy Markdown
Contributor

Summary

  • add AI206 to flag Hugging Face from_pretrained(..., trust_remote_code=True) model loading
  • add targeted tests for the rule metadata, matcher behavior, and scanner integration when the Rust core is available

Closes #18

Validation

  • /tmp/pyspector-pdlc043-venv/bin/python -m pytest tests/unit/test_ai_rules.py -q -> 2 passed, 2 skipped locally because the PySpector Rust core is not available in this runner
  • /tmp/pyspector-pdlc043-venv/bin/python -m py_compile tests/unit/test_ai_rules.py
  • TOML parse check for src/pyspector/rules/built-in-rules-ai.toml
  • direct AST matcher shape check for trust_remote_code=True vs False
  • git diff --check

@ParzivalHack ParzivalHack added the enhancement New feature or request label Jun 2, 2026
Copy link
Copy Markdown
Owner

@ParzivalHack ParzivalHack left a comment

Choose a reason for hiding this comment

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

Hey @ynachiket, thanks for opening your first PR, we appreciate the contribution! This new rule is a great addition to our current ruleset. I tested it locally and it works great on my end. I require no further edits, merging :)

@ParzivalHack ParzivalHack merged commit eb8d1ea into ParzivalHack:main Jun 2, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Good First Issue: Add a new AI/LLM security rule

2 participants