Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds validation to Secrets.env_var #3114

Merged

Conversation

thomasjpfan
Copy link
Member

@thomasjpfan thomasjpfan commented Feb 6, 2025

Why are the changes needed?

This PR adds validation for Secret.env_var, so we fail fast when the env_var is not a valid environment variable.

What changes were proposed in this pull request?

Adds validation to Secret.env_var.

How was this patch tested?

Added a unit test for the change.

Summary by Bito

Implementation of environment variable name validation for Secret.env_var using regex pattern validation. The validation ensures names follow the format of uppercase letters, numbers, and underscores, with proper starting character requirements. Test cases were added to verify validation behavior.

Unit tests added: True

Estimated effort to review (1-5, lower is better): 1

@flyte-bot
Copy link
Contributor

flyte-bot commented Feb 6, 2025

Code Review Agent Run #0fef7e

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 9555754..9555754
    • flytekit/models/security.py
    • tests/flytekit/unit/models/core/test_security.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

AI Code Review powered by Bito Logo

@flyte-bot
Copy link
Contributor

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted
Feature Improvement - Enhanced Secret Environment Variable Validation

security.py - Added environment variable name validation using regex pattern

test_security.py - Added test cases for invalid environment variable names

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

Attention: Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 76.76%. Comparing base (9d34416) to head (9555754).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
flytekit/models/security.py 20.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3114      +/-   ##
==========================================
- Coverage   78.20%   76.76%   -1.44%     
==========================================
  Files         292      203      -89     
  Lines       25401    21599    -3802     
  Branches     2779     2781       +2     
==========================================
- Hits        19864    16580    -3284     
+ Misses       4726     4251     -475     
+ Partials      811      768      -43     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@thomasjpfan thomasjpfan merged commit c9bfbd6 into flyteorg:master Feb 7, 2025
109 of 113 checks passed
UmerAhmad pushed a commit to UmerAhmad/flytekit that referenced this pull request Feb 8, 2025
Signed-off-by: Thomas J. Fan <[email protected]>
Signed-off-by: Umer Ahmad <[email protected]>
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.

3 participants