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

意図しないディレクトリ・ファイル露出のテスト #5112

Merged
merged 3 commits into from Aug 24, 2021

Conversation

kiy0taka
Copy link
Contributor

@kiy0taka kiy0taka commented Aug 17, 2021

概要(Overview・Refs Issue)

セキュリティチェックシート の「意図しないディレクトリ・ファイルの露出」に対するテストを追加。

方針(Policy)

実装に関する補足(Appendix)

GitHub ActionsではパッケージングしてApacheにデプロイしたものに対してCodeceptionを実行しています。

テスト(Test)

相談(Discussion)

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

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

レビュワー確認項目

  • 動作確認
  • コードレビュー
  • E2E/Unit テスト確認(テストの追加・変更が必要かどうか)
  • 互換性が保持されているか
  • セキュリティ上の問題がないか

@codecov-commenter
Copy link

codecov-commenter commented Aug 17, 2021

Codecov Report

Merging #5112 (00b507e) into 4.1-beta3 (3c430bf) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           4.1-beta3    #5112   +/-   ##
==========================================
  Coverage      68.17%   68.17%           
==========================================
  Files            457      457           
  Lines          24980    24980           
==========================================
  Hits           17029    17029           
  Misses          7951     7951           
Flag Coverage Δ
tests 68.17% <ø> (ø)

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


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3c430bf...00b507e. Read the comment docs.

@okazy okazy changed the base branch from 4.1-beta3 to 4.1 August 17, 2021 02:33
@okazy okazy changed the base branch from 4.1 to 4.1-beta3 August 17, 2021 02:33
@okazy
Copy link
Contributor

okazy commented Aug 17, 2021

ソースコードを確認して問題ありませんでした。

確認が必要な観点

  • 開発ブランチ
  • テストケースが足りているか
  • 過去の脆弱性が検知できるか
  • パッケージングに問題がないか

補足

  • codeception/module-phpbrowser が PHP7.3 以上

@okazy okazy added the improvement 機能改善 label Aug 17, 2021
@okazy okazy added this to the 4.1 milestone Aug 17, 2021
@nanasess
Copy link
Contributor

プラグインを有効化していないように見えますが、大丈夫でしょうか?

@kiy0taka
Copy link
Contributor Author

初期インストールプラグインを有効化してテストするようにしました。

@okazy
Copy link
Contributor

okazy commented Aug 23, 2021

実行結果詳細

Codeception PHP Testing Framework v4.1.21
Powered by PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
Generating Customers ...........
Generating Products ....................
Generating Orders .................................
  Generating AcceptanceTesterActions...

Acceptance (chrome, local) Tests (4) -----------------------
Modules: REST, PhpBrowser, \Helper\Acceptance, WebDriver, Asserts, MailCatcher
------------------------------------------------------------
Testing acceptance (chrome, local)
CL01DenyCest: Deny files | "varが公開されていないか","var/cache/prod/annotations.map"
Signature: CL01DenyCest:denyFiles
Test: codeception/acceptance/CL01DenyCest.php:denyFiles
Scenario --
 I send get "var/cache/prod/annotations.map"
  [Request] GET http://127.0.0.1:8080/var/cache/prod/annotations.map
  [Request Headers] []
  [Page] http://127.0.0.1:8080/var/cache/prod/annotations.map
  [Response] 403
  [Request Cookies] []
  [Response Headers] {"Date":["Thu, 19 Aug 2021 02:18:42 GMT"],"Server":["Apache/2.4.25 (Debian)"],"X-Frame-Options":["SAMEORIGIN"],"Content-Length":["276"],"Content-Type":["text/html; charset=iso-8859-1"]}
  [Response] <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
  <html><head>
  <title>403 Forbidden</title>
  </head><body>
  <h1>Forbidden</h1>
  <p>You don't have permission to access this resource.</p>
  <hr>
  <address>Apache/2.4.25 (Debian) Server at 127.0.0.1 Port 8080</address>
  </body></html>
  
 I see response code is 403
 PASSED 

CL01DenyCest: Deny files | ".envが公開されていないか",".env"
Signature: CL01DenyCest:denyFiles
Test: codeception/acceptance/CL01DenyCest.php:denyFiles
Scenario --
 I send get ".env"
  [Request] GET http://127.0.0.1:8080/.env
  [Request Headers] []
  [Page] http://127.0.0.1:8080/.env
  [Response] 403
  [Request Cookies] []
  [Response Headers] {"Date":["Thu, 19 Aug 2021 02:18:43 GMT"],"Server":["Apache/2.4.25 (Debian)"],"X-Frame-Options":["SAMEORIGIN"],"Content-Length":["276"],"Content-Type":["text/html; charset=iso-8859-1"]}
  [Response] <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
  <html><head>
  <title>403 Forbidden</title>
  </head><body>
  <h1>Forbidden</h1>
  <p>You don't have permission to access this resource.</p>
  <hr>
  <address>Apache/2.4.25 (Debian) Server at 127.0.0.1 Port 8080</address>
  </body></html>
  
 I see response code is 403
 PASSED 

CL01DenyCest: Deny files | "vendorが公開されていないか","vendor/symfony/config/README.md"
Signature: CL01DenyCest:denyFiles
Test: codeception/acceptance/CL01DenyCest.php:denyFiles
Scenario --
 I send get "vendor/symfony/config/README.md"
  [Request] GET http://127.0.0.1:8080/vendor/symfony/config/README.md
  [Request Headers] []
  [Page] http://127.0.0.1:8080/vendor/symfony/config/README.md
  [Response] 403
  [Request Cookies] []
  [Response Headers] {"Date":["Thu, 19 Aug 2021 02:18:43 GMT"],"Server":["Apache/2.4.25 (Debian)"],"X-Frame-Options":["SAMEORIGIN"],"Content-Length":["276"],"Content-Type":["text/html; charset=iso-8859-1"]}
  [Response] <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
  <html><head>
  <title>403 Forbidden</title>
  </head><body>
  <h1>Forbidden</h1>
  <p>You don't have permission to access this resource.</p>
  <hr>
  <address>Apache/2.4.25 (Debian) Server at 127.0.0.1 Port 8080</address>
  </body></html>
  
 I see response code is 403
 PASSED 

CL01DenyCest: Deny files | "codeceptionが公開されていないか","codeception/acceptance/config.ini"
Signature: CL01DenyCest:denyFiles
Test: codeception/acceptance/CL01DenyCest.php:denyFiles
Scenario --
 I send get "codeception/acceptance/config.ini"
  [Request] GET http://127.0.0.1:8080/codeception/acceptance/config.ini
  [Request Headers] []
  [Page] http://127.0.0.1:8080/codeception/acceptance/config.ini
  [Response] 403
  [Request Cookies] []
  [Response Headers] {"Date":["Thu, 19 Aug 2021 02:18:43 GMT"],"Server":["Apache/2.4.25 (Debian)"],"X-Frame-Options":["SAMEORIGIN"],"Content-Length":["276"],"Content-Type":["text/html; charset=iso-8859-1"]}
  [Response] <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
  <html><head>
  <title>403 Forbidden</title>
  </head><body>
  <h1>Forbidden</h1>
  <p>You don't have permission to access this resource.</p>
  <hr>
  <address>Apache/2.4.25 (Debian) Server at 127.0.0.1 Port 8080</address>
  </body></html>
  
 I see response code is 403
 PASSED 

------------------------------------------------------------
DEPRECATION: 'settings: bootstrap: _bootstrap.php' option is deprecated! Replace it with: 'bootstrap: _bootstrap.php' (not under settings section). See https://bit.ly/2YrRzVc 


Time: 6.26 seconds, Memory: 460.20 MB

OK (4 tests, 4 assertions)

@okazy
Copy link
Contributor

okazy commented Aug 23, 2021

パッケージング結果に、ライブラリ関連以外の差分がないことを確認しました。

.htaccess を無効化して、アクセス制御をした際に検知できることを確認しました。
okazy#96
https://github.com/okazy/ec-cube/runs/3396685374?check_suite_focus=true

@okazy
Copy link
Contributor

okazy commented Aug 23, 2021

@kiy0taka
動作確認して問題ありませんでした。

4.1-beta3 ブランチにプルリクをいただいていますが、こちらの内容は 4.1 ブランチに反映すべき内容かと思います。
現状 4.1 ブランチではプラグイン込みでパッケージングができないんですが、こちらどのように対応するのがよろしいでしょうか?

Copy link
Contributor

@okazy okazy left a comment

Choose a reason for hiding this comment

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

いったん 4.1-beta3 ブランチに取り込み、 4.1 ブランチに取り込めたらと思います。

@okazy okazy merged commit 6dbd050 into EC-CUBE:4.1-beta3 Aug 24, 2021
@okazy
Copy link
Contributor

okazy commented Aug 24, 2021

ありがとうございます。取り込みました。

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

4 participants