Skip to content

Commit 03b8770

Browse files
kris7tSpecialAro
authored andcommitted
Update dependencies and fix local server directory traversal
1 parent 56d1431 commit 03b8770

File tree

6 files changed

+67
-11
lines changed

6 files changed

+67
-11
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.15.0
1+
16.15.1

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ Currently, these are the combinations of system dependencies that work for MacOS
4949
```bash
5050
$ jq --null-input '[inputs.engines] | add' < ./package.json < ./recipes/package.json
5151
{
52-
"node": "16.15.0",
53-
"npm": "8.7.0",
52+
"node": "16.15.1",
53+
"npm": "8.13.2",
5454
"pnpm": "7.0.1"
5555
}
5656
```

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:16.15.0-alpine as build
1+
FROM node:16.15.1-alpine as build
22

33
WORKDIR /server-build
44

@@ -11,7 +11,7 @@ RUN NPM_VERSION=$(node -p 'require("./package.json").engines.npm'); npm i -g npm
1111
RUN npm ci --build-from-source --sqlite=/usr/local
1212

1313
# ---- RUNTIME IMAGE ----------------------------------------------------------
14-
FROM node:16.15.0-alpine
14+
FROM node:16.15.1-alpine
1515

1616
WORKDIR /app
1717
LABEL maintainer="ferdium"

app/Controllers/Http/ServiceController.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const Helpers = use('Helpers');
66
const { v4: uuid } = require('uuid');
77
const path = require('path');
88
const fs = require('fs-extra');
9+
const sanitize = require('sanitize-filename');
910

1011
class ServiceController {
1112
// Create a new service for user
@@ -231,10 +232,21 @@ class ServiceController {
231232
}
232233

233234
async icon({ params, response }) {
234-
const { id } = params;
235+
let { id } = params;
236+
237+
id = sanitize(id);
238+
if (id === '') {
239+
return response.status(404).send({
240+
status: "Icon doesn't exist",
241+
});
242+
}
235243

236244
const iconPath = path.join(Helpers.tmpPath('uploads'), id);
237-
if (!(await fs.exists(iconPath))) {
245+
246+
try {
247+
await fs.access(iconPath);
248+
} catch {
249+
// File not available.
238250
return response.status(404).send({
239251
status: "Icon doesn't exist",
240252
});

package-lock.json

Lines changed: 45 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"description": "Ferdium server to replace the default Franz/Ferdi server.",
66
"main": "index.js",
77
"engines": {
8-
"node": "16.15.0",
9-
"npm": "8.7.0"
8+
"node": "16.15.1",
9+
"npm": "8.13.2"
1010
},
1111
"scripts": {
1212
"prepare": "is-ci || husky install",
@@ -45,6 +45,7 @@
4545
"mysql": "2.18.1",
4646
"node-fetch": "^2.6.7",
4747
"pg": "^8.0.3",
48+
"sanitize-filename": "1.6.3",
4849
"semver": "7.3.5",
4950
"sqlite3": "^4.1.0",
5051
"targz": "^1.0.1",

0 commit comments

Comments
 (0)