Skip to content

Fix parse_security_txt silently truncating data when the footer is missing - #716

Merged
kingsznhone merged 1 commit into
michaelhly:masterfrom
Amadeus-22:fix-security-txt-missing-footer
Oct 22, 2026
Merged

kingsznhone merged 1 commit into
michaelhly:masterfrom
Amadeus-22:fix-security-txt-missing-footer

Conversation

@Amadeus-22

Copy link
Copy Markdown
Contributor

parse_security_txt finds the footer with data.find(footer_bytes, ...) and slices up to the result. When the footer is missing, find() returns -1, so data[start:-1] silently drops the last byte and parsing continues on truncated content instead of reporting that the section is incomplete.

This raises NoSecurityTxtFoundError when the footer is not found, the same error already used when the header is missing.

How tested:

  • New test_parse_security_text_without_footer fails on master and passes with the fix.
  • pytest tests/unit: 140 passed. ruff check and ruff format --check clean.

🤖 Generated with Claude Code

parse_security_txt used data.find() for the footer and sliced up to its
result. When the footer was missing, find() returned -1 and the slice
dropped the last byte of the program data instead of failing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.31%. Comparing base (dc6ad8e) to head (b95259f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #716   +/-   ##
=======================================
  Coverage   95.31%   95.31%           
=======================================
  Files          25       25           
  Lines        1919     1921    +2     
=======================================
+ Hits         1829     1831    +2     
  Misses         90       90           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kingsznhone
kingsznhone merged commit 09dddee into michaelhly:master Oct 22, 2026
9 checks passed
@Amadeus-22
Amadeus-22 deleted the fix-security-txt-missing-footer branch October 23, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants