Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Find authentication (authn) and authorization (authz) security bugs in web application routes.

License

NotificationsYou must be signed in to change notification settings

mschwager/route-detect

Repository files navigation

CIPython VersionsPyPI Version

Find authentication (authn) and authorization (authz) security bugs in web application routes:

Routes demo

Routes fromkoel streaming server

Web application HTTP route authn and authz bugs are some of the most common security issues found today. These industry standard resources highlight the severity of the issue:

Supported web frameworks

LanguageFrameworkSemgrepCodeQL
PythonDjango
PythonDjango REST framework
PythonFlask
PythonSanic
PythonFastAPI
PHPLaravel
PHPSymfony
PHPCakePHP
RubyRails
RubyGrape
JavaJAX-RS
JavaSpring
GoGorilla
GoGin
GoChi
JavaScript/TypeScriptExpress
JavaScript/TypeScriptReact
JavaScript/TypeScriptAngular

Installing

Usepip to installroute-detect:

$ python -m pip install --upgrade route-detect

You can check thatroute-detect is installed correctly with the following command:

$ 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.

Using

route-detect uses theroutes CLI command and provides the following command tree:

  • routes
    • which
    • viz

Semgrep

First, ensure you havesemgrep installed and included on yourPATH.

Important

The Semgrep functionalityroute-detect depends on to display code snippets has been moved behind their cloud app. For more information see#10762. However, earlier versions of Semgrep still support this behavior. When usingroute-detect, make sure to install a version of Semgrep before1.97.0. This can be accomplished with the following command:python -m pip install 'semgrep<1.97.0'.

Use thewhich subcommand to pointsemgrep at the correct web application rules:

$ semgrep --config $(routes which django) path/to/django/code

Use theviz subcommand to visualize route information in your browser:

$ semgrep --json --config $(routes which django) --output routes.json path/to/django/code$ routes viz --browser routes.json

If you're not sure which framework to look for, you can use the specialall ID to check everything:

$ semgrep --json --config $(routes which all) --output routes.json path/to/code

If you have custom authn or authz logic, you can copyroute-detect's rules:

$ cp $(routes which django) my-django.yml

Then you can modify the rule as necessary and run it like above:

$ semgrep --json --config my-django.yml --output routes.json path/to/django/code$ routes viz --browser routes.json

CodeQL

First, ensure you havecodeql installed and included on yourPATH.

Use thewhich subcommand to first install the pack's dependencies, then run the appropriate queries:

$ codeql pack install $(poetry run routes which -c rails)
$ codeql database analyze \    --output routes.sarif \    --format sarif-latest \    --sarif-add-file-contents \    --no-group-results \    -- \    /path/to/codeql/db \    $(routes which --codeql rails)

Use theviz subcommand to visualize route information in your browser:

$ routes viz --codeql --browser routes.sarif

Contributing

route-detect usespoetry for dependency and configuration management.

Before proceeding, install project dependencies with the following command:

$ poetry install --with dev

Linting

Lint all project files with the following command:

$ poetry run pre-commit run --all-files

Testing

Run Python tests with the following command:

$ poetry run pytest --cov

Run Semgrep rule tests with the following command:

$ poetry run semgrep --test --config routes/rules/ tests/test_rules/

Run CodeQL query tests with the following command:

$ codeql test run routes/queries/rails/test/

About

Find authentication (authn) and authorization (authz) security bugs in web application routes.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp