Skip to content

bug: keep the key path and leave libraries alone on cloud pull --encrypt - #689

Open
Amadeus-22 wants to merge 1 commit into
QuantConnect:masterfrom
Amadeus-22:bug-688-pull-encrypt-key-path
Open

Amadeus-22 wants to merge 1 commit into
QuantConnect:masterfrom
Amadeus-22:bug-688-pull-encrypt-key-path

Conversation

@Amadeus-22

Copy link
Copy Markdown
Contributor

Closes #688

Description

lean cloud pull --encrypt marked the project encrypted but never stored encryption-key-path. PushManager._push_project only re-encrypts when that path is set, so the next plain lean cloud push sent the encrypted file contents as source code with encryption_key='', leaving the cloud project unencrypted with ciphertext as its code. --decrypt left a stale encryption-key-path behind.

_pull_project now sets the key path on encrypt and removes it on decrypt, the same way lean encrypt and lean decrypt do.

pull_projects also passed the encryption action and key to the libraries it adds to the pull, so pull --project P --encrypt encrypted the shared libraries P references. Push deliberately leaves associated libraries unencrypted, so the action now applies only to the projects that were asked for; libraries are pulled as they are in the cloud.

How Has This Been Tested?

Three new tests in tests/commands/cloud/test_pull.py, all failing on master and passing with the fix:

  • test_cloud_pull_stores_the_key_path_with_encrypted_flag_given: pull with --encrypt, then a plain push sends the key hash.
  • test_cloud_pull_removes_the_key_path_with_decrypted_flag_given
  • test_cloud_pull_does_not_encrypt_referenced_libraries_with_encrypted_flag_given

pytest tests/commands/cloud/test_pull.py passes on Python 3.12. In my environment a few tests in test_push.py, test_project_manager.py and test_api_client.py fail on master too, and the set changes between runs, so they are unrelated to this change.

🤖 Generated with Claude Code

cloud pull --encrypt set `encrypted` without `encryption-key-path`, so a
later plain push uploaded the encrypted contents as source code with no
encryption key, leaving the cloud project unencrypted. --decrypt left a
stale key path behind. Set and remove the key path the same way
`lean encrypt` and `lean decrypt` do.

The encryption action was also applied to the libraries added to the
pull, while push deliberately leaves associated libraries unencrypted.
Apply it only to the projects that were asked for.

Closes QuantConnect#688

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cloud pull --encrypt leaves the project without its key path and encrypts referenced libraries

1 participant