diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2026-10-11 08:06:09 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2026-10-11 08:06:09 +0300 |
| commit | 451710e9f052db9167afb8130900d2d5bec6993a (patch) | |
| tree | 0a4767754e2df428f066cb20028795dd7d8ab812 /src | |
| parent | 6f771f8b9468f012ba74f2e7d139efe7afbaf321 (diff) | |
| download | the-epube-451710e9f052db9167afb8130900d2d5bec6993a.tar.gz the-epube-451710e9f052db9167afb8130900d2d5bec6993a.tar.xz | |
set missing cookie parameters (samesite & httponly) and fix possible XSS in index_mode via browser URL string
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/app.ts b/src/app.ts index 481f669..9da16c0 100644 --- a/src/app.ts +++ b/src/app.ts @@ -184,7 +184,9 @@ class AppClass extends AppCommon { console.log('cache version, current:', this.cacheVersion, 'worker:', await this.getActiveCacheVersion()); // Read URL params for mode/query/offset - this.index_mode = this.urlParam("mode") || ""; + // Whitelist known modes: never let an arbitrary URL value flow into + // generated hrefs or backend requests (DOM XSS hardening). + this.index_mode = this.urlParam("mode") === "favorites" ? "favorites" : ""; this.index_query = this.urlParam("query") || ""; const offsetParam = parseInt(this.urlParam("offset")); this.index_offset = isNaN(offsetParam) ? 0 : offsetParam; |
