-
Notifications
You must be signed in to change notification settings - Fork 53
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
Why JSON3.read
is used both for file path and json string content, and blocks file after read?
#272
Comments
@quinnj ping. This is actually a pretty bad security vulnerability. Imagine that we have a server and a client: # Server
julia> using Oxygen, JSON3, HTTP
julia> # Define a POST route to read JSON data
@post "/data" function(req::HTTP.Request)
# Parse the request body as JSON
json_data = JSON3.read(String(req.body))
# Process the JSON data as needed
println("Received JSON data:", json_data)
# Return a simple response
return Dict("status" => "success", "message" => json_data)
end
julia> serve() If we send
This is alright. If we have a file on the server called {"super_secret_password": "abcdefg"} We can send a request such that
|
See how this is done for TOML for example. It's either |
Same for YAML: https://github.com/JuliaData/YAML.jl/blob/master/src/YAML.jl |
Cross ref #95 The solutions could be many:
|
I'm happy to file a PR once we agree on a solution |
👍 I agree file/string should be separate functions. An additional problem with this API is that when you do trimming, all the code for Mmap/files has to be included even if you aren't using files. |
I think we should add |
Because of this I get read error for any non-existent file, and maybe some incorrect behaviour for file names that match JSON
The text was updated successfully, but these errors were encountered: