diff options
author | RaindropsSys <raindrops@equestria.dev> | 2024-06-24 15:13:56 +0200 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2024-06-24 15:13:56 +0200 |
commit | ae3e3ceefc8e3c174ff69f05212d636230f093d6 (patch) | |
tree | 3eefa639fdf9d62eae3bec3892aa9c3dac34b55a /src | |
parent | ba662f8827602acaad5f09f9cc81bf717ed427af (diff) | |
download | faunerie-ae3e3ceefc8e3c174ff69f05212d636230f093d6.tar.gz faunerie-ae3e3ceefc8e3c174ff69f05212d636230f093d6.tar.bz2 faunerie-ae3e3ceefc8e3c174ff69f05212d636230f093d6.zip |
Fix potential code injection
Diffstat (limited to 'src')
-rwxr-xr-x | src/PrisbeamSearch.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/PrisbeamSearch.ts b/src/PrisbeamSearch.ts index daffde4..5e352d8 100755 --- a/src/PrisbeamSearch.ts +++ b/src/PrisbeamSearch.ts @@ -27,7 +27,10 @@ export class PrisbeamSearch { <hr> <details> <summary>Show technical information</summary> - <pre style='margin-bottom: 0;'>Query: ${query.substring(0, 1024)}${sql ? `\n\nSQL: ${sql.substring(0, 1024)}` : ""}\n\nError dump:\n${e.stack}</pre> + <pre style='margin-bottom: 0;'>Query: ${query.substring(0, 1024)}${sql ? `\n\nSQL: ${sql.substring(0, 1024)}` : ""}\n\nError dump:\n${e.stack + .replaceAll("&", "&") + .replaceAll(">", ">") + .replaceAll("<", "<")}</pre> </details> `; } @@ -85,7 +88,10 @@ export class PrisbeamSearch { } if (e.name === "SearchError" || e.stack.startsWith("SearchError: ")) { - return e.message; + return e.message + .replaceAll("&", "&") + .replaceAll(">", ">") + .replaceAll("<", "<"); } return "An error has occurred while processing your search query"; |