Skip to content

fix(ai-red-teaming): import get_generator in generated agentic script#101

Merged
rdheekonda merged 1 commit into
mainfrom
fix/agentic-script-imports
Jul 16, 2026
Merged

fix(ai-red-teaming): import get_generator in generated agentic script#101
rdheekonda merged 1 commit into
mainfrom
fix/agentic-script-imports

Conversation

@rdheekonda

Copy link
Copy Markdown
Contributor

Summary

Same class of bug as #100, in a different code path. Generated agentic attack scripts (generate_agentic_attack) call get_generator(...) in the proxy-routing block but _build_agentic_imports never imported it, so every generated agentic script raised NameError: get_generator at runtime. This path was previously untested, so it went unnoticed.

Fix

  • Add from dreadnode.generators.generator import get_generator, GenerateParams to _build_agentic_imports.
  • Add TestAgenticGeneration with a static regression assertion (import + usage present) — compile() only checks syntax, not name resolution.

Scope

Audited all six imports builders. _build_imports, _build_atlas_imports (fixed in #100) and _build_multimodal_imports already import it. _build_image_imports / _build_tabular_imports omit it too, but their generators do NOT include the proxy-routing block (no get_generator usage), so no runtime error — left unchanged to avoid an unused import.

Validation

  • pytest -k "Agentic or Atlas" → 11 passed.
  • Regenerated + ran an agentic campaign against a deployed AWS mesh env → assessment registered + "Attack completed successfully" on dev (previously crashed before any attack).

Same missing-import bug as the ATLAS template (#100), in the separate
`_build_agentic_imports`: generated agentic-attack scripts call
get_generator (proxy-routing block) but never imported it, raising
NameError at runtime. Add the import and a TestAgenticGeneration
regression test (the agentic generator was previously untested).
@rdheekonda
rdheekonda merged commit 9088d7c into main Jul 16, 2026
5 checks passed
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