Skip to content

Commit

Permalink
Merge pull request #19 from eikendev/add-strict-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
eikendev authored Apr 13, 2024
2 parents d6377d5 + b5bbbe6 commit 6613ef3
Show file tree
Hide file tree
Showing 9 changed files with 404 additions and 254 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
# These are backup files generated by rustfmt
**/*.rs.bk

# IntelliJ/RustRover files
.idea/
4 changes: 2 additions & 2 deletions sectxtbin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn stdin(threads: usize) -> impl Stream<Item = String> {
let (mut tx, rx) = channel(threads);

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

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

let options: SecurityTxtOptions = Default::default();
let options: SecurityTxtOptions = SecurityTxtOptions::new(s.strict);

let statuses = stdin(s.threads)
.map(|input| {
Expand Down
4 changes: 4 additions & 0 deletions sectxtbin/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ pub struct Settings {
#[argh(option, default = "3")]
pub timeout: u64,

/// whether to be strict with line endings or more relaxed
#[argh(switch)]
pub strict: bool,

/// only print domains for which the run was successful
#[argh(switch, short = 'q')]
pub quiet: bool,
Expand Down
45 changes: 45 additions & 0 deletions sectxtlib/resources/test/valid_signed/redhat.stxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

# Report any suspected security vulnerability in Red Hat software to Red Hat Product Security at:
Contact: https://access.redhat.com/security/team/contact/
Contact: mailto:secalert@redhat.com
# Report an issue in any Red Hat branded website or online service to Red Hat Information Security
# by following the instructions at:
# https://www.redhat.com/en/trust/RFC-2350

Preferred-Languages: en

# Red Hat Product Security OpenPGP key fingerprint:
# 77E7 9ABE 9367 3533 ED09 EBE2 DCE3 8235 97F5 EAC4
Encryption: https://access.redhat.com/security/data/97f5eac4.txt

# Vulnerability acknowledgments for Red Hat online services:
Acknowledgments: https://access.redhat.com/articles/66234
# Vulnerability acknowledgments for Red Hat offerings are listed on individual CVE pages at:
# https://access.redhat.com/security/security-updates/#/cve

CSAF: https://www.redhat.com/.well-known/csaf/provider-metadata.json

# https://www.cve.org/PartnerInformation/ListofPartners/partner/redhat
CNA: mailto:secalert@redhat.com
CNA: mailto:RootCNA-Coordination@redhat.com

Expires: 2025-03-15T00:00:00.000Z
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJmC9AYAAoJENzjgjWX9erEAbcQAKHhwzlY+ZGre5Z+2CJkDlU8
oYep+JN2C6T1heo6f79thsxXfu5SInLW3QQjiswAS7IzWzpoha/L41HzV2BoyraQ
D++R+4wi7bMhNqhAotDQ58KoKqNPPsY3FM9pthcoGyZNvsODxlzbMwGgUKciyBde
NPIa2z48auHI9raGyWFfT3EA5Vh6sCn2GrquCx+2EPndUR/4rsYak0kCWhXDKsoK
xtpx5Dk7xTFUr7gl1g2wDUb/mx5xkT8OGHagbD1zfKfwdDukNV/8biy5gPdn+xzY
oq1j7j/fcqJko6ALsMf7WzoPJfvC/xLn9czEh3EESLGcTUvA9UTt1Lutk4cMdOd7
+VjdnyGqm7thBd1WqJ2Zx4+7JgQ+qqa1pgo70w63lfzkZCz5Tpin2Gy/+jZSIqPA
2SM0fw3jHbrAa8WHum+aYrgZVDl8JGLpYC6vZfVzysO6jJXT6zdFB/iYYVPDJn9G
Z1zogkrlqLAkTCruoTMeUZkLd6BmMQ8mOy7rB+Fy0W1c55c4i7uR+SpIdLl5ylZl
8t9z0rHbq8oDaoxliN30Xi+kCio7vmwqx+fpJDATY8a8kGqcOpRBaFGGAeLWwcxZ
XvHAhiINI9VINAddGRedtQXEXBAkuzPxL31ej7Xjp+HUaAVtxA53p62/CfqSSJp1
FnQbWMEamIs/PDNIpTEv
=K59c
-----END PGP SIGNATURE-----
5 changes: 4 additions & 1 deletion sectxtlib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ mod tests {
}

fn get_parse_options() -> SecurityTxtOptions {
SecurityTxtOptions { now: now_dt() }
SecurityTxtOptions {
now: now_dt(),
strict: true,
}
}

fn get_tests_dir(category: &str) -> PathBuf {
Expand Down
Loading

0 comments on commit 6613ef3

Please sign in to comment.