-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
Reduce template dangers #1137
Comments
@sisp would you like to tackle this issue? |
Yes, feel free to assign me to this issue. 👍 |
…1171) I've disabled the use of unsafe features (Jinja extensions, migrations, and tasks) by default and added a new CLI switch `--UNSAFE` which enables them. Templates that don't use unsafe features are unaffected by this change. But Copier will raise an error for templates that do use unsafe features unless the `--UNSAFE` flag is passed. I've not added an interactive prompt that asks for consent for using unsafe features because I think it's not clear how to distinguish between interactive prompting and raising an error when `--UNSAFE` is not passed. For this, I think Copier would need a switch that clearly states whether interactive or non-interactive mode is desired. Currently, `--defaults` implies this for questions. Fixes #1137 BREAKING CHANGE: Copier raises an error when a template uses unsafe features unless the `--UNSAFE` switch is passed
Hey, I understand all the security concerns raised here. But I feel like the We could then add a flag # First time use
copier copy --trust https://github.com/org/trusted-template.git .
# Update does not require the flag
copier update
# Next time use, does not raise
copier copy https://github.com/org/trusted-template.git . |
I feel the same as @fcollonval. I'm exclusively using my own Copier template (I don't think I've ever generated a project using someone else's template), so it feels a bit tedious to add |
Hi! I was expecting something like this 😄 I use fish instead of bash, so adding flags is much cheaper. That can help you. The solution of having a registry of trusted templates was among the ones we considered, but it didn't land because it was Harper. However feel free to open a PR, as it's still good. You can open an issue first if you want to discuss the implementation. |
The addition of this flag is very problematic and I recommend you consider rolling this back. My guess is the majority of your users are building templates for in-house use, and your attempt to implement some form of "safeness" is not appropriate. How are you determining/defining what is "safe"? |
@carlsylvia you can stay on v7 in the meantime. Unless Copier's updates are automatic within your system? |
A simple change in the semantics would fix the issue immediately. If you simply default to not trusting a template and require the user to provide a |
If you want to implement some trusted source repository in the future that is fine, but sometimes the simplest possible solution is the best. |
For the time being we will pin our users to version 7.x until this issue is resolved. |
I like the trust store idea. And it seems it would be a solution for everybody who has raised concerns about the new |
The |
By "entire repo", do you mean a namespace (user namespace or organization/group) on GitHub/GitLab/...? |
I was referring to a GitLab group and/or GitHub org, sorry I was not clear. For example if the copier group contained a collection of template projects then all of projects within https://github.com/copier-org could be trusted, or a single project within the group, depending on the user preference. Not exactly sure how they would specify that preference, but could be convenient to flag the entire group rather than individual template projects. |
Hi folks, I've got the MVP in #1179. I'll wait for your reviews before the merge. For now, it just trusts the current execution, just like copier copy --trust git+https://example.com/tpl1 ./here # One-time trust
copier trust git+https://example.com/tpl1 # Permanent trust
copier copy git+https://example.com/tpl1 ./here # Now it works because it's trusted I don't think it's a good idea to trust an entire organization because one could do |
I would personally prefer to keep the ability to do everything in a single command aka |
Trusting the entire site is preventable with code: just make sure the argument points to an org and not just github.com. |
Yes, but then we have ssh connections to other git providers, non-git templates... well, I'm not telling this isn't feasible, but it's... complex. And the main issue here AFAICS is that some people don't like |
True, not every Git platform stores things under orgs. Git has no concept of organization so this would indeed be complex to support in Copier. |
See rationale in #1137 (comment). Co-authored-by: Sigurd Spieckermann <2206639+sisp@users.noreply.github.com>
Good point!
👌
👍
Also good point! I hadn't considered that.
Yes, I think docs plus the additional question when tasks/migrations/extensions are present or the
--UNSAFE
flag in case of non-interactive usage, as you described above.I think this sounds like a good actions plan to raise awareness of the dangers and let users make conscious decisions. 👍
Originally posted by @sisp in #1132 (reply in thread)
The text was updated successfully, but these errors were encountered: