Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keep mount path in allowed path #643

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion server/models/DiskUsage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import {isPlatformSupported, diskUsage} from '../util/diskUsageUtil';

import type {SupportedPlatform} from '../util/diskUsageUtil';
import {isAllowedPath} from '../util/fileUtil';

export interface DiskUsageSummary {
id: number;
Expand Down Expand Up @@ -59,7 +60,9 @@
return diskUsage[process.platform as SupportedPlatform](INTERVAL_UPDATE / 2)
.then((disks) => {
// Mountpoints with a very long path are unlikely to be useful.
return disks.filter((disk) => typeof disk.target === 'string' && disk.target.length < 30);
return disks.filter(

Check warning on line 63 in server/models/DiskUsage.ts

View check run for this annotation

Codecov / codecov/patch

server/models/DiskUsage.ts#L63

Added line #L63 was not covered by tests
(disk) => typeof disk.target === 'string' && (disk.target.length < 30 || isAllowedPath(disk.target)),
);
})
.then((disks) => {
if (disks.length !== this.disks.length || disks.some((d, i) => d.used !== this.disks[i].used)) {
Expand Down
Loading