Skip to content

fix: validate unsafe file name characters - #132

Open
tipogi wants to merge 2 commits into
mainfrom
fix/header-chars
Open

fix: validate unsafe file name characters#132
tipogi wants to merge 2 commits into
mainfrom
fix/header-chars

Conversation

@tipogi

@tipogi tipogi commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds validation for PubkyAppFile.name to reject characters unsafe for Content-Disposition headers.
  • Rejects ", \, and control characters while preserving Unicode file names.
  • Adds tests for valid names, invalid header-unsafe names, and offending-character error messages.

Test plan

  • cargo test models::file::tests::test_validate_file_name_chars

Closes #131

@tipogi tipogi self-assigned this Jun 12, 2026
@tipogi tipogi added the bug Something isn't working label Jun 12, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30bdaad46f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/limits.rs Outdated
collection_items_max_count: 100,
file_name_min_length: 1,
file_name_max_length: 255,
file_name_invalid_chars: &['"', '\\'],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Export all characters rejected by file validation

Because VALIDATION_LIMITS is documented as the client-side source of truth, clients that consume fileNameInvalidChars will only reject " and \, while PubkyAppFile::validate also rejects every control character via c.is_control(). For names such as file\n.txt or file\0.txt, client-side validation built from these limits will pass data that the model then rejects, so either the exported limits need to include/represent the control-character rule or this field should not be presented as the full invalid-character set.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working schema: file 📄

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: Validate PubkyAppFile.name for HTTP header unsafe characters

1 participant