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

Add max length to secure_filename() #2420

Open
vytas7 opened this issue Dec 10, 2024 · 3 comments
Open

Add max length to secure_filename() #2420

vytas7 opened this issue Dec 10, 2024 · 3 comments
Labels
enhancement good first issue Comment on this issue if you'd like to volunteer to work on this. Thanks!
Milestone

Comments

@vytas7
Copy link
Member

vytas7 commented Dec 10, 2024

There is already a TODO in the source code (falcon/util/misc.py):

    # TODO(vytas): max_length (int): Maximum length of the returned
    #     filename. Should the returned filename exceed this restriction, it is
    #     truncated while attempting to preserve the extension.

Actually implement this max_length parameter according to the above note.

Also add a new option to MultipartParseOptions that is used when evaluating part.secure_filename.

In order to avoid a breaking change, both values should be None by default, with a note that starting from Falcon 5.0, this value will non-nullable, with the new default of NN characters (please suggest).

@vytas7 vytas7 added good first issue Comment on this issue if you'd like to volunteer to work on this. Thanks! enhancement needs contributor Comment on this issue if you'd like to volunteer to work on this. Thanks! labels Dec 10, 2024
@vytas7 vytas7 added this to the Version 4.x milestone Dec 10, 2024
@Krishn1412
Copy link

Hey @vytas7 , can I pick this up?

@vytas7
Copy link
Member Author

vytas7 commented Dec 11, 2024

Sure, go ahead!

@vytas7 vytas7 removed the needs contributor Comment on this issue if you'd like to volunteer to work on this. Thanks! label Dec 11, 2024
@Krishn1412
Copy link

Can you take a look at this? #2421

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue Comment on this issue if you'd like to volunteer to work on this. Thanks!
Projects
None yet
Development

No branches or pull requests

2 participants