feat: add JSON Schema validation via validateSchema operator#1343
feat: add JSON Schema validation via validateSchema operator#1343cognitivegears wants to merge 46 commits intocorazawaf:mainfrom
Conversation
Co-authored-by: Felipe Zipitría <3012076+fzipi@users.noreply.github.com>
… validation - Added full JSON Schema validation using kaptinlin/jsonschema - Added XML Schema validation using terminalstatic/go-xsd-validate - Implemented lazy initialization to improve performance - Added test cases
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1343 +/- ##
==========================================
+ Coverage 84.34% 84.51% +0.16%
==========================================
Files 170 172 +2
Lines 9933 10046 +113
==========================================
+ Hits 8378 8490 +112
Misses 1310 1310
- Partials 245 246 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
FYI I'll take a look at the code coverage change, looks like I need to add a few more tests. I'm not sure what happened with the Tinygo test, I'll have to look into that one further. In the meantime, would you mind taking a look at the overall approach and let me know if you have any questions or concerns / things you would like changed? |
|
Thank you for your contribution!! |
Good callout. The way that libxml2 is initialized it does not look like it should resolve external entity references. However, I will try to add some tests to validate that specifically as well. |
Note - added some specific XXE validation testing as well. |
|
Thanks so much for the feedback so far! I hope to have some more information later today or tomorrow. |
|
If possible, can I please get an update on anything else needed on this PR? Otherwise if all is good can this be merged? |
|
I will review it again this weekend.
…On Sat, Apr 26, 2025 at 4:50 PM Nathan Byrd ***@***.***> wrote:
*cognitivegears* left a comment (corazawaf/coraza#1343)
<#1343 (comment)>
If possible, can I please get an update on anything else needed on this
PR? Otherwise if all is good can this be merged?
—
Reply to this email directly, view it on GitHub
<#1343 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXOYAXL5EW2HG7PFSVDAFT23OMMLAVCNFSM6AAAAAB2QCNA4SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMZSGI4DOMZVGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
I apologize for reaching out again, but if possible can I get an update on reviewing this PR? I'm hoping to release a feature on one of my projects that need this functionality and am hoping to put a bow on a couple of long-lived branches (here and my project.) Any help would be greatly appreciated. |
|
ping @cognitivegears. There are some small conflicts, that might be solved by rebasing. |
Sorry it took a bit, there were a few changes beyond the rebase but they are resolved now. |
|
All of the above code review comments should be completed now. If possible can I get a check? |
|
@fzipi thanks also for updating the title |
|
Did some rework in #1384 |
This looks great, and still passes all functional tests. Looks good to me! |
|
Shall we close this one? |
Make sure that you've checked the boxes below before you submit PR:
Thanks for your contribution ❤️
Fixes Issue #1279
This implements the validateSchema operator as per the existing modsecurity documentation, but currently only for JSON support. Since it didn't fit in the current structure of Coraza I didn't include it here, but I also have additional documentation and a test server for validation at: https://github.com/cognitivegears/coraza_validate_schema_extras