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

Re-enable file URLs #3675

Closed
4 tasks done
jxu opened this issue May 8, 2022 · 12 comments · Fixed by #5917
Closed
4 tasks done

Re-enable file URLs #3675

jxu opened this issue May 8, 2022 · 12 comments · Fixed by #5917
Assignees
Labels
enhancement New feature or request

Comments

@jxu
Copy link
Contributor

jxu commented May 8, 2022

Checklist

Question

Is it possible to force yt-dlp to read a file with generic extractor like it were a url? I have a RSS XML file and file:// prefix is forbidden, so I used a local python http.server as a workaround.

Verbose log

No response

@jxu jxu added the question Question label May 8, 2022
@pukkandan
Copy link
Member

pukkandan commented May 8, 2022

file:// is disabled due to security concerns

so I used a local python http.server as a workaround.

Doesn't that work? (If not, show verbose log) So what is the question again?

@jxu
Copy link
Contributor Author

jxu commented May 8, 2022

Title. How do I get it to read a local podcast XML file? Is that just disabled due to file://

@jxu
Copy link
Contributor Author

jxu commented May 8, 2022

Also I don't see how parsing and downloading from a file on disk is more dangerous than parsing and downloading from some URL online

@coletdjnz
Copy link
Member

coletdjnz commented May 8, 2022

We could add a switch to enable it (with a warning).

See ytdl-org/youtube-dl#8227 for why it was disabled

Related: ytdl-org/youtube-dl#22408

@jxu
Copy link
Contributor Author

jxu commented May 8, 2022

The limitation does not prevent malicious URLs hosted online and is pretty easy to circumvent with a local server, and shouldn't be an issue if yt-dlp not run with elevated permissions (which it should never need to be). I can open a PR but if you can make a quick fix with like --enable-file-url then that would be nice

@jxu jxu changed the title Force generic extractor on podcast file? Re-enable file URLs May 8, 2022
@pukkandan
Copy link
Member

The limitation does not prevent malicious URLs hosted online and is pretty easy to circumvent with a local server

It does not appear you have understood the problem. Read the linked issues again.

That said, an option to enable it should be fine. PR is welcome

@pukkandan pukkandan added enhancement New feature or request and removed question Question labels May 8, 2022
@gamer191
Copy link
Collaborator

gamer191 commented May 9, 2022

We could add a switch to enable it (with a warning).

Why would we need a warning? You'd expect a server administrator to be smart enough not to enable it, and afaik it doesn't pose any security risks to regular users (I could be wrong)

@pukkandan
Copy link
Member

Why would we need a warning? You'd expect a server administrator to be smart enough not to enable it, and afaik it doesn't pose any security risks to regular users (I could be wrong)

I agree. Passing switches from untrusted sources is already not safe due to --exec and similar. The original issue is a vulnerability because it works with just the URL. As long as the new switch is not enabled by default, there is no issue and no warning is necessary

@gamer191
Copy link
Collaborator

gamer191 commented May 9, 2022

afaik it doesn't pose any security risks to regular users (I could be wrong)

Now that I think about it though, I wonder if it would be possible for websites to maliciously gain access to yt-dlp's output. I doubt it, but I'm not 100% sure.

Also, I wonder if this could potentially be a privilege escalation vulnerability (which isn't necessarily enough reason to not do it)

@pukkandan
Copy link
Member

Now that I think about it though, I wonder if it would be possible for websites to maliciously gain access to yt-dlp's output. I doubt it, but I'm not 100% sure.

Not sure what you mean here

Also, I wonder if this could potentially be a privilege escalation vulnerability (which isn't necessarily enough reason to not do it)

yt-dlp does not use any low level system APIs. So if any privilege escalation exists, it will because of reasons beyond our control - ie, vulnerability in either the OS or python.

Besides, I don't see how that is relevant here. The file:// protocol was disabled to account for just one specific vulnerability. As I mentioned before, as long as this feature is not enabled by default, that becomes a non-issue

@coletdjnz
Copy link
Member

coletdjnz commented May 16, 2022

Another workaround for now that doesn't require hosting a server: read the file into a data url (which is supported by yt-dlp)

On bash/zsh you can do:
yt-dlp "data:,$(</path/to/file)"

coletdjnz added a commit to coletdjnz/yt-dlp-dev that referenced this issue Aug 30, 2022
@coletdjnz
Copy link
Member

I have added an option to enable file urls in #2861

@coletdjnz coletdjnz self-assigned this Aug 30, 2022
@coletdjnz coletdjnz linked a pull request Aug 30, 2022 that will close this issue
9 tasks
@coletdjnz coletdjnz mentioned this issue Jan 2, 2023
9 tasks
coletdjnz added a commit that referenced this issue Jan 2, 2023
Closes #3675

Authored by: coletdjnz
@coletdjnz coletdjnz removed a link to a pull request Jun 26, 2023
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: networking
Development

Successfully merging a pull request may close this issue.

4 participants