-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mention override_temp_dir
and custom permissions on the main crate documentation page
#303
Comments
These are two different things:
|
Thanks so much for the quick reply!
As an example, I am thinking an addition behavior similar to import tempfile
import os
print(tempfile.tempdir)
# None
print(tempfile.mkdtemp())
# /home/erickg/Dev/tmp
tempfile.tempdir = '/home/erickg/Dev/tmp'
print(tempfile.tempdir)
# /home/erickg/Dev/tmp
print(tempfile.mkdtemp())
# /home/erickg/Dev/tmp/tmp6wwa41b7
tempfile.tempdir = None
os.environ["TMPDIR"] = "/home/erickg/Dev/container"
print(tempfile.mkdtemp())
# /home/erickg/Dev/container/tmpye6ruw3 I will update my original post to make it more accurate. |
That's what |
Right, sorry for not understanding words.
Of course, this is a user process's responsibility. For better visibility of these features, can I add a section in the crate documentation? e.g., mentioning a few "advanced" use cases with examples such as:
They should be a few sentences but linked to the detailed documentation. |
override_temp_dir
and custom permissions on the main crate documentation page
Thanks for all your answers. I have updated the issue title and description. Tell me if it's a good idea. Otherwise, I am happy for the answers to close the issue. |
If you can think of a good, succinct way to document it, sure. |
Partially addresses Stebalien#303.
Hi, I created a pull request that just draws attention to The OWASP Foundation's resource mentions potential attack vectors, such as the attacker being able to predict the name of a temporary file.
This may be a particular problem if a file is closed and reused at a later point - despite the documentation recommending against so. In my use case, I somewhat got away with it by setting the tempdir's permissions to |
Minor wording fixes. Increases visibility of `Builder::permissions`, the `NamedTempFile` Security documentation and `env::override_temp_dir`. Partially addresses Stebalien#303.
Minor wording fixes. Increases visibility of `Builder::permissions`, the `NamedTempFile` Security documentation and `env::override_temp_dir`. Partially addresses Stebalien#303.
Nice! I'm happy to build on top of your PRs.
Check out
If an attacker gains user or root privilege, |
I propose updating the front page of the crate documentation to include brief mentions of key features that are currently documented but might not be immediately visible to users. Specifically:
tempfile::env::override_temp_dir
Builder
patternMotivation:
While these features are already detailed elsewhere in the documentation, mentioning them upfront would:
Draft of a new section or as new examples:
Set custom permissions with the
Builder
patternCreate temporary files or directories with custom permissions to enhance security.
Programmatically set the temporary directory
You can override the default temporary directory within your application without relying solely on environment variables.
The text was updated successfully, but these errors were encountered: