summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2018-06-28 10:12:30 +0200
committerNeal H. Walfield <neal@pep.foundation>2018-06-28 10:12:30 +0200
commit120e542908c5f9430ea8b42e4bb0c95612025dcb (patch)
tree1c8df5346367f810708d34ef4e88ab6ac6f3a37a
parent1d63e71a839bf68f50cb7f4c1942f0d0b1eccfca (diff)
tool: Add a test for the bug fixed in 1d63e71.
-rw-r--r--tool/Cargo.toml3
-rw-r--r--tool/tests/bad-subkey.rs18
-rw-r--r--tool/tests/data/bad-subkey-keyring.pgpbin0 -> 18064 bytes
-rw-r--r--tool/tests/data/bad-subkey-keyring.txt12
-rw-r--r--tool/tests/data/bad-subkey.txt1
-rw-r--r--tool/tests/data/bad-subkey.txt.sigbin0 -> 310 bytes
6 files changed, 34 insertions, 0 deletions
diff --git a/tool/Cargo.toml b/tool/Cargo.toml
index e2f6cfdf..1266a6c0 100644
--- a/tool/Cargo.toml
+++ b/tool/Cargo.toml
@@ -18,6 +18,9 @@ time = "0.1.38"
[build-dependencies]
clap = "2.27.1"
+[dev-dependencies]
+assert_cli = "0.6"
+
[[bin]]
name = "sq"
path = "src/sq-usage.rs"
diff --git a/tool/tests/bad-subkey.rs b/tool/tests/bad-subkey.rs
new file mode 100644
index 00000000..6a6b7fc7
--- /dev/null
+++ b/tool/tests/bad-subkey.rs
@@ -0,0 +1,18 @@
+extern crate assert_cli;
+
+#[cfg(test)]
+mod integration {
+ use std::path;
+
+ use assert_cli::Assert;
+
+ #[test]
+ fn bad_subkey() {
+ Assert::cargo_binary("sqv")
+ .current_dir(path::Path::new("tests").join("data"))
+ .with_args(&["-r", "bad-subkey-keyring.pgp",
+ "bad-subkey.txt.sig", "bad-subkey.txt"])
+ .stdout().is("8F17 7771 18A3 3DDA 9BA4 8E62 AACB 3243 6300 52D9")
+ .unwrap();
+ }
+}
diff --git a/tool/tests/data/bad-subkey-keyring.pgp b/tool/tests/data/bad-subkey-keyring.pgp
new file mode 100644
index 00000000..72acf4de
--- /dev/null
+++ b/tool/tests/data/bad-subkey-keyring.pgp
Binary files differ
diff --git a/tool/tests/data/bad-subkey-keyring.txt b/tool/tests/data/bad-subkey-keyring.txt
new file mode 100644
index 00000000..d98d157b
--- /dev/null
+++ b/tool/tests/data/bad-subkey-keyring.txt
@@ -0,0 +1,12 @@
+This key keyring contains two keys in the following order: "Justus",
+"Neal".
+
+Justus's key includes all of Neal's subkeys. When Justus's key is
+canonicalized, Neal's subkeys should be dropped.
+
+If an application looks for Neal's signing subkey and either doesn't
+validate the keys or only filters on the unvalidated keys, then it
+will not find the right key.
+
+This was fixed in sqv in commit
+1d63e71a839bf68f50cb7f4c1942f0d0b1eccfca.
diff --git a/tool/tests/data/bad-subkey.txt b/tool/tests/data/bad-subkey.txt
new file mode 100644
index 00000000..257cc564
--- /dev/null
+++ b/tool/tests/data/bad-subkey.txt
@@ -0,0 +1 @@
+foo
diff --git a/tool/tests/data/bad-subkey.txt.sig b/tool/tests/data/bad-subkey.txt.sig
new file mode 100644
index 00000000..65fc578c
--- /dev/null
+++ b/tool/tests/data/bad-subkey.txt.sig
Binary files differ