Check for illegal headers and stop posting.

Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
Thomas Hochstein 2026-02-07 18:48:57 +01:00
parent 41d307a2fe
commit 3801b61d77
2 changed files with 12 additions and 0 deletions

View file

@ -3,6 +3,7 @@ yapfaq 1.1.0 (unreleased)
* --test: Force -o if -n is not set.
* Add conversion script for old status files.
* Accept a posting-frequency of "never", too.
* Check for illegal headers and stop posting, if found.
yapfaq 1.0.1 (2025-01-24)
* Add %t placeholder for Message-ID (feature parity with 0.9).

View file

@ -412,6 +412,17 @@ sub BuildPosting {
return '';
}
# check for illegal headers
my $FoundIllegalHeader = 0;
foreach (qw/Date User-Agent X-Newsreader X-Mailer Injection-Date
Injection-Info NNTP-Posting-Date NNTP-Posting-Host X-Trace/) {
if ($Header{lc($_)}) {
warn "W: $_ header may not be set in '$HeaderFile'.\n";
$FoundIllegalHeader = 1;
}
}
return '' if $FoundIllegalHeader;
# add Date:
push @Headers, 'Date: ' . $TD->strftime('%a, %d %b %Y %H:%M:%S %z') . "\n";
# add missing Message-ID: