Skip to content

feat: add GGUF loader for static security analysis#196

Open
GangGreenTemperTatum wants to merge 2 commits intomainfrom
feat/gguf-loader
Open

feat: add GGUF loader for static security analysis#196
GangGreenTemperTatum wants to merge 2 commits intomainfrom
feat/gguf-loader

Conversation

@GangGreenTemperTatum
Copy link
Collaborator

@GangGreenTemperTatum GangGreenTemperTatum commented Feb 24, 2026

Summary

  • Adds a new gguf loader that performs static security analysis of GGUF model files without executing them (no GPU required)
  • Two-layer chat template analysis: regex scanning for known SSTI/obfuscation patterns + Jinja2 AST walking for structural detection of dangerous attribute access, calls, and filters
  • Extracts model metadata (architecture, quantization, context length) and tensor information
  • Addresses the "Poisoned GGUF Templates" attack vector disclosed in mid-2025

Files

| File | Purpose |
|

Generated Summary:

Dyana now includes support for GGUF model files, expanding its functionality for analyzing security issues in chat templates.

  • Updated README to reflect the inclusion of GGUF model files in Dyana's profiling capabilities.
  • Added a new .gitignore for the GGUF loader directory to exclude unnecessary files.
  • Implemented a Dockerfile for the GGUF loader to streamline the setup process.
  • Introduced comprehensive gguf_test.py for testing GGUF loader functionalities and security analysis.
  • Created main.py for the GGUF loader, integrating functions to analyze chat templates and validate GGUF file structures.
  • Added a requirements.txt for the GGUF loader, specifying dependencies for GGUF processing.
  • Included settings.yml for configuration and usage examples of the GGUF loader.

This update enhances the robustness of Dyana by allowing it to work with GGUF files, which is crucial for users dealing with machine learning models and ensuring template security.

This summary was generated with ❤️ by rigging

| dyana/loaders/gguf/main.py | Core analysis: file validation, GGUF parsing, metadata extraction, template security analysis, tensor inspection |
| dyana/loaders/gguf/gguf_test.py | 28 tests covering settings validation, regex detection, AST analysis, sandbox failure handling |
| dyana/loaders/gguf/settings.yml | Loader config: --gguf arg (volume), gpu: false |
| dyana/loaders/gguf/Dockerfile | python:3.12-slim + gguf + jinja2 |
| dyana/loaders/gguf/requirements.txt | gguf==0.17.1, jinja2==3.1.6 |
| README.md | Added GGUF to file types list |

Test plan

  • poetry run ruff check dyana — lint clean
  • poetry run pytest dyana -v — 189 tests pass (161 existing + 28 new)
  • dyana loaders — GGUF shows in list (needs Docker)
  • dyana trace --loader gguf --gguf <file> — e2e with real GGUF file (needs Docker)

🤖 Generated with Claude Code

Analyzes GGUF files for malicious chat templates (Poisoned GGUF Templates
attack vector). Uses two-layer detection: regex scanning for known SSTI
patterns and obfuscation, plus Jinja2 AST walking for structural analysis
of dangerous attribute access, calls, and filters. Also extracts model
metadata and tensor information.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dreadnode-renovate-bot dreadnode-renovate-bot bot added type/docs Documentation updates and improvements type/core Changes to core repository files and configurations labels Feb 24, 2026
- Replace single-layer regex scan with two-layer detection: regex for raw
  text patterns + Jinja2 AST walking for structural analysis of dangerous
  attribute access, calls, and filters
- Add view_extra() with GGUF-specific rendering of file structure, model
  metadata, template findings (with severity), and tensor summary
- Wire view_extra() into cli.py summary command
- Fix mypy type annotations throughout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/core Changes to core repository files and configurations type/docs Documentation updates and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant