简体   繁体   English

从Web浏览器执行命令提示符(安全)

[英]Executing a command prompt from the web browser (safely)

I'd just like to know how to git clone a file onto a user's desktop when they click a button. 我只想知道如何在用户单击按钮时将文件git克隆到用户的桌面上。

Is it possible? 可能吗? If it is, what measures can I take to prevent any input and or meddling from the user? 如果是,我可以采取什么措施来防止用户的任何输入和/或干预?

I really, really do not someone to hack their way in there and cause people to rm -rf / their computer. 我真的,真的没有人侵入那里,导致人们rm -rf /他们的计算机。

While giving access to the command line from the browser is generally impossible/restricted, you still can trigger a git repo clone from a browser. 虽然从浏览器授予对命令行的访问权限通常是不可能/受限制的,但是您仍然可以从浏览器触发git repo clone。

See: 看到:

https://help.github.com/assets/images/help/desktop/open-in-desktop-button.png

That is because those buttons are links using a protocol (like the x-github-client protocol ) which register an action (here: "opening GitHub Desktop") 那是因为这些按钮是使用协议(例如x-github-client协议 )的链接,该协议注册了一个操作(在这里:“打开GitHub桌面”)

This is a protocol: 这是一个协议:

 [HKEY_CLASSES_ROOT\\x-github-client] @="URL:x-github-client" "URL Protocol"="" 

This is a protocol handler: 这是一个协议处理程序:

 [HKEY_CLASSES_ROOT\\someapp\\shell] [HKEY_CLASSES_ROOT\\someapp\\shell\\open] [HKEY_CLASSES_ROOT\\someapp\\shell\\open\\command] @=someapp.exe \\"%1\\" 

This is what associates an app to a protocol: 这是将应用程序与协议相关联的原因:

 [HKEY_LOCAL_MACHINE\\SOFTWARE\\SomeApp\\Capabilities\\UrlAssociations] "x-github-client"="someapp" 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM