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

Migrate away from Mono's ProtectedData implementation #3266

Open
2 tasks done
TheCakeIsNaOH opened this issue Jul 14, 2023 · 0 comments
Open
2 tasks done

Migrate away from Mono's ProtectedData implementation #3266

TheCakeIsNaOH opened this issue Jul 14, 2023 · 0 comments

Comments

@TheCakeIsNaOH
Copy link
Member

Checklist

  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my request.

Is Your Feature Request Related To A Problem? Please describe.

Currently, on non-Windows platforms, Chocolatey CLI runs on Mono and uses Mono's ProtectedData implementation to obfuscate saved passwords and remembered arguments.

If Chocolatey moves to being build on dotnet, Mono will no longer be used, as dotnet will be the underlying runtime. So then any upgraded installations of Chocolatey CLI on non-Windows platforms will have two issues:

  1. ProtectedData is not available on non-Windows platforms in dotnet, so an alternative would need to be determined.
  2. Any obfuscated data on disk would no longer be able to be decrypted, as the Mono implementation would no longer be available.

Due to the second problem, migrating away from the Mono ProtectedData implementation soon would be ideal.

Describe The Solution. Why is it needed?

There are a number of potential solutions I can think of. All of these would be for non-Windows only, as Windows installs would be able to continue to use ProtectedData without interuption.

  1. Don't do any obfuscation at all, just save things as plain text.
  2. Do some obfuscation, e.g. OR-ing data with a known pattern, converting to base64, other simple obfuscation techniques.
  3. Encrypt with a static key that is shipped/embedded into Chocolatey CLI
  4. Use a generated encryption key, and save the key somewhere (maybe next to the chocolatey.config file?).
  5. Use platform-specific key management systems (keychain on Mac, a bunch of different potential options on Linux

I don't think that using platform specific key management would be a good idea in terms of the complexity it would entail. I also don't think that having strings as plain text would be ideal either, as then things like a grep search could immediately show source passwords.

Doing some obfuscation, or using a static key embedded into Chocolatey would be better, but this would mean that if the file was copied to another machine, it could still be decrypted (e.g. if someone pastes their chocolatey.config into a gist, or backs it individually).

So using a generated encryption key seems like the best option, and it provides a very similar level of protection/obfuscation to the current implementation. Since the Mono machine level keys are generally globally readable from what I understand, anyone with access to the machine or the file system can decrypt ProtectedData blobs from that machine. The one disadvantage I can think of is that it means if the Chocolatey install folder is copied to another machine, the values would still be able to be decrypted. But otherwise, this seems like a good option.

And if people don't want source passwords saved in the config file, they can always pass it in at runtime with --password

Additional Context

No response

Related Issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant