(ns vulnerable-1
  (:require [clojure.xml :as xml]))

(defn startparse-sax-no-doctype [s ch]
  (..
    (doto (javax.xml.parsers.SAXParserFactory/newInstance)
      (.setFeature "-doctype-decl" true)
      (.setFeature "-general-entities" false)
      (.setFeature "-parameter-entities" false))
    (newSAXParser)
    (parse s ch)))

(def not-vulnerable [input]
  (clojure.xml/parse input startparse-sax-no-doctype))

(ns vulnerable-1
  (:require [clojure.xml :as xml]))

(defn startparse-sax-no-doctype [s ch]
  (..
    (doto (javax.xml.parsers.SAXParserFactory/newInstance)
      (.setFeature "-doctype-decl" true)
      (.setFeature "-general-entities" false)
      (.setFeature "-parameter-entities" false))
    (newSAXParser)
    (parse s ch)))

(def not-vulnerable [input]
  (clojure.xml/parse input startparse-sax-no-doctype))
