Skip to content
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

content-typevalid_header_valueチェックを入れる #165

Open
H1rono opened this issue Feb 10, 2024 · 2 comments
Open

content-typevalid_header_valueチェックを入れる #165

H1rono opened this issue Feb 10, 2024 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@H1rono
Copy link
Owner

H1rono commented Feb 10, 2024

機能追加の動機

content_type
.ok_or(ParseError::ContentTypeNotFound)
.map(|ct| ct.starts_with("application/json"))?
.then_some(())
.ok_or(ParseError::ContentTypeMismatch)?;
token
.ok_or(ParseError::BotTokenNotFound)
.and_then(|t| {
valid_header_value(t)
.then_some(t)
.ok_or(ParseError::ReadBotTokenFailed)
})
.map(|t| t == self.verification_token)?
.then_some(())
.ok_or(ParseError::BotTokenMismatch)?;
kind.ok_or(ParseError::BotEventNotFound)
.and_then(|k| {
valid_header_value(k)
.then_some(k)
.ok_or(ParseError::ReadBotEventFailed)
})?
.parse()
.map_err(|_| ParseError::BotEventMismatch)

content_typeだけ入ってないのはおかしい

望ましい解決方法
入れる

他に検討した代替案

補足説明
もし何かあれば

@H1rono H1rono added the enhancement New feature or request label Feb 10, 2024
@H1rono
Copy link
Owner Author

H1rono commented Feb 10, 2024

入れるべきではないかも、ここ読む
https://datatracker.ietf.org/doc/html/rfc9110#field.content-type

@H1rono H1rono added the help wanted Extra attention is needed label Feb 10, 2024
@H1rono
Copy link
Owner Author

H1rono commented Feb 10, 2024

Field values are usually constrained to the range of US-ASCII characters [USASCII].

少なくともUS-ASCIIの確認は入れて良さそう

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant