OpenFn / OpenFn/kit

Contain paths taken from a project file

Open
#1,514 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
21
Forks
23
Avg merge
1d 22h
Merged PRs (30d)
17

Description

Several places in the CLI take a path out of a project's own files and use it directly, so a project you did not author can point them anywhere on the machine.

openfn project clean deletes whatever dirs.workflows points at. Setting it to ../victim in a checked-in openfn.yaml removes that directory, because Workspace.workflowsPath builds it with a bare path.join and clean.ts rimrafs the result.

A step id goes into a cache filename without being flattened, so an id of ../../../../pwned writes outside the cache root, and load-state.ts reads that same path back as the run's starting state.

A symlink committed into a workflow repo is followed. The containment check in from-fs.ts resolves the directory a file sits in but not the file itself, so a link at the end of the path passes and whatever it points at is read in as a job's source and pushed on the next deploy. Git preserves symlinks, so a cloned repo is enough.

The awkward part is that some of these paths are legitimately absolute and outside the project, and the CLI's own fixtures rely on it, so a blanket refusal breaks real usage. Worth deciding once rather than per site.

Came up while looking at how names become filenames for lightning#4577. None of it needs an unusual name.

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start by tracing Workspace.workflowsPath into clean.ts, then inspect the cache filename handling and load-state.ts. Read from-fs.ts to understand the existing containment check and how symlinks are handled. Done means one agreed path-containment policy covers these cases without breaking the absolute external paths used by the CLI fixtures.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, security
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.