-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Addressed CVE-2022-38752 snakeyaml vulnerability (#7)
* Addressed CVE-2022-38752 snakeyaml vulnerability * Addressed David Ongaro's feedback
- Loading branch information
1 parent
fdbfdf8
commit 9898849
Showing
9 changed files
with
48 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,27 @@ | ||
(ns uap-clj.common-spec) | ||
(ns uap-clj.common-spec | ||
(:require [clojure.java.io :as io :refer [resource]] | ||
[clj-yaml.core :refer [parse-string]]) | ||
(:import [org.yaml.snakeyaml LoaderOptions])) | ||
|
||
(def unknown-ua "Unknown new useragent in the wild/v0.1.0") | ||
(def ^:const unknown-ua "Unknown new useragent in the wild/v0.1.0") | ||
|
||
(defn default-codepoint-limit | ||
[] | ||
(let [options (LoaderOptions.)] | ||
(.getCodePointLimit options))) | ||
|
||
(defn snakeyaml-loader-options | ||
^LoaderOptions [n] | ||
(let [options (LoaderOptions.)] | ||
(.setCodePointLimit options n) | ||
options)) | ||
|
||
(defn load-fixture | ||
[f] | ||
(let [raw-file (slurp (io/resource f)) | ||
file-size (count raw-file)] | ||
(if (>= file-size (default-codepoint-limit)) | ||
(:test_cases | ||
(with-redefs [clj-yaml.core/default-loader-options #(snakeyaml-loader-options file-size)] | ||
(parse-string raw-file))) | ||
(:test_cases (parse-string raw-file))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters