Skip to content

Commit

Permalink
fix(security): freemarker SSTI vulnerability. (#1402)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby authored Jun 20, 2021
1 parent e72fe21 commit 5539cf1
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static run.halo.app.model.support.HaloConst.OPTIONS_CACHE_KEY;

import freemarker.core.TemplateClassResolver;
import freemarker.template.Configuration;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
Expand Down Expand Up @@ -78,6 +79,7 @@ private Map<String, TemplateModel> freemarkerLayoutDirectives() {

private void initFreemarkerConfig() throws TemplateModelException {
configuration.setSharedVariable("layout", freemarkerLayoutDirectives());
configuration.setNewBuiltinClassResolver(TemplateClassResolver.SAFER_RESOLVER);
}

@EventListener
Expand Down

0 comments on commit 5539cf1

Please sign in to comment.