Compare commits

...

14 Commits

Author SHA1 Message Date
Jordan Bancino c3646294f5 Merge pull request 'Fix HTTP header leakage' (#39) from lda/Cytoplasm:fix-duplicate-leak into master
Compile Cytoplasm / Compile Cytoplasm (x86, alpine-v3.19) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86, debian-v12.4) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86, freebsd-v14.0) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86, netbsd-v9.3) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, alpine-v3.19) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, debian-v12.4) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, freebsd-v14.0) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, netbsd-v9.3) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, openbsd-v7.4) (push) Has been cancelled Details
Reviewed-on: Telodendria/Cytoplasm#39
2024-07-02 11:56:18 -04:00
Jordan Bancino 61b5430efe Merge pull request 'Fix TLS build issue' (#40) from lda/Cytoplasm:fix-tls into master
Compile Cytoplasm / Compile Cytoplasm (x86, alpine-v3.19) (push) Waiting to run Details
Compile Cytoplasm / Compile Cytoplasm (x86, debian-v12.4) (push) Waiting to run Details
Compile Cytoplasm / Compile Cytoplasm (x86, freebsd-v14.0) (push) Waiting to run Details
Compile Cytoplasm / Compile Cytoplasm (x86, netbsd-v9.3) (push) Waiting to run Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, alpine-v3.19) (push) Waiting to run Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, debian-v12.4) (push) Waiting to run Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, freebsd-v14.0) (push) Waiting to run Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, netbsd-v9.3) (push) Waiting to run Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, openbsd-v7.4) (push) Waiting to run Details
Reviewed-on: Telodendria/Cytoplasm#40
2024-07-02 11:55:53 -04:00
LDA b3be10e112 [FIX] Last TLS oopsie!
We should actually consider bringing back CI when possible.
2024-06-27 16:53:56 +02:00
LDA b284fb607a [FIX] Fix HTTP leakage 2024-06-27 16:45:32 +02:00
Jordan Bancino dd99759e39 Merge pull request 'Fix stringification.' (#37) from lda/Cytoplasm:fix-stringify into master
Compile Cytoplasm / Compile Cytoplasm (x86, alpine-v3.19) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86, debian-v12.4) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86, freebsd-v14.0) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86, netbsd-v9.3) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, alpine-v3.19) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, debian-v12.4) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, freebsd-v14.0) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, netbsd-v9.3) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, openbsd-v7.4) (push) Has been cancelled Details
Reviewed-on: Telodendria/Cytoplasm#37
2024-06-24 14:19:26 -05:00
Jordan Bancino bd310e62ac Merge pull request 'Fix TLS, again...' (#38) from lda/Cytoplasm:fix-tls into master
Compile Cytoplasm / Compile Cytoplasm (x86, alpine-v3.19) (push) Waiting to run Details
Compile Cytoplasm / Compile Cytoplasm (x86, debian-v12.4) (push) Waiting to run Details
Compile Cytoplasm / Compile Cytoplasm (x86, freebsd-v14.0) (push) Waiting to run Details
Compile Cytoplasm / Compile Cytoplasm (x86, netbsd-v9.3) (push) Waiting to run Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, alpine-v3.19) (push) Waiting to run Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, debian-v12.4) (push) Waiting to run Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, freebsd-v14.0) (push) Waiting to run Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, netbsd-v9.3) (push) Waiting to run Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, openbsd-v7.4) (push) Waiting to run Details
Reviewed-on: Telodendria/Cytoplasm#38
2024-06-24 14:18:43 -05:00
LDA d7faff734c [FIX] Actually apply serverName
As it turns out, it *was* odd. Not doing that will cause *someone* to
spend several hours fixing a SSL problem around a bridge they're making,
which needs to download media from a server and can't from *some* for an
undiscernable reason, causing said person to start going insane before
realising that Cytoplasm didn't set the server name properly.
2024-06-23 07:52:32 +02:00
LDA 5dc1ec49eb [FIX] Actually set fd.
I *should* have seen that one coming, oops!
2024-06-19 17:40:06 +02:00
LDA eca717d90c Merge branch 'master' of https://git.telodendria.io/Telodendria/Cytoplasm into fix-tls 2024-06-19 17:39:37 +02:00
LDA 5fac67a674 [MOD] Fix stringification of version number
It just kept bothering me.
2024-06-15 13:54:49 +02:00
Jordan Bancino b9dc169917 Merge pull request 'Fix file descriptor leakage' (#35) from lda/Cytoplasm:tls-file-leak into master
Compile Cytoplasm / Compile Cytoplasm (x86, alpine-v3.19) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86, debian-v12.4) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86, freebsd-v14.0) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86, netbsd-v9.3) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, alpine-v3.19) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, debian-v12.4) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, freebsd-v14.0) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, netbsd-v9.3) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, openbsd-v7.4) (push) Has been cancelled Details
Reviewed-on: Telodendria/Cytoplasm#35
2024-06-07 14:00:44 -05:00
lda d983296dd2 [MOD] As it turns out, you do need to free thr fd. 2024-06-03 19:42:09 +02:00
lda 9108fef701 Fix inconsistent sanitation with the database (#32)
Compile Cytoplasm / Compile Cytoplasm (x86, alpine-v3.19) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86, debian-v12.4) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86, freebsd-v14.0) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86, netbsd-v9.3) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, alpine-v3.19) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, debian-v12.4) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, freebsd-v14.0) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, netbsd-v9.3) (push) Has been cancelled Details
Compile Cytoplasm / Compile Cytoplasm (x86_64, openbsd-v7.4) (push) Has been cancelled Details
Cytoplasm's Db currently doesn't sanitate database entries consistently, and this PR should be a quick fix for this.

Reviewed-on: Telodendria/Cytoplasm#32
Co-authored-by: lda <lda@freetards.xyz>
Co-committed-by: lda <lda@freetards.xyz>
2024-05-26 15:31:14 -05:00
lda b6388eb7fe
[FIX] Fix issue related to TLS
The Makefile didn't properly set TLS_IMPL, effectively causing no
TLS implementation to be put in.
2023-10-03 16:56:39 +02:00
4 changed files with 27 additions and 25 deletions

View File

@ -33,7 +33,8 @@
#define CYTOPLASM_VERSION_BETA 0
#define CYTOPLASM_VERSION_STABLE (!CYTOPLASM_VERSION_ALPHA && !CYTOPLASM_VERSION_BETA)
#define STRINGIFY(x) #x
#define XSTRINGIFY(x) #x
#define STRINGIFY(x) XSTRINGIFY(x)
/***
* @Nm Cytoplasm

View File

@ -218,19 +218,38 @@ DbHashKey(Array * args)
return str;
}
static char
DbSanitiseChar(char input)
{
switch (input)
{
case '/':
return '_';
case '.':
return '-';
}
return input;
}
static char *
DbDirName(Db * db, Array * args, size_t strip)
{
size_t i;
size_t i, j;
char *str = StrConcat(2, db->dir, "/");
for (i = 0; i < ArraySize(args) - strip; i++)
{
char *tmp;
char *sanitise = StrDuplicate(ArrayGet(args, i));
for (j = 0; j < strlen(sanitise); j++)
{
sanitise[j] = DbSanitiseChar(sanitise[j]);
}
tmp = StrConcat(3, str, ArrayGet(args, i), "/");
tmp = StrConcat(3, str, sanitise, "/");
Free(str);
Free(sanitise);
str = tmp;
}
@ -253,17 +272,7 @@ DbFileName(Db * db, Array * args)
/* Sanitize name to prevent directory traversal attacks */
while (arg[j])
{
switch (arg[j])
{
case '/':
arg[j] = '_';
break;
case '.':
arg[j] = '-';
break;
default:
break;
}
arg[j] = DbSanitiseChar(arg[j]);
j++;
}

View File

@ -621,7 +621,7 @@ HttpParseHeaders(Stream * fp)
strncpy(headerValue, headerPtr, len);
HashMapSet(headers, headerKey, headerValue);
Free(HashMapSet(headers, headerKey, headerValue));
Free(headerKey);
}

View File

@ -71,14 +71,6 @@ TlsInitClient(int fd, const char *serverName)
OpenSSLCookie *cookie;
char errorStr[256];
/*
* TODO: Seems odd that this isn't needed to make the
* connection... we should figure out how to verify the
* certificate matches the server we think we're
* connecting to.
*/
(void) serverName;
cookie = Malloc(sizeof(OpenSSLCookie));
if (!cookie)
{
@ -89,12 +81,14 @@ TlsInitClient(int fd, const char *serverName)
cookie->method = TLS_client_method();
cookie->ctx = SSL_CTX_new(cookie->method);
cookie->fd = fd;
if (!cookie->ctx)
{
goto error;
}
cookie->ssl = SSL_new(cookie->ctx);
SSL_set_tlsext_host_name(cookie->ssl, serverName);
if (!cookie->ssl)
{
goto error;
@ -295,9 +289,7 @@ TlsClose(void *cookie)
SSL_free(ssl->ssl);
SSL_CTX_free(ssl->ctx);
#if 0
close(ssl->fd);
#endif
Free(ssl);