-
Notifications
You must be signed in to change notification settings - Fork 37
fix: accept UTF-8 BOM in SKILL.md frontmatter #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
54bd4bf
cb3e5d5
990efbb
8700f81
62b0417
b7b27b1
f25261b
db3fc3e
c4e249d
5ce9931
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ | |
|
|
||
| # Regex pattern for extracting frontmatter between --- markers | ||
| FRONTMATTER_PATTERN = re.compile( | ||
| r"^---[^\S\r\n]*\r?\n(.*?)\r?\n---[^\S\r\n]*(?=\r?\n|\Z)(?:\r?\n)?(.*)", | ||
| r"^\ufeff?---[^\S\r\n]*\r?\n(.*?)\r?\n---[^\S\r\n]*(?=\r?\n|\Z)(?:\r?\n)?(.*)", | ||
| re.DOTALL, | ||
| ) | ||
|
|
||
|
|
@@ -47,7 +47,7 @@ def parse_frontmatter(file_path: Path) -> tuple[ParsedFrontmatter | None, Valida | |
| result = ValidationResult() | ||
|
|
||
| try: | ||
| content = file_path.read_text(encoding="utf-8") | ||
| content = file_path.read_text(encoding="utf-8-sig") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P1] Make security scanning honor BOM-aware frontmatter I took another final review pass and found one remaining issue that should be fixed before merge. This
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch. Frontmatter and quality parsing accept BOM now, but the security scan path still reads the raw first line in _frontmatter_author_emails(). I will wire that through the same BOM-aware read and add LF/CRLF regression coverage next.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed at c4e249d. _scan_file_for_pii now reads with utf-8-sig and _is_frontmatter_delimiter treats a BOM-prefixed opener as valid, so metadata.author emails stay exempt. Added LF and CRLF regression coverage in test_security. |
||
| except Exception as e: | ||
| result.add_error(f"Failed to read {file_path}: {e}") | ||
| return None, result | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.