Adds Benchmark for XSS detection, minor refactor/optimization
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)
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 🤔
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.
Kudos, SonarCloud Quality Gate passed! 
0 Bugs
0 Vulnerabilities
0 Security Hotspots
1 Code Smell
No Coverage information
0.0% Duplication
@M4tteoP Can you push some additional larger texts for https://github.com/corazawaf/libinjection-go/pull/13#pullrequestreview-1113024471 ?
ping @M4tteoP
Requires https://github.com/corazawaf/libinjection-go/pull/18
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
What is needed here? @M4tteoP
Quality Gate passed
Issues
1 New issue
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
If you are happy with the additional larger texts added, it is ready to be merged from my side
I'm always happy. Let's go!