heroku / heroku/cli

`config:edit` leaves temporary config vars file around after `Ctrl+C`

Open
#1,997 2 comments 0 reactions 1 assignee Claimed by @ChipV223 View on GitHub
bug on-call reviewed
Dominant language
TypeScript
Stars
889
Forks
236
Avg merge
2d 10h
Merged PRs (30d)
33

Description

Do you want to request a *feature* or report a *bug*?
-----------------------------------------------------
Bug

What is the current behavior?
-----------------------------

If I use `heroku config:edit` and change my mind about editing config vars, and `Ctrl+C` the CLI command rather than first closing the editor with no changes, then the temporary file that holds the env vars/secrets is left on disk in tmp, which is a security risk.

This is using macOS 12.3.1 with Homebrew bash.

What is the expected behavior?
------------------------------

That the temp file containing the env vars is deleted even if I `Ctrl+C` the command before closing the editor.

It seems this could be fixed by enabling `tmp`'s graceful cleanup option:
https://www.npmjs.com/package/tmp#graceful-cleanup
https://github.com/jdxcode/edit-string/blob/2105f5ba946d9eb3cf34b23c91a2e73442f63360/src/edit.ts

Called via:
https://github.com/heroku/cli/blob/b8292f347101f13c2bb833b1dcf088886c8aa984/packages/config/src/commands/config/edit.ts#L105

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.