OpenAPITools / OpenAPITools/openapi-generator
[BUG] The path to generated files is passed to the postprocessor without proper escaping/quoting
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
When using the openapi-generator-cli npm package with the typescript-angular generator and command line argument --enable-post-process-file, the path of each generated file is passed to the postprocess script without escaping or quoting. This results in incorrect arguments if the path where the generated files are saved contains e.g. a space, so that the postprocess script fails.
openapi-generator version
openapi-generator-cli 2.4.13
openapi-generator 4.3.1
Steps to reproduce
- download any openapi schema and save it as
schema.json - create a directory called
test directory(note the space) - create a file called 'test.sh' with the following contents:
#!/bin/bash
for arg in "$@"; do
echo "$arg" >> postprocess.log
done
make this file exectuable
4. Run the command TS_POST_PROCESS_FILE="./test.sh" openapi-generator-cli generate --enable-post-process-file -i schema.json -o '"test directory"' -g typescript-angular
5. Check the output in the file postprocess.log.
Suggest a fix
Pass the path of the generated files to the postprocess script either quoted or escaped such that a path is not improperly split.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with schema.json, the test.sh postprocess script, and an output directory named test directory using the provided openapi-generator-cli command. Trace where generated file paths are passed to the postprocess script; done means the path is received as one argument, which can be verified in postprocess.log.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, java, node.js, typescript
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100