hahwul / dalfox

🌙🦊 Dalfox is a powerful open-source XSS scanner and utility focused on automation.
https://dalfox.hahwul.com
MIT License
3.55k stars 397 forks source link

Error handled for index out of range #453

Closed rudSarkar closed 1 year ago

rudSarkar commented 1 year ago

While I was working around dalfox I encountered an issue which is caused a crash due to no Error handling in the args following the reference below.

How the issue I encountered when I ran it returned the following error in the picture, Not only for the file command it's the same for url and sxss, Even though we don't need to run this but incase user forget to provide the argument they might end up getting stack trace.

dalfox file
Screenshot 2023-03-04 at 4 18 48 PM

Reference

https://github.com/hahwul/dalfox/blob/efcef0ffbf0fe775d8722940cce02069d7b51fdb/cmd/file.go#L35

https://github.com/hahwul/dalfox/blob/efcef0ffbf0fe775d8722940cce02069d7b51fdb/cmd/url.go#L15

https://github.com/hahwul/dalfox/blob/efcef0ffbf0fe775d8722940cce02069d7b51fdb/cmd/sxss.go#L18

I checked the code coverage using github action, If you think that there will be a better option to handle this error please review the PR and suggest some edits.

Thanks

codecov-commenter commented 1 year ago

Codecov Report

Merging #453 (587e094) into main (efcef0f) will not change coverage. The diff coverage is n/a.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@           Coverage Diff           @@
##             main     #453   +/-   ##
=======================================
  Coverage   77.11%   77.11%           
=======================================
  Files          16       16           
  Lines         874      874           
=======================================
  Hits          674      674           
  Misses        156      156           
  Partials       44       44           

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

hahwul commented 1 year ago

Hi @rudSarkar Thank you very much for you PR :D I checked the revised part and I'm satisfied. The apply will be included in the next release(v2.9).