| Ticket UUID: | 1409177 | |||
| Title: | more secure alternative to [tempfile] | |||
| Type: | RFE | Version: | None | |
| Submitter: | dgp | Created on: | 2006-01-18 16:26:07 | |
| Subsystem: | fileutil | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | ||
| Status: | Closed | Last Modified: | 2026-11-21 10:33:57 | |
| Resolution: | Out of Date | Closed By: | serhiy.storchaka | |
| Closed on: | 2026-11-21 10:33:57 | |||
| Description: |
The [tempfile] command creates a new file and returns its name. The caller is then free to [open] that filename. The separation of file creation and the [open] leaves an interval when an attacker might manipulate that file. So care must be taken when using this facility. A more secure strategy is to have one command do all parts: generate the file name, create and open the file, and pass back the channel of the open file in addition to the file name. This is analogous to using mkstmp() instead of tmpnam() in a C program. It would be good to either modify [tempfile] to improve security, or if compatibility is a concern, offer an alternative command for the more secure option. Note there are some security issues that cannot be addressed fully at Tcl script level with Tcl's current built-in commands, and will require a C-coded solution. See TIP 210. | |||
| User Comments: |
serhiy.storchaka added on 2026-11-21 10:33:57:
As noted above, file tempfile in Tcl 8.6 creates and opens the file in one step. Closing. dgp added on 2009-04-11 03:31:12: [file tempfile] is now part of Tcl 8.6. | |||
Home
Blog
Docs
Downloads
Tickets
Timeline
Branches
Tags
Wiki