Skip to content

Comments

Unknown field now generates a warning#46

Merged
spaze merged 1 commit intomainfrom
spaze/unknown-fields-warning
Dec 7, 2025
Merged

Unknown field now generates a warning#46
spaze merged 1 commit intomainfrom
spaze/unknown-fields-warning

Conversation

@spaze
Copy link
Owner

@spaze spaze commented Dec 7, 2025

If the file is signed with GPG, then the Hash: header and all other Armor Headers of the OpenPGP format up until a separator (an empty line) are not flagged as unknown fields.

Close #41

If the file is signed with GPG, then the `Hash:` header is not flagged as an unknown field.

Close #41
Copilot AI review requested due to automatic review settings December 7, 2025 03:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements unknown field warnings for security.txt files and properly handles OpenPGP armor headers in signed files, addressing issue #41. Unknown fields now generate warnings instead of being silently ignored, while armor headers (like Hash:) in PGP-signed messages are correctly skipped.

Key changes:

  • Introduced SecurityTxtUnknownField violation class to warn about unknown fields
  • Added logic to skip OpenPGP armor headers when processing signed files
  • Updated tests to use valid security.txt fields and added comprehensive tests for signed file handling

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Violations/SecurityTxtUnknownField.php New violation class that generates warnings for unknown fields with clear error messages and fix suggestions
src/Parser/SecurityTxtParser.php Enhanced parser to detect PGP signature headers, skip armor headers until separator, and generate warnings for unknown fields
tests/Parser/SecurityTxtParserTest.phpt Updated test data to use valid security.txt fields (Contact, Hiring) instead of placeholders (Foo, Bar), added tests for unknown field warnings and signed file handling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@spaze spaze merged commit 3c22c82 into main Dec 7, 2025
22 checks passed
@spaze spaze deleted the spaze/unknown-fields-warning branch December 7, 2025 03:30
spaze added a commit to spaze/michalspacek.cz that referenced this pull request Dec 16, 2025
Because spaze/security-txt now warns when it sees one
spaze/security-txt#46
spaze added a commit to spaze/michalspacek.cz that referenced this pull request Dec 16, 2025
Because spaze/security-txt now warns when it sees one (spaze/security-txt#46)

Plus
- Update paths to `security.txt` files in the signing script, because files are now served from the app, not by nginx (#642)
- And eventually re-sign the updated `security.txt` files
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.

Warn about unknown directives

1 participant