Skip to content

Security Fix: JSON Deserialization Protection & Code Improvements #66

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

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

yuseok-kim-edushare
Copy link

@yuseok-kim-edushare yuseok-kim-edushare commented Mar 18, 2025

this pr also can close #65 and close #64 + close #61 by db9279b

Overview

This PR implements critical security fixes and code improvements to enhance both security and performance of the SQL-APIConsumer component.

Key Changes

  • target framework update: .net 4.0 is too old version that include several security risks, so we need to fix target frameworks
    • Not deprecated, and With Compatibility, .NET 4.8 can support win 2012 that run sql server from 2008r2 to 2017
    • also, not deprecated and least windows server is 2016 that native include .net 4.8
  • Security Fix: Added JSON deserialization depth limit (MaxDepth=128) to mitigate CVE-2024-21907 vulnerability
  • Performance: Implemented static HttpClient instance to reduce socket exhaustion and resource usage
  • Modern Async: Added async implementation for HTTP methods to improve scalability
  • Code Quality: Refactored exception handling across multiple files
  • Build Process: Updated project configuration for better deployment control
  • Version Update: Incremented version from 2.3.6.1 to 2.3.7.0

Security Impact

The JSON deserialization depth limit prevents potential Denial of Service attacks through maliciously crafted deep-nested JSON payloads that could cause:

  • High CPU/memory consumption
  • Thread exhaustion
  • Stack overflow exceptions

Cleanup

  • Removed binary artifacts from repository
  • Standardized build configuration
  • Updated .gitignore to prevent binary file commits

To modernize about web request codes
Tls and Ssl3 is not safe at now
with .NET native api, add validation check proper input value
.net 4 is too old version
and we can consider if SQL2016 supported windows server 2012 or above
win 2012 can run net 48
just after build, we only need DDL sql and dll file from this project
Now we only register 1 dll file with single query
@geral2 geral2 self-requested a review March 18, 2025 20:41
@geral2 geral2 self-assigned this Mar 18, 2025
@geral2
Copy link
Owner

geral2 commented Mar 18, 2025

Hello @yuseok-kim-edushare,

Thanks a ton for this PR! 🙌 Really appreciate the time and effort you put into this — everything looks solid. Great job on the build improvements! I'll go ahead and review/test it shortly. Thanks again for contributing!

@yuseok-kim-edushare
Copy link
Author

I Fix sqlproj
I manually added sql file and some other artifacts, then visual studio try to compile sql query file
then i set build type None

Cause of IL-repack using
CLR assembly reference list changed
then need to drop and create is needed
@yuseok-kim-edushare
Copy link
Author

I Add A script to re-install CLR
cause of IL-Repack using, build result dll file's referencing list changed, then SQL server Request drop and create

then i create SQL Script for re-install this

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