route detect
1.0.0

在Web应用程序路由中查找身份验证(AUTHN)和授权(AUTHZ)安全错误:
从koel流服务器路线
Web应用程序HTTP路由AUTHN和AUTHZ错误是当今发现的一些最常见的安全问题。这些行业标准资源强调了问题的严重性:
支持的Web框架(括号中的route-detect ID):
django , django-rest-framework ),烧瓶( flask ),Sanic( sanic ),Fastapi( fastapi )laravel ),Symfony( symfony ),CakePHP( cakephp )rails ),葡萄( grape )jax-rs ),春季( spring )gorilla ),杜松子酒( gin ),chi( chi )express ),React( react ),角( angular )*铁轨支撑是有限的。请参阅此问题以获取更多信息。
使用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命令将semgrep指向正确的Web应用程序规则:
$ 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/