Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

RequestValidator.validate incorrectly decodes query string when removing port

オープン
#601 コメント 4 件 リアクション 7 件 担当者 1 名 GitHub で見る

@bhaskar16 がすでに取り組んでいます。

2024年11月18日 から。

  • #823 @bhaskar16 による — オープン
  • #901 @copilot-swe-agent による — オープン

評価

この issue はまだ評価されていません。

説明

status: help wanted TwiDi-InReview type: bug
Issue Summary

When removing the port RequestValidator.validate incorrectly decodes the path, query, and fragment.

e.g.

https://someurl.com:443/somepath?param1=client%3AAnonymous

is converted to

https://someurl.com/somepath?param1=client:Anonymous

https://github.com/twilio/twilio-java/blob/main/src/main/java/com/twilio/security/RequestValidator.java#L145-L147

A suggestion is to consider using getRawPath, getRawQuery, and getRawFragment instead.

Steps to Reproduce
  1. The snippet below demonstrates the issue. The validate output should be the same for both URLs.
Code Snippet
import java.net.URI;
import java.util.HashMap;
import com.twilio.security.RequestValidator;
...
        String url1 = "https://someurl.com/somepath?param1=client%3AAnonymous";
        String url2 = "https://someurl.com:443/somepath?param1=client%3AAnonymous";
        String signature = "PM+bjB+ITJ9a3LIYStKWOTMZMlU=";
        RequestValidator r= new RequestValidator("1234567890");
        System.out.println("valid without port?: " + r.validate(url1, new HashMap<>(), signature));
        System.out.println("valid with port?: " + r.validate(url2, new HashMap<>(), signature));
Exception/Log
valid without port?: true
valid with port?: false
Technical details:
  • twilio-java version: 7.55.3 (latest as of submission)
  • java version: 1.8.0_161
主要言語
Java
スター
529
フォーク
452
平均マージ
1時間 30分
マージ済み PR(30日)
3

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

twilio/twilio-java のほかの issue

twilio/twilio-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。