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

[Semgrep][sarif]: Ошибки конвертации - лишний текст в блоке кода (sample) #19

Open
nluzgin opened this issue Aug 28, 2024 · 1 comment
Assignees

Comments

@nluzgin
Copy link

nluzgin commented Aug 28, 2024

Краткое описание:
В снипет кода включается лишний текст из описания уязвимсоти.

if (level === cadesplugin.LOG_LEVEL_DEBUG) **Rule name:** semgrep_public_rules.0xdea.generic.raptor-bad-words **Rule short description:** Semgrep Finding: semgrep_public_rules.0xdea.generic.raptor-bad-words

В самом файле строчка с "уязвимостью" не содержит подстроку "Rule name: sem .... "

Как воспроизводится:

  1. Просканировать файл (sample_code.txt) с помощью Semgrep
    Команда на скан примерно такая:
    semgrep scan --metrics=off --dataflow-traces --disable-version-check --no-error --config '/semgrep_public_rules' --sarif --output='sample_code_results.sarif' --exclude='*_test.go' --exclude='*/src/test/java/*' sample_code.txt
  2. Сариф файл (sample_code_results.sarif) отправить в конрвертор
    python.exe .\main.py -t CODEBASE -s semgrep --format sarif -f C:\...\sample_code_results.sarif -o sample_code_results_hub.json -n semgrep-sarif-3000-pro -u https://gitlab.xxx.ru/example-repo -b master -bt NPM
  3. загрузить результат (sample_code_results_hub.json) в Hub
    python3 -m src.import_report --url https://hub-test.ru --token <токенхаба> --appcode test_conv --report-file sample_code_results_hub.json --insecure

Что именно не так:
В файле sample_code.txt "уязвима" - строка 7.
В sarif файле сниппет корректный - строка 208
Конвертированный результат содержит "мусор" - строка 53

@WDN2010
Copy link

WDN2010 commented Aug 28, 2024

sample_code.txt
sample_code_results.sarif.txt
sample_code_results_hub.json.txt

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

No branches or pull requests

3 participants