diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2022-03-05 12:17:54 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2024-11-03 06:12:32 +0100 |
commit | 1a60249cfef4a5afb1d07ce26c2d622ee2838ecf (patch) | |
tree | 4c5507e5711bf599d19a7326581e2a261711c1e4 | |
parent | 25bc6acdfd132a4d67fbba934dc05e5539072a30 (diff) | |
download | haven-1a60249cfef4a5afb1d07ce26c2d622ee2838ecf.tar.gz haven-1a60249cfef4a5afb1d07ce26c2d622ee2838ecf.tar.xz haven-1a60249cfef4a5afb1d07ce26c2d622ee2838ecf.zip |
WIP: Shouldn't allow it in pass-through mode, at minimum.
-rw-r--r-- | hswg/main.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/hswg/main.go b/hswg/main.go index 3c7582e..6afbbd3 100644 --- a/hswg/main.go +++ b/hswg/main.go @@ -81,7 +81,12 @@ func Render(r io.Reader, config *configuration.Configuration) ( // return var doc *types.Document - if doc, err = parser.ParseDocument(pr, config); err == nil { + var preprocessed string + // TODO(p): Ensure that this doesn't pose a security risk. + if preprocessed, err = parser.Preprocess(pr, config); err != nil { + // Render it raw below. + } else if doc, err = parser.ParseDocument( + strings.NewReader(preprocessed), config); err == nil { doctype := config.Attributes.GetAsStringWithDefault( types.AttrDocType, "article") problems, verr := validator.Validate(doc, doctype) |