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

アップロードファイル名の拡張子が複数ある場合に最後のものだけを残す #5697

Closed
wants to merge 1 commit into from

Conversation

pineray
Copy link
Contributor

@pineray pineray commented Aug 29, 2022

概要(Overview・Refs Issue)

アップロードファイル名の拡張子が複数ある場合(例:hoge.fuga.txt)に、最後のものだけを残して他の途中の拡張子を削除する(例:hoge.txt)

マイナーバージョン互換性保持のための制限事項チェックリスト

  • 既存機能の仕様変更はありません
  • フックポイントの呼び出しタイミングの変更はありません
  • フックポイントのパラメータの削除・データ型の変更はありません
  • twigファイルに渡しているパラメータの削除・データ型の変更はありません
  • Serviceクラスの公開関数の、引数の削除・データ型の変更はありません
  • 入出力ファイル(CSVなど)のフォーマット変更はありません

レビュワー確認項目

  • 動作確認
  • コードレビュー
  • E2E/Unit テスト確認(テストの追加・変更が必要かどうか)
  • 互換性が保持されているか
  • セキュリティ上の問題がないか
    • 権限を超えた操作が可能にならないか
    • 不要なファイルアップロードがないか
    • 外部へ公開されるファイルや機能の追加ではないか
    • テンプレートでのエスケープ漏れがないか

@codecov-commenter
Copy link

Codecov Report

Merging #5697 (a5d4bca) into 4.2 (90f19be) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##                4.2    #5697      +/-   ##
============================================
- Coverage     78.74%   78.74%   -0.01%     
- Complexity     6269     6270       +1     
============================================
  Files           468      468              
  Lines         21024    21027       +3     
============================================
+ Hits          16556    16557       +1     
- Misses         4468     4470       +2     
Flag Coverage Δ
E2E 64.69% <66.66%> (-0.02%) ⬇️
Unit 77.48% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...Eccube/Controller/Admin/Content/FileController.php 85.03% <100.00%> (+0.17%) ⬆️
src/Eccube/Entity/TaxRule.php 85.18% <0.00%> (-1.24%) ⬇️
...ontroller/Admin/Product/ProductClassController.php 90.28% <0.00%> (-0.58%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@chihiro-adachi
Copy link
Contributor

@pineray
tar.gzのような正規のファイルも拡張子変わってしまいませんか?

@pineray
Copy link
Contributor Author

pineray commented Aug 31, 2022

@chihiro-adachi
変わります
なので、どこまでを許すか、というポリシーの問題となります
多重拡張子を許可するのであれば、html ディレクトリにおけるPHPハンドラーの扱いをもう少し厳格にする必要があります
現在だとサーバーの設定をほぼノールックで、ファイル名の最後が「.php」の場合に動作しないようにしているだけですから

@pineray
Copy link
Contributor Author

pineray commented Aug 31, 2022

PHPハンドラーを厳格化する方針への変更もまた、このスレッドをご覧になっているどなたかが、驚く速さで対応してくださるはず

@chihiro-adachi
Copy link
Contributor

ありがとうございます。
どの種別のファイルをアップロード可能にするかは、許可リスト方式にできればと考えています。
別途Issue立てさせていただきますね。

@chihiro-adachi chihiro-adachi modified the milestones: 4.2.0, 4.2.x Sep 28, 2022
@chihiro-adachi
Copy link
Contributor

許可リスト方式での拡張子制限を実装しました。

#5120
#5867

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

Successfully merging this pull request may close these issues.

None yet

3 participants