Skip to content

feat(sessions): optional AES-256-GCM encryption for saved sessions#533

Open
JessicaMulein wants to merge 2 commits into
cecli-dev:mainfrom
Digital-Defiance:feat/session-encryption-upstream
Open

feat(sessions): optional AES-256-GCM encryption for saved sessions#533
JessicaMulein wants to merge 2 commits into
cecli-dev:mainfrom
Digital-Defiance:feat/session-encryption-upstream

Conversation

@JessicaMulein
Copy link
Copy Markdown

Summary

  • Adds cecli/session_crypto.py (AES-256-GCM, magic header CECLI_ENCRYPTED_SESSION_v1)
  • --session-encrypt / --no-session-encrypt and --session-key-file on the CLI
  • SessionManager encrypts on save and decrypts on load/list when enabled; plaintext JSON unchanged when off
  • Key from CECLI_SESSION_KEY (urlsafe base64, 32 bytes) or key file
  • cryptography>=42 in requirements
  • 26 tests in tests/basic/test_session_{crypto,args,sessions_manager}.py

BrightVision

Parent repo PR will pin this commit and add Vision API + Tauri keychain wiring.

Test plan

  • python -m pytest tests/basic/test_session_crypto.py tests/basic/test_session_args.py tests/basic/test_sessions_manager.py -q

PR Summary by Typo

Overview

This PR introduces optional AES-256-GCM encryption for saved sessions, enhancing data security for sensitive information stored on disk. It allows users to encrypt session files using a provided key, with backward compatibility for unencrypted sessions.

Key Changes

  • Added --session-encrypt and --session-key-file command-line arguments to enable and configure session encryption.
  • Introduced a new module cecli/session_crypto.py containing AES-256-GCM encryption and decryption logic.
  • Modified cecli/sessions.py to handle encrypted and unencrypted session files during saving, loading, and listing.
  • Updated documentation to guide users on enabling and configuring session encryption.
  • Added cryptography as a new dependency for encryption functionality.
  • Included new tests for CLI arguments, session crypto functions, and the session manager's encryption capabilities.

Work Breakdown

Category Lines Changed
New Work 595 (98.2%)
Churn 3 (0.5%)
Rework 8 (1.3%)
Total Changes 606
To turn off PR summary, please visit Notification settings.

Summary by CodeRabbit

Release Notes

  • New Features

    • Optional AES-256-GCM encryption for saved session files to protect sensitive data
    • New --session-encrypt CLI flag to enable session encryption
    • New --session-key-file CLI option to specify a file containing the encryption key
  • Documentation

    • Added comprehensive guides for enabling and configuring session file encryption

Review Change Stack

Add --session-encrypt with CECLI_SESSION_KEY or --session-key-file,
wire encrypt/decrypt through SessionManager save/load/list, and document
usage. Plaintext JSON remains the default when encryption is off.

Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced May 27, 2026
Closed
Apply isort/black formatting on session encryption files. Give legacy
test_sessions mocks explicit args (session_encrypt off, model fields) so
save/load work with SessionManager encryption and Model restore paths.

Co-authored-by: Cursor <cursoragent@cursor.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.

1 participant