Web UI: SaveAsDialog filename field accepts path separators and traversal segments

Open Beginner friendly
#132 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
react, typescript
Domain
frontend, security

Research direction

Start with normalizeSaveAsFilename in src/profiles/web/src/components/SaveAsDialog.tsx:28-40 and inspect how filenameError is displayed; check client.ts:296-307 to confirm how the filename and directory are submitted. Add the requested filename validation while preserving the extension whitelist, then verify the invalid names are rejected in the dialog.

Written by the indexing model from the issue text.

Description

bug frontend

Problem

normalizeSaveAsFilename only checks the extension suffix (src/profiles/web/src/components/SaveAsDialog.tsx:28-40):

if (matched !== undefined) {
  const stem = name.slice(0, name.length - matched.length);
  if (!stem.trim() || stem !== stem.trimEnd()) return null;
  return name;
}

"subdir/machine.profiles", "..\server.profiles", "con.profiles" all pass and are POSTed verbatim (client.ts:296-307) alongside a separate directory field — the target then depends entirely on how the server joins them; worst case the write lands outside the chosen directory, best case an obscure server error after the compliance gate already ran. Windows reserved names (CON, NUL, …) are also unvalidated.

Suggested fix

Reject names containing / or \, segments equal to ./.., and reserved device names, with the existing inline filenameError surface; keep mirroring the server whitelist for extensions. Server-side enforcement of the joined path should additionally be tracked under the #29 hardening backlog.

Dominant language
Python
Stars
1
Forks
1
Avg merge
4h 46m
Merged PRs (30d)
55

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from falbany/ProFiles

All issues in falbany/ProFiles

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.