René's URL Explorer Experiment


Title: add safeguards against invalid raw json strings by csantero · Pull Request #44 · JSONAPIdotNET/JSONAPI.NET · GitHub

Open Graph Title: add safeguards against invalid raw json strings by csantero · Pull Request #44 · JSONAPIdotNET/JSONAPI.NET

X Title: add safeguards against invalid raw json strings by csantero · Pull Request #44 · JSONAPIdotNET/JSONAPI.NET

Description: I realized that my code that serializes raw JSON down from the database has no protections to ensure that the data is actually valid JSON. If it's malformed in any way, the formatter will happily send it onto the wire and the client will choke on the response. I added a check that validates raw json properties before they are serialized. If the property value contains unparseable syntax, like { x }, then the entire object will be sent down as an empty hash {}. If the property value contains unquoted keys, then the keys will be quoted. So { foo: 3 } will be serialized as { "foo": 3 }. (I originally wanted to have the same behavior if we detect unquoted keys as if the JSON is malformed. But I don't think it's possible to make Json.NET do this - the JToken parser just converts the unquoted keys into quoted ones instead of throwing an exception.)

Open Graph Description: I realized that my code that serializes raw JSON down from the database has no protections to ensure that the data is actually valid JSON. If it's malformed in any way, the formatter will happi...

X Description: I realized that my code that serializes raw JSON down from the database has no protections to ensure that the data is actually valid JSON. If it's malformed in any way, the formatter will h...

Opengraph URL: https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:3e5bdc2c-f23a-91f2-db95-e3c13ee123b2
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB5DC:1B2073:1CF1EFF:2667B86:6A52DA2C
html-safe-nonce2164571ed74ccb3be59007c5ea1691724e7b3749378342e1abe3ab44a7003758
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNURDOjFCMjA3MzoxQ0YxRUZGOjI2NjdCODY6NkE1MkRBMkMiLCJ2aXNpdG9yX2lkIjoiODk4ODM1MTM4OTU0Njc2NDg0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac5f97faaeda246681bbc1251e6b684b4c826fb2ce245d67f623fb407bad786896
hovercard-subject-tagpull_request:28509530
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files
twitter:imagehttps://avatars.githubusercontent.com/u/828286?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/828286?s=400&v=4
og:image:altI realized that my code that serializes raw JSON down from the database has no protections to ensure that the data is actually valid JSON. If it's malformed in any way, the formatter will happi...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneb9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/JSONAPIdotNET/JSONAPI.NET git https://github.com/JSONAPIdotNET/JSONAPI.NET.git
octolytics-dimension-user_id16112275
octolytics-dimension-user_loginJSONAPIdotNET
octolytics-dimension-repository_id27474358
octolytics-dimension-repository_nwoJSONAPIdotNET/JSONAPI.NET
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27474358
octolytics-dimension-repository_network_root_nwoJSONAPIdotNET/JSONAPI.NET
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release07a982c1d40157c619b364352b704c3ce66bb332
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FJSONAPIdotNET%2FJSONAPI.NET%2Fpull%2F44%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FJSONAPIdotNET%2FJSONAPI.NET%2Fpull%2F44%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=JSONAPIdotNET%2FJSONAPI.NET
Reloadhttps://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files
Reloadhttps://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files
Reloadhttps://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files
Please reload this pagehttps://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files
JSONAPIdotNET https://github.com/JSONAPIdotNET
JSONAPI.NEThttps://github.com/JSONAPIdotNET/JSONAPI.NET
Notifications https://github.com/login?return_to=%2FJSONAPIdotNET%2FJSONAPI.NET
Fork 23 https://github.com/login?return_to=%2FJSONAPIdotNET%2FJSONAPI.NET
Star 101 https://github.com/login?return_to=%2FJSONAPIdotNET%2FJSONAPI.NET
Code https://github.com/JSONAPIdotNET/JSONAPI.NET
Issues 28 https://github.com/JSONAPIdotNET/JSONAPI.NET/issues
Pull requests 5 https://github.com/JSONAPIdotNET/JSONAPI.NET/pulls
Actions https://github.com/JSONAPIdotNET/JSONAPI.NET/actions
Projects https://github.com/JSONAPIdotNET/JSONAPI.NET/projects
Wiki https://github.com/JSONAPIdotNET/JSONAPI.NET/wiki
Security and quality 0 https://github.com/JSONAPIdotNET/JSONAPI.NET/security
Insights https://github.com/JSONAPIdotNET/JSONAPI.NET/pulse
Code https://github.com/JSONAPIdotNET/JSONAPI.NET
Issues https://github.com/JSONAPIdotNET/JSONAPI.NET/issues
Pull requests https://github.com/JSONAPIdotNET/JSONAPI.NET/pulls
Actions https://github.com/JSONAPIdotNET/JSONAPI.NET/actions
Projects https://github.com/JSONAPIdotNET/JSONAPI.NET/projects
Wiki https://github.com/JSONAPIdotNET/JSONAPI.NET/wiki
Security and quality https://github.com/JSONAPIdotNET/JSONAPI.NET/security
Insights https://github.com/JSONAPIdotNET/JSONAPI.NET/pulse
Sign up for GitHub https://github.com/signup?return_to=%2FJSONAPIdotNET%2FJSONAPI.NET%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FJSONAPIdotNET%2FJSONAPI.NET%2Fissues%2Fnew%2Fchoose
SphtKrhttps://github.com/SphtKr
JSONAPIdotNET:masterhttps://github.com/JSONAPIdotNET/JSONAPI.NET/tree/master
csantero:invalid-jsonhttps://github.com/csantero/JSONAPI.NET/tree/invalid-json
Conversation 2 https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44
Commits 1 https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/commits
Checks 0 https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/checks
Files changed https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files
Please reload this pagehttps://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files
add safeguards against invalid raw json strings https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#top
Show all changes 1 commit https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files
22dc13f safeguards against invalid raw json strings Feb 2, 2015 https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/commits/22dc13f301775cfbb4f46c4018b22dccc7bf2ecc
Clear filters https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files
Please reload this pagehttps://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files
Please reload this pagehttps://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files
MalformedRawJsonString.json https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-9ca0918d5df93557ed307025e799e28a764db643ebcdc50b8878cb745b0887b7
ReformatsRawJsonStringWithUnquotedKeys.json https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-5b2414cac473134cc89974fa28bb3886824d6320ca3c8501d5e0ca5f9cc78da8
JSONAPI.Tests.csproj https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-31c7be3a28f798a1984ea0917f29ac7507c1383fd49a7223b9d61befc1ca766a
JsonApiMediaFormaterTests.cs https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-d34f5cb6725f1fa00e7ac8e7ce0070d6a5e6f65baa53ea9b9590bf23cafff9ff
JsonApiFormatter.cs https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-4da2be0d2071473427b616d8b58c2bbe27ee74b054f4eb14ebbac7da82a6b10f
JSONAPI.Tests/Data/MalformedRawJsonString.jsonhttps://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-9ca0918d5df93557ed307025e799e28a764db643ebcdc50b8878cb745b0887b7
View file https://github.com/csantero/JSONAPI.NET/blob/22dc13f301775cfbb4f46c4018b22dccc7bf2ecc/JSONAPI.Tests/Data/MalformedRawJsonString.json
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/{{ revealButtonHref }}
JSONAPI.Tests/Data/ReformatsRawJsonStringWithUnquotedKeys.jsonhttps://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-5b2414cac473134cc89974fa28bb3886824d6320ca3c8501d5e0ca5f9cc78da8
View file https://github.com/csantero/JSONAPI.NET/blob/22dc13f301775cfbb4f46c4018b22dccc7bf2ecc/JSONAPI.Tests/Data/ReformatsRawJsonStringWithUnquotedKeys.json
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/{{ revealButtonHref }}
JSONAPI.Tests/JSONAPI.Tests.csprojhttps://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-31c7be3a28f798a1984ea0917f29ac7507c1383fd49a7223b9d61befc1ca766a
View file https://github.com/csantero/JSONAPI.NET/blob/22dc13f301775cfbb4f46c4018b22dccc7bf2ecc/JSONAPI.Tests/JSONAPI.Tests.csproj
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/{{ revealButtonHref }}
https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-31c7be3a28f798a1984ea0917f29ac7507c1383fd49a7223b9d61befc1ca766a
https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-31c7be3a28f798a1984ea0917f29ac7507c1383fd49a7223b9d61befc1ca766a
JSONAPI.Tests/Json/JsonApiMediaFormaterTests.cshttps://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-d34f5cb6725f1fa00e7ac8e7ce0070d6a5e6f65baa53ea9b9590bf23cafff9ff
View file https://github.com/csantero/JSONAPI.NET/blob/22dc13f301775cfbb4f46c4018b22dccc7bf2ecc/JSONAPI.Tests/Json/JsonApiMediaFormaterTests.cs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/{{ revealButtonHref }}
https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-d34f5cb6725f1fa00e7ac8e7ce0070d6a5e6f65baa53ea9b9590bf23cafff9ff
https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-d34f5cb6725f1fa00e7ac8e7ce0070d6a5e6f65baa53ea9b9590bf23cafff9ff
JSONAPI/Json/JsonApiFormatter.cshttps://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-4da2be0d2071473427b616d8b58c2bbe27ee74b054f4eb14ebbac7da82a6b10f
View file https://github.com/csantero/JSONAPI.NET/blob/22dc13f301775cfbb4f46c4018b22dccc7bf2ecc/JSONAPI/Json/JsonApiFormatter.cs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/{{ revealButtonHref }}
https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-4da2be0d2071473427b616d8b58c2bbe27ee74b054f4eb14ebbac7da82a6b10f
https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-4da2be0d2071473427b616d8b58c2bbe27ee74b054f4eb14ebbac7da82a6b10f
https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-4da2be0d2071473427b616d8b58c2bbe27ee74b054f4eb14ebbac7da82a6b10f
https://github.com/JSONAPIdotNET/JSONAPI.NET/pull/44/files#diff-4da2be0d2071473427b616d8b58c2bbe27ee74b054f4eb14ebbac7da82a6b10f
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.