Add additional check for project.license.file#725
Conversation
flit_core/flit_core/config.py
Outdated
| raise ConfigError( | ||
| f"License file path ({license_f}) cannot be an absolute path" | ||
| ) | ||
| if ".." in license_f: |
There was a problem hiding this comment.
Perhaps? Although, normpath just does lexical manipulation and e.g. a/spam/../b might refer to a symlink.
| if ".." in license_f: | |
| if ".." in os.path.normpath(license_f): |
There was a problem hiding this comment.
Or actually, as e.g. a file might be named a..b. I think backslashes are prohibited?
| if ".." in license_f: | |
| if ".." in license_f.split('/'): |
There was a problem hiding this comment.
Perhaps? Although,
normpathjust does lexical manipulation and e.g.a/spam/../bmight refer to a symlink.
Technically, yes. Although I'm not sure it's worth the effort. Same for file names which contain ...
For the overwhelming majority, checking if ".." in license_f: to provide a better error message should be enough.
There was a problem hiding this comment.
Here's the check we do for paths in the sdist include/exclude lists:
flit/flit_core/flit_core/config.py
Lines 239 to 249 in 5f8c75f
I can't think of a use case for a path like foo/../bar (which will normalise to just bar), but it is currently allowed in that case. Whatever we do, I'd like it to be consistent across all the places where a relative path is specified.
b9e7333 to
5f5982b
Compare
|
Thanks! |
Closes #724