Comments (4)
You should place the config.json file outside the document root folder.
from drogon.
This is definitely a weird request. As an alternative, if you are on OpenBSD or Linux. Just use unveil
or landlock
to whitelist directories the application is able to. See my repo abd blog post for details, You likely want to do something like the followning. Though I still think it is not ideal
unveil(app().getDocumentRoot().c_str(), "r");
unveil((app().getDocumentRoot() + "/config.json").c_str(), "");
unveil(app().getUploadPath().c_str(), "rwc");
// TODO: add more paths like /dev /etc as you likely need them
unveil(NULL, NULL);
Unveil API on Liinux
https://github.com/marty1885/landlock-unveil
OpenBSD unveil
https://man.openbsd.org/unveil.2
from drogon.
Thanks for the solution, it's interesting, but I need something platform independent.
The Drogon json config contains comments. This is not the correct json format. The json with comments has the file extension “jsonc”. Also the json config could potentially forget to add to the blacklist.
In my case, I add extension to the sources
std::vector<std::string> JsonConfigAdapter::getExtensions() const
{
return {“json”, “jsonc”}
}
from drogon.
You should place the config.json file outside the document root folder.
this is correct, in my case it is rest api, where with the executable file there is only docs folder with html. I didn't want the extra nesting for only one folder for the local distribution.
from drogon.
Related Issues (20)
- registerPostHandlingAdvice on OPTION request HOT 5
- 内存泄漏 HOT 38
- forward cant works HOT 1
- Hodor plugin add exempt IPs HOT 1
- gcc 14.1 HOT 3
- Let drogon_ctl generate systemd unit file
- drogon_ctl create model treats charvar[] (arrays) as std::string. HOT 2
- Provide capability to serve files without extension HOT 2
- HttpMiddleware not found in the latest tag HOT 2
- error on compiling source code HOT 3
- Support C++20 modules.
- MSSQL support in ORM
- It's time to create a middleware for CORS, I will create it when I have time. HOT 1
- 进程已结束,退出代码为 139 (interrupted by signal 11:SIGSEGV) HOT 18
- HTTP/2 compatiablity tracker HOT 4
- Protection against SQL injections HOT 2
- ORM Mapper getDbClient return NULL HOT 7
- Aligned Static File Routes HOT 1
- HttpRequestPtr reset interface HOT 1
- [HttpAppFramework / HttpClientPtr ] can't change/set (ssl key, cert, & configuration) after/on plugin HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from drogon.