Conversation
added 2 commits
May 23, 2026 12:55
…ng (CWE-1336 defense-in-depth) Switch all 8 Environment(undefined=StrictUndefined) instantiations across the 7 SDK agent modules that render spec.*_prompt via from_string to ImmutableSandboxedEnvironment. Defense-in-depth against template-injection escalation when an agent spec contains untrusted Jinja2 syntax — relevant to multi-tenant / self-service deployment shapes the project targets. First-party agent specs use only the safe template subset (variable substitution, conditionals, loops, filters), so this is a non-breaking change. Sister AI-agent frameworks (marvin, griptape, pr-agent) recently adopted the same defense for the same class of risk.
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Switch all 8 Jinja2
Environment(undefined=StrictUndefined)instantiations across the 7 SDK agent modules toImmutableSandboxedEnvironment(undefined=StrictUndefined). This is defense-in-depth against template-injection escalation (CWE-1336 / CWE-94) when agent-spec-supplied prompt templates contain untrusted Jinja2 syntax.Background
Eidolon agents declare their prompts in the agent spec (
SqlAgentSpec,SimpleAgentSpec,TotAgentSpec, etc. — all PydanticBaseModels loaded from YAML viayaml.safe_load). The spec values are then fed into Jinja2Environment(undefined=StrictUndefined)and rendered:The same pattern recurs at 8 instantiation sites across 7 files in the SDK:
sdk/eidolon_ai_sdk/agent/simple_agent.pysdk/eidolon_ai_sdk/agent/tot_agent/thought_generators.pysdk/eidolon_ai_sdk/agent/tot_agent/tot_agent.pysdk/eidolon_ai_sdk/agent/tot_agent/checker.pysdk/eidolon_ai_sdk/agent/retriever_agent/hyde_question_transformer.pysdk/eidolon_ai_sdk/agent/retriever_agent/multi_question_transformer.pysdk/eidolon_ai_sdk/agent/sql_agent/agent.pyAll of them render
self.spec.*_prompt(or equivalent) throughfrom_string.Why this matters for an "enterprise-ready deployment server"
Eidolon's README pitches the project as "an enterprise ready, deployment server for Agentic applications" — i.e., a runtime that may host agents declared by parties other than the server operator. In any multi-tenant or self-service-onboarded deployment, the agent spec is effectively user-supplied data, and a malicious spec field like:
…would, with the current vanilla
Environment, achieve remote code execution in the Eidolon process when the agent runs — exfiltrating provider API keys, GitHub tokens, OS environment, etc.ImmutableSandboxedEnvironmentblocks the unsafe attribute access (__init__,__globals__,__class__,__mro__, …) and mutation operations that Jinja2 SSTI primitives rely on, while leaving the safe template feature subset (variable substitution, conditionals, loops, filters) intact. Eidolon's first-party agent specs use only that safe subset, so this is a non-breaking change for current users.Verification
Patch shape
Per file, two lines change:
ImmutableSandboxedEnvironmentis a subclass ofEnvironment, so downstream code that type-checks againstEnvironmentcontinues to work without further changes.Related
PrefectHQ/marvin#1348,griptape-ai/griptape#2183,The-PR-Agent/pr-agent#2408