libinjection-go icon indicating copy to clipboard operation
libinjection-go copied to clipboard

Adds Benchmark for XSS detection, minor refactor/optimization

Open M4tteoP opened this issue 3 years ago • 7 comments

This PR:

  • Adds a Benchmark test for XSS detection
  • Reduces functions called inside interactions (still no performance improvements, I think mainly because of the small amount of data iterated)
  • Has minor refactors in favor of Go idioms rather than C ones.

Benchmark Before/After:

name                  old time/op    new time/op   delta
XSSDriver/html5-10    42.5µs ± 3%    41.2µs ± 1%  -3.19%  (p=0.000 n=100+86)

M4tteoP avatar Sep 18 '22 22:09 M4tteoP

XSSDriver/html5-10 42.5µs ± 3% 41.2µs ± 1% -3.19% (p=0.000 n=100+86)

Can you add some logic to check for, or at least debug that the benchmark is actually running code? Even if the inputs are all small, there are about 60 test case files meaning <1 microsecond per case, this seems too low. Nothing seems obviously wrong with the code from reading it though 🤔

anuraaga avatar Sep 20 '22 01:09 anuraaga

Codecov Report

Attention: Patch coverage is 44.18605% with 24 lines in your changes missing coverage. Please review.

Project coverage is 91.41%. Comparing base (243c29f) to head (5a2e0ef). Report is 3 commits behind head on master.

:exclamation: Current head 5a2e0ef differs from pull request most recent head 3e0beba

Please upload reports for the commit 3e0beba to get more accurate results.

Files Patch % Lines
xss_helpers.go 40.00% 23 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #13      +/-   ##
==========================================
+ Coverage   90.21%   91.41%   +1.20%     
==========================================
  Files           8        8              
  Lines        1523     1515       -8     
==========================================
+ Hits         1374     1385      +11     
+ Misses        128      105      -23     
- Partials       21       25       +4     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Sep 26 '22 15:09 codecov-commenter

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

sonarqubecloud[bot] avatar Sep 26 '22 22:09 sonarqubecloud[bot]

@M4tteoP Can you push some additional larger texts for https://github.com/corazawaf/libinjection-go/pull/13#pullrequestreview-1113024471 ?

fzipi avatar Apr 02 '23 13:04 fzipi

ping @M4tteoP

fzipi avatar Jan 25 '24 21:01 fzipi

Requires https://github.com/corazawaf/libinjection-go/pull/18

M4tteoP avatar Jan 27 '24 23:01 M4tteoP

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

1 New issue
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Jan 28 '24 11:01 sonarqubecloud[bot]

What is needed here? @M4tteoP

fzipi avatar Jun 05 '24 13:06 fzipi

If you are happy with the additional larger texts added, it is ready to be merged from my side

M4tteoP avatar Jun 05 '24 13:06 M4tteoP

I'm always happy. Let's go!

fzipi avatar Jun 05 '24 13:06 fzipi