Skip to content
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

Configure dotenv_values's search space #509

Open
nevercodecorrect opened this issue Mar 20, 2024 · 0 comments
Open

Configure dotenv_values's search space #509

nevercodecorrect opened this issue Mar 20, 2024 · 0 comments

Comments

@nevercodecorrect
Copy link

Currently the user-specified path could point to any folder and dotenv will parse them anyway even if it is files like /etc/passwd.
The content of the target file would be available in the error message. This could potentially introduce the path traversal vulnerability if the developer misuses it.

from dotenv import load_dotenv
from dotenv import dotenv_values
import os
config = dotenv_values("../../../etc/passwd") 

I am wondering if it is possible to give dotenv_values an additional arguments to control if it would support relative path searching.

@nevercodecorrect nevercodecorrect changed the title Restrict the .env to the current project folder Configure dotenv_values's search space Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant