Tencent/WeKnora · error
stdin injection detected
Error message
stdin injection detected
What it means
Sentinel error ErrStdinInjection returned by the sandbox manager when a script execution result reports that the sandbox detected stdin injection — i.e. the executed script attempted to feed unsanitized input into a command's stdin, which is treated as a security violation. It fires whenever the execution result's Errors contain an injection report; it is a deliberate rejection, not an infrastructure failure.
Source
Thrown at internal/sandbox/sandbox.go:108
// DefaultE2BSandboxTTL matches the E2B SDK's built-in default so an
// unset E2BSandboxTTL still yields a valid sandbox lifetime.
DefaultE2BSandboxTTL = 5 * time.Minute
// DefaultE2BHTTPTimeout bounds a single HTTP call to the E2B API.
DefaultE2BHTTPTimeout = 30 * time.Second
)
// Common errors
var (
ErrSandboxDisabled = errors.New("sandbox is disabled")
ErrTimeout = errors.New("execution timed out")
ErrScriptNotFound = errors.New("script not found")
ErrInvalidScript = errors.New("invalid script")
ErrExecutionFailed = errors.New("script execution failed")
ErrSecurityViolation = errors.New("security validation failed")
ErrDangerousCommand = errors.New("script contains dangerous command")
ErrArgInjection = errors.New("argument injection detected")
ErrStdinInjection = errors.New("stdin injection detected")
)
// Sandbox defines the interface for isolated script execution
type Sandbox interface {
// Execute runs a script in an isolated environment
Execute(ctx context.Context, config *ExecuteConfig) (*ExecuteResult, error)
// Cleanup releases sandbox resources
Cleanup(ctx context.Context) error
// Type returns the sandbox type
Type() SandboxType
// IsAvailable checks if the sandbox is available for use
IsAvailable(ctx context.Context) bool
}
// Manager provides a unified interface for sandbox operationsView on GitHub (pinned to 988cbb0330)
Solutions
- Reject the request and surface the error to the caller without retrying, since the script content itself violates the stdin policy
- Sanitize or remove stdin redirection/piping of untrusted input in the submitted script before resubmitting
- Log the offending script and tenant/session identifiers for security audit
- If the injection flag is a false positive, adjust the script to read arguments or files instead of stdin
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/sandbox/sandbox.go:108 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/1ff860def49870cd.
Report an issue: GitHub.