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

Aberta
#688 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 3 dias

@Amadeus-22 já está trabalhando nisso.

Desde 30/10/2026.

  • #689 de @Amadeus-22 — aberto

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
25/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
python
Domínio
cli

Direção de pesquisa

Start with PullManager._pull_project and pull_projects, then compare the encryption-key handling with encrypt.py and decrypt.py; the issue also points to push_manager.py for how associated libraries are handled. Check the relevant tests for pull encryption behavior. Done means encrypt and decrypt keep the project config consistent, and pulled libraries are not encrypted; a linked pull request is already open.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Expected Behavior

lean cloud pull --encrypt --key <key> leaves the local project in the same state as lean encrypt --key <key>: files encrypted, encrypted: true and encryption-key-path in the project config, so a later lean cloud push keeps the cloud project encrypted. --decrypt removes encryption-key-path, like lean decrypt. Referenced libraries are pulled as they are in the cloud, the same way lean cloud push --encrypt already leaves them unencrypted.

Actual Behavior
  1. PullManager._pull_project sets encrypted but never sets or removes encryption-key-path. PushManager._push_project only re-encrypts when that path is present, so a plain push after pull --encrypt uploads the encrypted file contents as source code with encryption_key='':
$ lean cloud pull --project "Python Project" --encrypt --key key.txt   # cloud project was not encrypted
$ lean cloud push --project "Python Project"
# projects/update is called with main.py = 'iFdKTV...==' (ciphertext) and encryption_key = ''

The cloud project ends up unencrypted, with ciphertext as its code. After pull --decrypt, the stale encryption-key-path stays in the config.

  1. PullManager.pull_projects passes the encryption action and key to every pulled project, including the libraries it adds. pull --project P --encrypt therefore encrypts the shared library Library/L on disk and marks it encrypted: true. The push side deliberately skips associated libraries (push_manager.py, "we don't encrypt those"), so the two commands disagree.
Potential Solution

In _pull_project, set encryption-key-path on encrypt and delete it on decrypt, as encrypt.py/decrypt.py do. In pull_projects, apply the encryption action only to the projects that were asked for, not to the libraries added afterwards. I have a PR ready with the fix and tests (fail on master, pass with the fix).

Reproducing the Problem

Run the two commands above on an unencrypted cloud project with a registered key. For the library case, use a project that references a library and check Library/<name>/main.py after the pull.

System Information

lean-cli master at 1873571, Linux.

Checklist
  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
Linguagem predominante
Python
Estrelas
329
Forks
169
Merge médio
4d 2h
PRs com merge (30d)
11

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de QuantConnect/lean-cli

Todas as issues de QuantConnect/lean-cli

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.