Skip to content

feat(spp_dci_client): mask OAuth2 client secret in UI#27

Merged
gonzalesedwin1123 merged 2 commits into19.0from
spp_dci_client_mask_oauth_client_secret
Feb 10, 2026
Merged

feat(spp_dci_client): mask OAuth2 client secret in UI#27
gonzalesedwin1123 merged 2 commits into19.0from
spp_dci_client_mask_oauth_client_secret

Conversation

@gonzalesedwin1123
Copy link
Member

Add a computed display field that masks the stored secret with asterisks and only writes through when a new value is provided. Prevents accidental secret exposure when viewing the data source form. Includes formatting fixes from prettier.

Add a computed display field that masks the stored secret with asterisks
and only writes through when a new value is provided. Prevents accidental
secret exposure when viewing the data source form. Includes formatting
fixes from prettier.
@gemini-code-assist
Copy link

Summary of Changes

Hello @gonzalesedwin1123, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the security of OAuth2 client secret handling by introducing a UI-specific field that masks the secret value. This change ensures that sensitive credentials are not inadvertently exposed to users viewing data source configurations, while still allowing for secure updates. The implementation includes robust logic for computing and inversely writing the secret, backed by new tests to guarantee its reliability.

Highlights

  • OAuth2 Client Secret Masking: Implemented a new computed field, oauth2_client_secret_display, to mask the actual OAuth2 client secret in the user interface with asterisks. This prevents accidental exposure of sensitive information when viewing data source configurations.
  • Secure Secret Handling: The new display field is write-only; it accepts new secret values but always shows a masked representation. Writing the mask value itself does not overwrite the stored secret, ensuring data integrity. Clearing the display field will remove the stored secret.
  • Comprehensive Testing: Added a suite of new unit tests to verify the correct behavior of the secret display field, including masking, handling of empty secrets, updating secrets, and preventing accidental overwrites by the mask.
  • UI Updates and Formatting: Updated the data source form view to utilize the new masked display field for the OAuth2 client secret. Additionally, applied minor formatting adjustments to various XML field definitions for improved readability.
Changelog
  • spp_dci_client/models/data_source.py
    • Added a _SECRET_MASK constant for masking secret values.
    • Modified the oauth2_client_secret field to prevent copying and updated its help text.
    • Introduced oauth2_client_secret_display, a new computed and inversed field for UI presentation of the secret.
    • Implemented _compute_oauth2_client_secret_display to mask the secret for display.
    • Implemented _inverse_oauth2_client_secret_display to handle writing new secret values or clearing them.
  • spp_dci_client/tests/test_data_source.py
    • Added test_secret_display_field_masks_value to confirm the display field shows the mask.
    • Added test_secret_display_field_empty_when_no_secret to verify empty display when no secret is set.
    • Added test_secret_display_write_updates_stored_field to ensure new values written to the display field update the stored secret.
    • Added test_secret_display_mask_value_does_not_overwrite to prevent the mask from overwriting the actual secret.
    • Added test_secret_display_clear_removes_secret to confirm clearing the display field removes the stored secret.
  • spp_dci_client/views/data_source_views.xml
    • Replaced oauth2_client_secret with oauth2_client_secret_display in the form view for masked input.
    • Updated the help text for the OAuth2 client secret field in the UI.
    • Applied formatting adjustments to various field, filter, and group definitions for better readability.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a security enhancement by masking the OAuth2 client secret in the data source form. The implementation uses a computed field with an inverse method, which is a solid approach in Odoo. The changes are well-tested, covering various scenarios like updating, clearing, and preserving the secret. The addition of copy=False to the secret field is also a good security practice. I've found a few minor improvement opportunities in the tests to increase maintainability by using the defined constant for the secret mask instead of a hardcoded string.

…rdcoded value

  The secret display tests hardcoded "********" in three places. If the
  mask value changes in the model, the tests would silently break. Now
  references cls.SECRET_MASK set from DCIDataSource._SECRET_MASK.
@gonzalesedwin1123 gonzalesedwin1123 merged commit 5a2ee2f into 19.0 Feb 10, 2026
9 of 10 checks passed
@gonzalesedwin1123 gonzalesedwin1123 deleted the spp_dci_client_mask_oauth_client_secret branch February 10, 2026 04:10
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.

2 participants