Skip to content

Commit 6613ef3

Browse files
authored
Merge pull request #19 from eikendev/add-strict-mode
2 parents d6377d5 + b5bbbe6 commit 6613ef3

File tree

9 files changed

+404
-254
lines changed

9 files changed

+404
-254
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@
1010
# These are backup files generated by rustfmt
1111
**/*.rs.bk
1212

13+
# IntelliJ/RustRover files
14+
.idea/

sectxtbin/src/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn stdin(threads: usize) -> impl Stream<Item = String> {
2121
let (mut tx, rx) = channel(threads);
2222

2323
std::thread::spawn(move || {
24-
for line in std::io::stdin().lock().lines().flatten() {
24+
for line in std::io::stdin().lock().lines().map_while(Result::ok) {
2525
loop {
2626
let status = tx.try_send(line.to_owned());
2727

@@ -65,7 +65,7 @@ async fn process_domains(s: &'static Settings) -> (u64, u64) {
6565
.build()
6666
.unwrap();
6767

68-
let options: SecurityTxtOptions = Default::default();
68+
let options: SecurityTxtOptions = SecurityTxtOptions::new(s.strict);
6969

7070
let statuses = stdin(s.threads)
7171
.map(|input| {

sectxtbin/src/settings.rs

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ pub struct Settings {
1111
#[argh(option, default = "3")]
1212
pub timeout: u64,
1313

14+
/// whether to be strict with line endings or more relaxed
15+
#[argh(switch)]
16+
pub strict: bool,
17+
1418
/// only print domains for which the run was successful
1519
#[argh(switch, short = 'q')]
1620
pub quiet: bool,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
-----BEGIN PGP SIGNED MESSAGE-----
2+
Hash: SHA256
3+
4+
# Report any suspected security vulnerability in Red Hat software to Red Hat Product Security at:
5+
Contact: https://access.redhat.com/security/team/contact/
6+
Contact: mailto:secalert@redhat.com
7+
# Report an issue in any Red Hat branded website or online service to Red Hat Information Security
8+
# by following the instructions at:
9+
# https://www.redhat.com/en/trust/RFC-2350
10+
11+
Preferred-Languages: en
12+
13+
# Red Hat Product Security OpenPGP key fingerprint:
14+
# 77E7 9ABE 9367 3533 ED09 EBE2 DCE3 8235 97F5 EAC4
15+
Encryption: https://access.redhat.com/security/data/97f5eac4.txt
16+
17+
# Vulnerability acknowledgments for Red Hat online services:
18+
Acknowledgments: https://access.redhat.com/articles/66234
19+
# Vulnerability acknowledgments for Red Hat offerings are listed on individual CVE pages at:
20+
# https://access.redhat.com/security/security-updates/#/cve
21+
22+
CSAF: https://www.redhat.com/.well-known/csaf/provider-metadata.json
23+
24+
# https://www.cve.org/PartnerInformation/ListofPartners/partner/redhat
25+
CNA: mailto:secalert@redhat.com
26+
CNA: mailto:RootCNA-Coordination@redhat.com
27+
28+
Expires: 2025-03-15T00:00:00.000Z
29+
-----BEGIN PGP SIGNATURE-----
30+
Version: GnuPG v1
31+
32+
iQIcBAEBCAAGBQJmC9AYAAoJENzjgjWX9erEAbcQAKHhwzlY+ZGre5Z+2CJkDlU8
33+
oYep+JN2C6T1heo6f79thsxXfu5SInLW3QQjiswAS7IzWzpoha/L41HzV2BoyraQ
34+
D++R+4wi7bMhNqhAotDQ58KoKqNPPsY3FM9pthcoGyZNvsODxlzbMwGgUKciyBde
35+
NPIa2z48auHI9raGyWFfT3EA5Vh6sCn2GrquCx+2EPndUR/4rsYak0kCWhXDKsoK
36+
xtpx5Dk7xTFUr7gl1g2wDUb/mx5xkT8OGHagbD1zfKfwdDukNV/8biy5gPdn+xzY
37+
oq1j7j/fcqJko6ALsMf7WzoPJfvC/xLn9czEh3EESLGcTUvA9UTt1Lutk4cMdOd7
38+
+VjdnyGqm7thBd1WqJ2Zx4+7JgQ+qqa1pgo70w63lfzkZCz5Tpin2Gy/+jZSIqPA
39+
2SM0fw3jHbrAa8WHum+aYrgZVDl8JGLpYC6vZfVzysO6jJXT6zdFB/iYYVPDJn9G
40+
Z1zogkrlqLAkTCruoTMeUZkLd6BmMQ8mOy7rB+Fy0W1c55c4i7uR+SpIdLl5ylZl
41+
8t9z0rHbq8oDaoxliN30Xi+kCio7vmwqx+fpJDATY8a8kGqcOpRBaFGGAeLWwcxZ
42+
XvHAhiINI9VINAddGRedtQXEXBAkuzPxL31ej7Xjp+HUaAVtxA53p62/CfqSSJp1
43+
FnQbWMEamIs/PDNIpTEv
44+
=K59c
45+
-----END PGP SIGNATURE-----

sectxtlib/src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ mod tests {
3333
}
3434

3535
fn get_parse_options() -> SecurityTxtOptions {
36-
SecurityTxtOptions { now: now_dt() }
36+
SecurityTxtOptions {
37+
now: now_dt(),
38+
strict: true,
39+
}
3740
}
3841

3942
fn get_tests_dir(category: &str) -> PathBuf {

0 commit comments

Comments
 (0)