René's URL Explorer Experiment


Title: Support prepared statements and parameters by vhiairrassary · Pull Request #21 · Query-farm/httpserver · GitHub

Open Graph Title: Support prepared statements and parameters by vhiairrassary · Pull Request #21 · Query-farm/httpserver

X Title: Support prepared statements and parameters by vhiairrassary · Pull Request #21 · Query-farm/httpserver

Description: Hello, I need to support untrusted inputs so I have created this PR as a starting point to see if you would be interested to have this feature merged upstream, and if yes, to discuss about the details. How it works If there is no parameter then execution did not change If there is at least one parameter then I prepare a statement, extract the named values (this PoC does not support positional parameters, but it can be easily done. As a personal note I find them confusing, and even saw they are a syntactic sugar for named parameters under the hood) and execute the prepared statement How to test it It can be tested using: make DUCKDB_HTTPSERVER_DEBUG=1 \ DUCKDB_HTTPSERVER_FOREGROUND=1 \ duckdb -unsigned \ -c "FORCE INSTALL httpserver FROM './build/release/repository';" \ -c "LOAD httpserver;" \ -c "SELECT 890;" \ -c "SELECT httpserve_start('0.0.0.0', 4000, '');" and curl -X POST -d 'SELECT typeof($ABC), $abc, typeof($DEF), $def' -g 'http://localhost:4000?parameters={"abc":{"type":"TEXT","value":"7"},"def":{"type":"BOOLEAN","value":true}}' # {"typeof($ABC)":"VARCHAR","$abc":"7","typeof($DEF)":"BOOLEAN","$def":"true"} Questions/notes I am relying on exceptions to split the code in separated functions and make it easier to read (see the refactored CheckAuthentication and ExtractFormat functions for example). They are not on the happy path and should not impact performances (assuming the database is not publicly available, which sounds reasonable) I tried to follow what is done by Snowflake For the PoC I expect the query's parameters to be a JSON string in the HTTP parameter parameter. This sounds weird and I would be happy to move all the parameters (format, query/q and parameters) inside a single JSON body. Wdyt? We could either: keep the GET (with format and query/q), the POST (with format and query/q) and POST with a JSON body (with format and query/q and parameters) or keep the GET as above and unify both POST with a JSON body (with format and query/q and parameters), but it would be a breaking change I am not sure if I need to do something to drop the prepared statement (In SQL there is an explicit DEALLOCATE operation)

Open Graph Description: Hello, I need to support untrusted inputs so I have created this PR as a starting point to see if you would be interested to have this feature merged upstream, and if yes, to discuss about the deta...

X Description: Hello, I need to support untrusted inputs so I have created this PR as a starting point to see if you would be interested to have this feature merged upstream, and if yes, to discuss about the deta...

Opengraph URL: https://github.com/Query-farm/httpserver/pull/21

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:d7fc84b3-489c-11ec-cd4a-857ec76a1c28
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE37C:367E5D:1CFCAA:2765C6:69826A3D
html-safe-nonce9acbc4026c06db8fafc3ae2ddd64a76ea6a6d088191d8b0a71cb5822d4e76e0b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzdDOjM2N0U1RDoxQ0ZDQUE6Mjc2NUM2OjY5ODI2QTNEIiwidmlzaXRvcl9pZCI6IjU3MTI5OTkyNjY0OTUxMzAxNzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac5175ecb5dd64e9d807fd3ca7e0a0effaa17960a9d1c9f4ae60ce57d3bcb39307
hovercard-subject-tagpull_request:2236057098
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/Query-farm/httpserver/pull/21/files
twitter:imagehttps://avatars.githubusercontent.com/u/6972399?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/6972399?s=400&v=4
og:image:altHello, I need to support untrusted inputs so I have created this PR as a starting point to see if you would be interested to have this feature merged upstream, and if yes, to discuss about the deta...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noned8cbbf00e6212b4e561a1d6db613194a319d58a2967494f7cc81cf6da3fbb985
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/Query-farm/httpserver git https://github.com/Query-farm/httpserver.git
octolytics-dimension-user_id183420031
octolytics-dimension-user_loginQuery-farm
octolytics-dimension-repository_id869750358
octolytics-dimension-repository_nwoQuery-farm/httpserver
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id869750358
octolytics-dimension-repository_network_root_nwoQuery-farm/httpserver
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
release15d777483e72943a892af4ab5c0bbdb20215e6f3
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/Query-farm/httpserver/pull/21/changes#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FQuery-farm%2Fhttpserver%2Fpull%2F21%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
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
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
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/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%2FQuery-farm%2Fhttpserver%2Fpull%2F21%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=Query-farm%2Fhttpserver
Reloadhttps://github.com/Query-farm/httpserver/pull/21/changes
Reloadhttps://github.com/Query-farm/httpserver/pull/21/changes
Reloadhttps://github.com/Query-farm/httpserver/pull/21/changes
Query-farm https://github.com/Query-farm
httpserverhttps://github.com/Query-farm/httpserver
duckdb/extension-templatehttps://github.com/duckdb/extension-template
Notifications https://github.com/login?return_to=%2FQuery-farm%2Fhttpserver
Fork 10 https://github.com/login?return_to=%2FQuery-farm%2Fhttpserver
Star 265 https://github.com/login?return_to=%2FQuery-farm%2Fhttpserver
Code https://github.com/Query-farm/httpserver
Issues 10 https://github.com/Query-farm/httpserver/issues
Pull requests 1 https://github.com/Query-farm/httpserver/pulls
Actions https://github.com/Query-farm/httpserver/actions
Security 0 https://github.com/Query-farm/httpserver/security
Insights https://github.com/Query-farm/httpserver/pulse
Code https://github.com/Query-farm/httpserver
Issues https://github.com/Query-farm/httpserver/issues
Pull requests https://github.com/Query-farm/httpserver/pulls
Actions https://github.com/Query-farm/httpserver/actions
Security https://github.com/Query-farm/httpserver/security
Insights https://github.com/Query-farm/httpserver/pulse
Sign up for GitHub https://github.com/signup?return_to=%2FQuery-farm%2Fhttpserver%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FQuery-farm%2Fhttpserver%2Fissues%2Fnew%2Fchoose
vhiairrassaryhttps://github.com/vhiairrassary
Query-farm:mainhttps://github.com/Query-farm/httpserver/tree/main
vhiairrassary:vhiairrassary/support-bind-variableshttps://github.com/vhiairrassary/duckdb-extension-httpserver/tree/vhiairrassary/support-bind-variables
Conversation 12 https://github.com/Query-farm/httpserver/pull/21
Commits 1 https://github.com/Query-farm/httpserver/pull/21/commits
Checks 36 https://github.com/Query-farm/httpserver/pull/21/checks
Files changed https://github.com/Query-farm/httpserver/pull/21/files
Please reload this pagehttps://github.com/Query-farm/httpserver/pull/21/changes
Support prepared statements and parameters https://github.com/Query-farm/httpserver/pull/21/changes#top
Show all changes 1 commit https://github.com/Query-farm/httpserver/pull/21/files
88d25a3 Support prepared statements and parameters vhiairrassary Dec 15, 2024 https://github.com/Query-farm/httpserver/pull/21/commits/88d25a37b48cb41f9e4559aa69e55bb5be0b0191
Clear filters https://github.com/Query-farm/httpserver/pull/21/files
Please reload this pagehttps://github.com/Query-farm/httpserver/pull/21/changes
Please reload this pagehttps://github.com/Query-farm/httpserver/pull/21/changes
CMakeLists.txt https://github.com/Query-farm/httpserver/pull/21/changes#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20a
authentication.cpp https://github.com/Query-farm/httpserver/pull/21/changes#diff-a41ea9814b82f1512f49e8f3e1ea25aa920fd760552e60acc644a3f686bb61b7
bindings.cpp https://github.com/Query-farm/httpserver/pull/21/changes#diff-5c11c3da57c36233eaf001798d862c3ee01e458476c40f3ae54b620577977466
handler.cpp https://github.com/Query-farm/httpserver/pull/21/changes#diff-0199e92ed68c8f772bbd7e7e93b22065dcc1c6d69d6977ee28d6a2fc6fe65ae3
response_serializer.cpp https://github.com/Query-farm/httpserver/pull/21/changes#diff-1a3fd452ed70077f78d452b61907b2261de2c908419fa7a1ea7ca20e9ed0218c
httpserver_extension.cpp https://github.com/Query-farm/httpserver/pull/21/changes#diff-a5831875febd343fed51f5e6a626c8c37fafe8eb053ea68e1aff2f7e17b218d5
httpserver_extension.hpp https://github.com/Query-farm/httpserver/pull/21/changes#diff-89b58c5b547472c5b231d45e69262ef0e80d1ccf872b91d18b32b3b354c53085
http_handler.hpp https://github.com/Query-farm/httpserver/pull/21/changes#diff-3e99f3452fcfc503ed0124cb66dde5ab45d2801a8ebc2f0e2be19635c79fb96e
authentication.hpp https://github.com/Query-farm/httpserver/pull/21/changes#diff-ee5f11b085def0d42bbac9ff98ece959b9f51f22f9e7d9d60d3985653b359634
bindings.hpp https://github.com/Query-farm/httpserver/pull/21/changes#diff-df4d8ae620f8dfed927acf6796b72aea6bbf0ef67d02dfdf17ff1508004be8fe
common.hpp https://github.com/Query-farm/httpserver/pull/21/changes#diff-8f7dd9b96a252ce01238867552810c4eefbfef53721a5d0b58775e9a8ccaa392
handler.hpp https://github.com/Query-farm/httpserver/pull/21/changes#diff-7f6f1394272f95cd3941ec1d700d0819cdd1868a85d33b7d80acfef0df862d8c
response_serializer.hpp https://github.com/Query-farm/httpserver/pull/21/changes#diff-6498ea0e63abfe7a49352c1f0760e666527691e8288da681d90c687a1bb9d5cd
state.hpp https://github.com/Query-farm/httpserver/pull/21/changes#diff-74503262ce49aa545873d0a74d34cc15284902e53eb545e432940735cc850d14
auth.test https://github.com/Query-farm/httpserver/pull/21/changes#diff-f6581eb33769f6b9c31e063856f88062cef5dcffc38cb023038b9e7ed4b82ea3
basics.test https://github.com/Query-farm/httpserver/pull/21/changes#diff-b7515a38a6ce0b00619333b50f4bd9ab9aa9c45a0f8cb65f8cccbb078ab2565f
quack.test https://github.com/Query-farm/httpserver/pull/21/changes#diff-f9b14319ca8029178e86eea76892d3139dc8f680d79bda1a6e6afb0b0e5fa7fc
simple-get.test https://github.com/Query-farm/httpserver/pull/21/changes#diff-5ede545b5bd120f61ca3a482b20ff07510f6e73beba9aa3a5669c0dfac049da0
CMakeLists.txthttps://github.com/Query-farm/httpserver/pull/21/changes#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20a
View file https://github.com/Query-farm/httpserver/blob/88d25a37b48cb41f9e4559aa69e55bb5be0b0191/CMakeLists.txt
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/Query-farm/httpserver/pull/21/{{ revealButtonHref }}
https://github.com/Query-farm/httpserver/pull/21/changes#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20a
https://github.com/Query-farm/httpserver/pull/21/changes#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20a
https://github.com/Query-farm/httpserver/pull/21/changes#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20a
src/http_handler/authentication.cpphttps://github.com/Query-farm/httpserver/pull/21/changes#diff-a41ea9814b82f1512f49e8f3e1ea25aa920fd760552e60acc644a3f686bb61b7
View file https://github.com/Query-farm/httpserver/blob/88d25a37b48cb41f9e4559aa69e55bb5be0b0191/src/http_handler/authentication.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/Query-farm/httpserver/pull/21/{{ revealButtonHref }}
src/http_handler/bindings.cpphttps://github.com/Query-farm/httpserver/pull/21/changes#diff-5c11c3da57c36233eaf001798d862c3ee01e458476c40f3ae54b620577977466
View file https://github.com/Query-farm/httpserver/blob/88d25a37b48cb41f9e4559aa69e55bb5be0b0191/src/http_handler/bindings.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/Query-farm/httpserver/pull/21/{{ revealButtonHref }}
src/http_handler/handler.cpphttps://github.com/Query-farm/httpserver/pull/21/changes#diff-0199e92ed68c8f772bbd7e7e93b22065dcc1c6d69d6977ee28d6a2fc6fe65ae3
View file https://github.com/Query-farm/httpserver/blob/88d25a37b48cb41f9e4559aa69e55bb5be0b0191/src/http_handler/handler.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/Query-farm/httpserver/pull/21/{{ revealButtonHref }}
NiclasHadererhttps://github.com/NiclasHaderer
Dec 19, 2024https://github.com/Query-farm/httpserver/pull/21/changes#r1891058760
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/Query-farm/httpserver/pull/21/changes
lmanganihttps://github.com/lmangani
Dec 19, 2024https://github.com/Query-farm/httpserver/pull/21/changes#r1893046056
Please reload this pagehttps://github.com/Query-farm/httpserver/pull/21/changes
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/Query-farm/httpserver/pull/21/changes
lmanganihttps://github.com/lmangani
Dec 21, 2024https://github.com/Query-farm/httpserver/pull/21/changes#r1894604834
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
@vhiairrassaryhttps://github.com/vhiairrassary
Please reload this pagehttps://github.com/Query-farm/httpserver/pull/21/changes
lmanganihttps://github.com/lmangani
Jan 8, 2025https://github.com/Query-farm/httpserver/pull/21/changes#r1906895126
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
@vhiairrassaryhttps://github.com/vhiairrassary
Please reload this pagehttps://github.com/Query-farm/httpserver/pull/21/changes
Please reload this pagehttps://github.com/Query-farm/httpserver/pull/21/changes
Please reload this pagehttps://github.com/Query-farm/httpserver/pull/21/changes
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.