Skip to content

Conversation

@sigmaaa
Copy link
Collaborator

@sigmaaa sigmaaa commented Jul 28, 2025

Description

Added an encryption option to the serial monitor page:
image

Fixes # (IEP-1509)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How has this been tested?

Start the serial monitor with or without the "Enable Encryption" option → press Ctrl+T Ctrl+A to run flash from the monitor → idf.py encrypted-app-flash or idf.py app-flash will be executed.

  • Test A
  • Test B

Test Configuration:

  • ESP-IDF Version:
  • OS (Windows,Linux and macOS):

Dependent components impacted by this PR:

  • Serial monitor

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

Summary by CodeRabbit

  • New Features

    • Added an "Enable Flash Encryption" option in serial settings; when enabled, the serial monitor runs with encryption enabled.
  • Style

    • Consistent brace and formatting style applied across serial/monitor components.
  • Documentation

    • New UI label and two tooltips explaining the encryption option and prerequisites; preference is persisted with serial configuration.

@coderabbitai
Copy link

coderabbitai bot commented Jul 28, 2025

Walkthrough

A boolean encryption option was added and propagated through settings, UI, launcher, connector, port/monitor handlers, and IDFMonitor; IDFMonitor now appends the CLI flag "--encrypted" when the option is enabled.

Changes

Cohort / File(s) Change Summary
Serial Monitor Core
bundles/com.espressif.idf.serial.monitor/src/com/espressif/idf/serial/monitor/core/IDFMonitor.java
Added encryptionOption field and constructor parameter; commandArgsWithSocketServer() appends --encrypted when true.
Serial Monitor Handler
bundles/com.espressif.idf.serial.monitor/src/com/espressif/idf/serial/monitor/handlers/SerialMonitorHandler.java
Constructor accepts encryptionOption and passes it to IDFMonitor.
Serial Connector & Port
bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/connector/SerialConnector.java, .../SerialPortHandler.java
Added encryptionOption field to connector and assign from settings in connect(); SerialPortHandler removes unused project field, simplifies adjustPortName, and passes connector's encryptionOption to SerialMonitorHandler.
Serial Settings & UI
.../connector/serial/connector/SerialSettings.java, .../controls/SerialConfigPanel.java, .../controls/SerialSettingsPage.java
Added encryptionOption boolean, ENCRYPTION_ATTR key, getter/setter, load/save persistence; ConfigPanel handles attribute in extract/setup; SettingsPage adds checkbox UI, loads/saves state, and wires to dialog settings.
Launcher & Properties
.../launcher/SerialLauncherDelegate.java
Reads SerialSettings.ENCRYPTION_ATTR from properties and calls settings.setEncryptionOption(...); formatting changes.
i18n Messages
.../nls/Messages.java, .../nls/Messages.properties
Added SerialSettingsPage_EncryptionOption, SerialSettingsPage_EncryptionOptionTooltip1, and SerialSettingsPage_EncryptionOptionTooltip2 fields and property entries.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SerialSettingsPage
    participant SerialSettings
    participant SerialConnector
    participant SerialPortHandler
    participant SerialMonitorHandler
    participant IDFMonitor

    User->>SerialSettingsPage: toggle encryption checkbox
    SerialSettingsPage->>SerialSettings: setEncryptionOption(value) / save()
    User->>SerialConnector: open connection
    SerialConnector->>SerialSettings: getEncryptionOption()
    SerialConnector->>SerialPortHandler: open(...)
    SerialPortHandler->>SerialMonitorHandler: new SerialMonitorHandler(..., encryptionOption, ...)
    SerialMonitorHandler->>IDFMonitor: new IDFMonitor(..., encryptionOption, ...)
    IDFMonitor->>IDFMonitor: if encryptionOption then add "--encrypted"
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

needs translation:CN

Suggested reviewers

  • kolipakakondal
  • alirana01
  • AndriiFilippov

Poem

A rabbit taps keys, ears all a-flutter,
Adds a tiny checkbox — encryption to utter.
From settings to monitor the little flag runs,
"--encrypted" hops in, securing the runs.
Hop forth, bytes safe — a small patch, big fun. 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fea55a8 and c5b5f39.

📒 Files selected for processing (3)
  • bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/controls/SerialSettingsPage.java (6 hunks)
  • bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/nls/Messages.java (1 hunks)
  • bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/nls/Messages.properties (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/nls/Messages.java
  • bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/nls/Messages.properties
  • bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/controls/SerialSettingsPage.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build_macos
  • GitHub Check: build
  • GitHub Check: build_windows
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch IEP-1509

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sigmaaa sigmaaa linked an issue Jul 28, 2025 that may be closed by this pull request
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/connector/SerialSettings.java (2)

33-33: Consider renaming for consistency.

The field name extraMonitorOpts is inconsistent with the getter method name getExtraMonitorOptions() and the purpose (encryption). Consider renaming to encryptionOption for clarity and consistency.

-private boolean extraMonitorOpts;
+private boolean encryptionOption;

72-75: Method naming inconsistency.

The getter method name getExtraMonitorOptions() and setter method name setExtraOptions() are inconsistent with each other and with the field name extraMonitorOpts. Consider using consistent naming throughout.

-public boolean getExtraMonitorOptions()
+public boolean getEncryptionOption()
{
-    return extraMonitorOpts;
+    return encryptionOption;
}

-public void setExtraOptions(boolean extraOptions)
+public void setEncryptionOption(boolean encryptionOption)
{
-    this.extraMonitorOpts = extraOptions;
+    this.encryptionOption = encryptionOption;
}

Also applies to: 105-108

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4ca55bc and 8c9768a.

📒 Files selected for processing (10)
  • bundles/com.espressif.idf.serial.monitor/src/com/espressif/idf/serial/monitor/core/IDFMonitor.java (2 hunks)
  • bundles/com.espressif.idf.serial.monitor/src/com/espressif/idf/serial/monitor/handlers/SerialMonitorHandler.java (1 hunks)
  • bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/connector/SerialConnector.java (3 hunks)
  • bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/connector/SerialPortHandler.java (2 hunks)
  • bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/connector/SerialSettings.java (1 hunks)
  • bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/controls/SerialConfigPanel.java (2 hunks)
  • bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/controls/SerialSettingsPage.java (6 hunks)
  • bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/launcher/SerialLauncherDelegate.java (4 hunks)
  • bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/nls/Messages.java (1 hunks)
  • bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/nls/Messages.properties (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/connector/SerialPortHandler.java (1)
bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/server/SocketServerMessageHandler.java (1)
  • SocketServerMessageHandler (37-41)
bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/nls/Messages.java (8)
bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/internal/Messages.java (1)
  • Messages (20-36)
bundles/com.espressif.idf.launch.serial.ui/src/com/espressif/idf/launch/serial/ui/internal/Messages.java (2)
  • Messages (20-73)
  • Messages (70-72)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/nvs/dialog/Messages.java (1)
  • Messages (10-54)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/partitiontable/handlers/Messages.java (1)
  • Messages (5-19)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/Messages.java (1)
  • Messages (5-41)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/installcomponents/Messages.java (1)
  • Messages (16-32)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/Messages.java (1)
  • Messages (5-20)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/Messages.java (1)
  • Messages (9-86)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: build_macos
🔇 Additional comments (21)
bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/nls/Messages.properties (1)

14-14: LGTM! Clean internationalization property addition.

The new property key follows proper Eclipse NLS naming conventions and provides a clear, user-friendly label for the encryption option UI element.

bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/nls/Messages.java (1)

37-37: LGTM! Standard Eclipse NLS implementation.

The new externalized string field follows the established pattern and properly corresponds to the property key added in Messages.properties.

bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/launcher/SerialLauncherDelegate.java (1)

33-40: LGTM! Good code style improvements.

The formatting changes adding braces to single-line methods and conditionals improve code consistency and maintainability.

Also applies to: 43-46, 49-50, 55-58, 72-78, 84-85, 94-97, 102-105

bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/connector/SerialConnector.java (2)

31-32: LGTM! Consistent formatting improvements.

The formatting changes adding braces improve code consistency and readability throughout the class.

Also applies to: 45-48, 51-54, 56-59, 67-70, 74-77, 80-81, 88-93, 107-121


39-39: LGTM! Clean encryption option integration.

The encryption option is properly integrated into the connector:

  • Added as a protected field for accessibility by related components
  • Correctly initialized from settings during connection setup
  • Follows the established pattern of other configuration fields

Also applies to: 98-98

bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/connector/SerialPortHandler.java (2)

38-38: LGTM! Method simplification.

The adjustPortName method is simplified to directly return the port name. This appears to remove unnecessary conditional logic, making the code cleaner.


115-116: LGTM! Proper encryption option propagation.

The SerialMonitorHandler constructor call is correctly updated to pass the encryption option from the serial connector. This ensures the encryption setting flows through to the monitor handler as intended.

bundles/com.espressif.idf.serial.monitor/src/com/espressif/idf/serial/monitor/core/IDFMonitor.java (3)

43-43: LGTM: Clean field addition.

The new encryptionOption boolean field is properly declared and follows the existing field naming conventions.


45-46: LGTM: Constructor properly updated.

The constructor signature is correctly updated to include the encryptionOption parameter, and the field assignment is properly implemented.

Also applies to: 52-52


77-80: LGTM: Conditional encryption argument handling.

The logic correctly adds the --encrypted command line argument only when the encryption option is enabled, which is the expected behavior.

bundles/com.espressif.idf.serial.monitor/src/com/espressif/idf/serial/monitor/handlers/SerialMonitorHandler.java (3)

20-20: LGTM: Field declaration is correct.

The encryptionOption boolean field is properly declared following the existing pattern.


22-23: LGTM: Constructor properly handles new parameter.

The constructor signature is correctly updated and the field assignment is implemented properly.

Also applies to: 29-29


37-38: LGTM: IDFMonitor constructor call updated correctly.

The constructor call properly passes the encryptionOption parameter to match the updated IDFMonitor constructor signature.

bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/connector/SerialSettings.java (2)

28-28: LGTM: Constant declaration follows conventions.

The new ENCRYPTION_ATTR constant is properly declared and follows the existing naming pattern.


43-43: LGTM: Settings persistence implemented correctly.

The load and save methods properly handle the boolean conversion using Boolean.parseBoolean() and Boolean.toString() with appropriate default values.

Also applies to: 54-54

bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/controls/SerialConfigPanel.java (1)

70-70: LGTM: Data extraction implemented correctly.

The encryption option is properly extracted from settings and stored in the data map using the correct attribute key.

bundles/com.espressif.idf.terminal.connector.serial/src/com/espressif/idf/terminal/connector/serial/controls/SerialSettingsPage.java (5)

64-65: LGTM: UI fields properly declared.

The new checkbox and boolean fields are properly declared following the existing pattern.


77-77: LGTM: Proper initialization from dialog settings.

The encryption option is correctly initialized from dialog settings with proper boolean parsing.


159-161: LGTM: UI checkbox creation is well implemented.

The encryption checkbox is properly created with appropriate layout data and uses the externalized message for the label.


204-204: LGTM: Settings loading handles checkbox state.

The loadSettings method properly sets the checkbox selection based on the stored encryption option.


213-213: LGTM: Settings persistence is comprehensive.

The saveSettings method correctly updates both the settings object and dialog settings with the checkbox state, ensuring proper persistence across different layers.

Also applies to: 218-218

@sigmaaa
Copy link
Collaborator Author

sigmaaa commented Jul 31, 2025

Hi @kolipakakondal, @alirana01

I added a simple option, but it ended up requiring changes to 10 files. I'm planning to refactor the related code in a separate PR.

Copy link
Collaborator

@kolipakakondal kolipakakondal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@alirana01 alirana01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alirana01
Copy link
Collaborator

Can we please verify if the failure on tests is intermittent or related to this PR?

@AndriiFilippov
Copy link
Collaborator

@sigmaaa hi !

Tested under:
OS - Windows 11 / Mac arm64
ESP-IDF: v5.5

the -E option in idf.py monitor -E works as expected, able to trigger encrypted-app-flash and encrypted-flash in Monitor using Ctrl T+A / Ctrl T+F
the added tooltip clearly explains the added feature ✅
the original reported issue has been resolved ✅
LGTM 👍

@sigmaaa sigmaaa merged commit b4b330d into master Aug 15, 2025
2 of 5 checks passed
@kolipakakondal kolipakakondal added this to the v3.7.0 milestone Oct 9, 2025
@coderabbitai coderabbitai bot mentioned this pull request Oct 29, 2025
5 tasks
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.

Terminal monitor still cannot build, flash or app flash (IEP-1509)

5 participants