Interface IncludeResolver
- All Known Implementing Classes:
ClasspathIncludeResolver, FileSystemIncludeResolver
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Interface for resolving mj-include paths to content. Implementations can resolve from the file
system, classpath, HTTP, etc.
Security warning: Implementations that resolve paths over HTTP or other
network protocols are vulnerable to Server-Side Request Forgery (SSRF) attacks. An attacker who
controls MJML input could use <mj-include> to probe internal network resources.
HTTP-based resolvers should validate and restrict allowed hosts/URLs.
-
Method Summary
Modifier and TypeMethodDescriptionresolve(String path, ResolverContext context) Resolves the given path to its content.
-
Method Details
-
resolve
Resolves the given path to its content.Security note: Implementations should validate paths to prevent directory traversal attacks (e.g., paths containing "../" sequences).
- Parameters:
path- the include path from the mj-include elementcontext- metadata about the include chain (including path, type, depth)- Returns:
- the resolved content string
- Throws:
MjmlException- if the path cannot be resolved
-