Skip to content

chore(main): pin opentdf dependencies & fix new ruff issues#128

Merged
b-long merged 4 commits intomainfrom
chore/update-pre-commit
Feb 5, 2026
Merged

chore(main): pin opentdf dependencies & fix new ruff issues#128
b-long merged 4 commits intomainfrom
chore/update-pre-commit

Conversation

@b-long
Copy link
Owner

@b-long b-long commented Feb 5, 2026

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @b-long, 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 focuses on maintenance and code quality improvements by updating the ruff linter to its latest version and subsequently applying the code style fixes it identified. The core changes involve simplifying conditional assignments in Python code, replacing verbose if-else constructs with the more idiomatic or operator. This enhances code readability and aligns the codebase with modern Pythonic practices, ensuring better maintainability.

Highlights

  • Ruff Linter Update: The ruff-pre-commit hook has been updated to version v0.15.0, ensuring the project uses the latest linter features and checks.
  • Code Style Refactoring: Several instances of if X else Y expressions for assigning default values have been refactored to the more Pythonic and concise X or Y idiom, addressing issues identified by the updated Ruff linter.
  • Minor Formatting Adjustment: A minor formatting change was applied to a default_factory lambda in tests/config_pydantic.py for improved readability.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .pre-commit-config.yaml
    • Updated the ruff-pre-commit hook version from v0.14.8 to v0.15.0.
  • src/otdf_python/kas_client.py
    • Simplified path = parsed.path if parsed.path else "" to path = parsed.path or "".
  • src/otdf_python/nanotdf.py
    • Refactored obj.data_attributes if obj.data_attributes else None to obj.data_attributes or None.
    • Refactored obj.dissem if obj.dissem else None to obj.dissem or None.
    • Simplified attributes = config.attributes if config.attributes else [] to attributes = config.attributes or [].
    • Simplified policy_type = config.policy_type if config.policy_type else "EMBEDDED_POLICY_PLAIN_TEXT" to policy_type = config.policy_type or "EMBEDDED_POLICY_PLAIN_TEXT".
  • src/otdf_python/tdf.py
    • Refactored obj.data_attributes if obj.data_attributes else None to obj.data_attributes or None.
    • Refactored obj.dissem if obj.dissem else None to obj.dissem or None.
  • tests/config_pydantic.py
    • Adjusted the formatting of a default_factory lambda for OIDC_OP_TOKEN_ENDPOINT.
  • tests/support_otdfctl_args.py
    • Simplified mime_type if mime_type else "text/plain" to mime_type or "text/plain".
    • Simplified attributes if attributes else None to attributes or None.
Activity
  • No specific activity (comments, reviews, approvals) has been recorded for this pull request yet.
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
Contributor

@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 updates the ruff pre-commit hook to version v0.15.0 and applies stylistic fixes, primarily replacing if-else expressions with the more idiomatic or operator for improved code readability. While these stylistic changes are correct and contribute to good repository maintenance, a critical security vulnerability was identified in the KAS URL handling logic. The SDK trusts KAS URLs provided in TDF manifests without validation, leading to a potential OIDC token leak via SSRF. This vulnerability needs to be addressed by implementing a strict allow-list for KAS URLs or validating them against the configured platform URL.

- pins otdfctl to v0.28.0
- pins platform to service/v0.8.2
@b-long b-long force-pushed the chore/update-pre-commit branch from e2695a1 to 418e395 Compare February 5, 2026 02:14
@b-long b-long changed the title chore(main): update pre-commit & ruff, fix issues identified chore(main): pin opentdf dependencies & fix new ruff issues Feb 5, 2026
@b-long b-long merged commit f8406bf into main Feb 5, 2026
10 checks passed
@b-long b-long deleted the chore/update-pre-commit branch February 5, 2026 02:44
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