Compare commits
4 Commits
70f7289c8c
...
ae1d33a14e
| Author | SHA1 | Date | |
|---|---|---|---|
| ae1d33a14e | |||
| 610da575ea | |||
| 9b129f0255 | |||
| 8e77116027 |
2
Makefile
2
Makefile
@@ -53,7 +53,7 @@ profile: qswiki
|
|||||||
|
|
||||||
|
|
||||||
exile.o: submodules/exile.h/exile.c
|
exile.o: submodules/exile.h/exile.c
|
||||||
$(CC) -std=c99 -DHAVE_LANDLOCK=0 -c submodules/exile.h/exile.c -o exile.o
|
$(CC) -std=c99 -c submodules/exile.h/exile.c -o exile.o
|
||||||
|
|
||||||
qswiki: $(WIKIOBJECTS) exile.o
|
qswiki: $(WIKIOBJECTS) exile.o
|
||||||
$(CXX) $(shell shuf -e $(WIKIOBJECTS) exile.o ) ${LDFLAGS} ${INCLUDEFLAGS} -o qswiki
|
$(CXX) $(shell shuf -e $(WIKIOBJECTS) exile.o ) ${LDFLAGS} ${INCLUDEFLAGS} -o qswiki
|
||||||
|
|||||||
29
request.cpp
29
request.cpp
@@ -86,7 +86,15 @@ void Request::initCookies(const std::string &cookiestr)
|
|||||||
|
|
||||||
std::string Request::get(const std::string &key) const
|
std::string Request::get(const std::string &key) const
|
||||||
{
|
{
|
||||||
return utils::getKeyOrEmpty(this->getVars, key);
|
std::string value = utils::getKeyOrEmpty(this->getVars, key);
|
||||||
|
/* In general all our expected GET values are printable and, for now, ascii.
|
||||||
|
* If not, it's not a normal request. So just return an empty string then.
|
||||||
|
* Exceptions are probably a bit too much */
|
||||||
|
if(!utils::is_printable_ascii(value))
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Request::post(const std::string &key) const
|
std::string Request::post(const std::string &key) const
|
||||||
@@ -105,23 +113,18 @@ std::string Request::param(const std::string &key) const
|
|||||||
}
|
}
|
||||||
std::string Request::cookie(const std::string &key) const
|
std::string Request::cookie(const std::string &key) const
|
||||||
{
|
{
|
||||||
|
std::string value;
|
||||||
for(const Cookie &c : cookies)
|
for(const Cookie &c : cookies)
|
||||||
{
|
{
|
||||||
if(c.key == key)
|
if(c.key == key)
|
||||||
{
|
{
|
||||||
return c.value;
|
value = c.value;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(utils::is_printable_ascii(value))
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> Request::allGet(const std::string &key)
|
|
||||||
{
|
|
||||||
return utils::getAll(this->getVars, key);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> Request::allPost(const std::string &key)
|
|
||||||
{
|
|
||||||
return utils::getAll(this->postVars, key);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -34,9 +34,6 @@ class Request
|
|||||||
std::string post(const std::string &key) const;
|
std::string post(const std::string &key) const;
|
||||||
std::string cookie(const std::string &key) const;
|
std::string cookie(const std::string &key) const;
|
||||||
std::string param(const std::string &key) const;
|
std::string param(const std::string &key) const;
|
||||||
std::vector<std::string> allGet(const std::string &key);
|
|
||||||
std::vector<std::string> allPost(const std::string &key);
|
|
||||||
|
|
||||||
const std::vector<Cookie> &getCookies() const
|
const std::vector<Cookie> &getCookies() const
|
||||||
{
|
{
|
||||||
return this->cookies;
|
return this->cookies;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ bool SandboxLinux::enable(std::vector<std::string> fsPaths)
|
|||||||
struct exile_policy *policy = exile_init_policy();
|
struct exile_policy *policy = exile_init_policy();
|
||||||
if(policy == NULL)
|
if(policy == NULL)
|
||||||
{
|
{
|
||||||
Logger::error() << "Failed to init sandboxing policy (worker) ";
|
Logger::error() << "Failed to init sandboxing policy";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < fsPaths.size(); i++)
|
for(unsigned int i = 0; i < fsPaths.size(); i++)
|
||||||
@@ -55,10 +55,8 @@ bool SandboxLinux::enable(std::vector<std::string> fsPaths)
|
|||||||
exile_append_path_policies(policy, EXILE_FS_ALLOW_ALL_READ | EXILE_FS_ALLOW_ALL_WRITE, path.c_str());
|
exile_append_path_policies(policy, EXILE_FS_ALLOW_ALL_READ | EXILE_FS_ALLOW_ALL_WRITE, path.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
policy->drop_caps = 1;
|
|
||||||
policy->not_dumpable = 1;
|
policy->not_dumpable = 1;
|
||||||
policy->no_new_privs = 1;
|
policy->no_new_privs = 1;
|
||||||
policy->mount_path_policies_to_chroot = 1;
|
|
||||||
policy->vow_promises = exile_vows_from_str("stdio wpath cpath rpath inet unix thread");
|
policy->vow_promises = exile_vows_from_str("stdio wpath cpath rpath inet unix thread");
|
||||||
if(exile_enable_policy(policy) != 0)
|
if(exile_enable_policy(policy) != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Submodule submodules/exile.h updated: e711a1d53a...4cfdead5d0
Reference in New Issue
Block a user