
Webアプリケーションルートで認証(AUTHN)および認証(AUTHZ)セキュリティバグを見つけます。
koelストリーミングサーバーからのルート
WebアプリケーションHTTPルートAuthnおよびAuthzバグは、今日見られる最も一般的なセキュリティの問題の一部です。これらの業界標準リソースは、問題の重大度を強調しています。
サポートされているWebフレームワーク(括弧内のroute-detect ID):
django 、 django-rest-framework )、Flask( flask )、Sanic( sanic )、Fastapi( fastapi )laravel )、Symfony( symfony )、Cakephp( cakephp )rails )、ブドウ( grape )jax-rs )、春( spring )gorilla )、Gin( gin )、Chi( chi )express )、React( react )、Angular( angular )* Railsサポートは限られています。詳細については、この問題をご覧ください。
pipを使用してroute-detectをインストールします。
$ python -m pip install --upgrade route-detect
route-detect次のコマンドで正しくインストールされていることを確認できます。
$ echo 'print(1 == 1)' | semgrep --config $(routes which test-route-detect) -
Scanning 1 file.
Findings:
/tmp/stdin
routes.rules.test-route-detect
Found '1 == 1', your route-detect installation is working correctly
1┆ print(1 == 1)
Ran 1 rule on 1 file: 1 finding.
route-detect routes CLIコマンドを提供し、 semgrepを使用してルートを検索します。
whichサブコマンドを使用して、正しいWebアプリケーションルールでsemgrep指します。
$ semgrep --config $(routes which django) path/to/django/code
vizサブコマンドを使用して、ブラウザのルート情報を視覚化します。
$ semgrep --json --config $(routes which django) --output routes.json path/to/django/code
$ routes viz --browser routes.json
どのフレームワークを探すかわからない場合は、特別なall IDを使用してすべてを確認できます。
$ semgrep --json --config $(routes which all) --output routes.json path/to/code
カスタムAUTHNまたはAUTHZロジックがある場合は、 route-detectのルールをコピーできます。
$ cp $(routes which django) my-django.yml
次に、必要に応じてルールを変更して、上記のように実行できます。
$ semgrep --json --config my-django.yml --output routes.json path/to/django/code
$ routes viz --browser routes.json
route-detect依存関係と構成管理のためにpoetryを使用します。
先に進む前に、次のコマンドでプロジェクトの依存関係をインストールします。
$ poetry install --with dev
次のコマンドを使用して、すべてのプロジェクトファイルをリントします。
$ poetry run pre-commit run --all-files
次のコマンドでPythonテストを実行します。
$ poetry run pytest --cov
次のコマンドでsemgrepルールテストを実行します。
$ poetry run semgrep --test --config routes/rules/ tests/test_rules/