Skip to content

feat(action): support hidden arguments in Shell action to prevent credential leaks in execution logs (#4935) - #8094

Open
zanarellidev wants to merge 2 commits into
apache:mainfrom
zanarellidev:issue-4935-hidden-arguments-shell-action
Open

feat(action): support hidden arguments in Shell action to prevent credential leaks in execution logs (#4935)#8094
zanarellidev wants to merge 2 commits into
apache:mainfrom
zanarellidev:issue-4935-hidden-arguments-shell-action

Conversation

@zanarellidev

Copy link
Copy Markdown
Contributor

Description

Fixes #4935.

When running Shell actions with arguments (e.g. API keys, database credentials, passwords, or tokens), Hop currently logs the raw execution command with all arguments visible in the execution log at BASIC log level. This creates a security risk / credential exposure in log sinks, execution history, and UI logs.

This PR adds support for Hidden Arguments in the Shell Action:

  1. POJO & Metadata: Added static inner class ActionShell.ShellArgument with value and hidden properties.
  2. Backward Compatibility: Fully backward compatible with legacy pipeline/workflow XML definitions (via legacy string parsing in loadXml).
  3. Secure Log Masking: Replaces hidden arguments with *** in execution log outputs (logBasic), while preserving raw unmasked argument values for the operating system process execution via ProcessBuilder.
  4. GUI / Dialog: Added a Hidden (Y/N) CCombo column in ActionShellDialog for easy GUI configuration.
  5. Tests: Added unit tests in WorkflowActionShellLoadSaveTest.java covering ShellArgument serialization and hidden flag behavior. All 8 tests in the module pass cleanly.

Testing

  • Unit tests pass via mvn test
  • Spotless code format applied

Thank you for your review!

@mattcasters

Copy link
Copy Markdown
Contributor

Please remove method loadXml() and assure backward compatibility with an integration test.
If needed, implement an ILegacyXml method.
The code change should be very simple and for some reason it's hard to see what is going on.

@zanarellidev

Copy link
Copy Markdown
Contributor Author

Hi @mattcasters, thank you for the review!

I have updated the PR according to your feedback:

  1. Removed loadXml() from ActionShell.java.
  2. Implemented ILegacyXml:
    • ShellArgument implements ILegacyXml to parse values from previous Hop XMLs (<arguments><argument>value</argument></arguments>).
    • ActionShell implements ILegacyXml to handle older numbered tags (<argument0>val0</argument0>).
  3. Simplified the diff: Reverted duplicate command-building branches in executeShell, isolating log masking into a clean buildLogCommand helper.
  4. Backward Compatibility Tests: Added comprehensive tests in WorkflowActionShellLoadSaveTest verifying:
    • Backward compatibility loading old numbered arguments (<argument0>, <argument1>).
    • Backward compatibility loading previous <arguments><argument>val</argument></arguments> format.
    • Serialization & round-trip with the new structure (<value>, <hidden>).
    • Command masking in execution logs.

All tests and spotless checks pass cleanly.

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.

[Feature Request]: Hidden Arguments for Shell Action

2 participants