Skip to content

Conversation

@glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Sep 17, 2025

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Replaces a hardcoded Google API key with a safe placeholder and cleans up the MATLAB function for better security and maintainability. πŸ”’βœ¨

πŸ“Š Key Changes

  • πŸ”‘ Removed exposed Google API key and replaced it with 'YOUR_API_KEY_HERE'.
  • 🧹 Improved formatting and readability (spacing, comments) and added a missing end statement.
  • πŸ”— Updated comment link to the current Google API Console.

🎯 Purpose & Impact

  • βœ… Security: Prevents credential leakage and misuse of shared keys.
  • πŸ› οΈ Maintainability: Encourages proper key management and clearer code.
  • ⚠️ Breaking change: Users must now provide their own Google API key, or code using the old embedded key will fail.
  • πŸš€ Best practice: Promotes storing keys outside source control (e.g., environment variables).

Optional tip (safer key handling in MATLAB):

function a = GoogleAPIkey()
a = getenv('GOOGLE_API_KEY');
if isempty(a)
    error('Google API key not set. Define the GOOGLE_API_KEY environment variable.');
end
end

Set it once per session or system:

  • Windows (PowerShell): $env:GOOGLE_API_KEY="your-key"
  • macOS/Linux (bash): export GOOGLE_API_KEY="your-key"

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
@UltralyticsAssistant UltralyticsAssistant added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 17, 2025
@UltralyticsAssistant
Copy link
Member

πŸ‘‹ Hello @glenn-jocher, thank you for submitting an ultralytics/functions-matlab πŸš€ PR! This is an automated response πŸ€– β€” an Ultralytics engineer will review and assist shortly.

To ensure a seamless integration of your work, please review the following checklist:

  • βœ… Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
  • βœ… Synchronize with Source: Confirm your PR is synchronized with the ultralytics/functions-matlab main branch. If it's behind, update it by clicking the 'Update branch' button or by running git pull and git merge main locally.
  • βœ… Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
  • βœ… Update Documentation: Update the relevant documentation for any new or modified features.
  • βœ… Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
  • βœ… Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR by writing "I have read the CLA Document and I sign the CLA" in a new message.
  • βœ… Minimize Changes: Limit your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." β€” Bruce Lee

Notes on this PR:

  • Thanks for removing the hardcoded credential and adding the placeholder in Google/GoogleAPIkey.m β€” great security improvement πŸ”’
  • Since this may be a breaking change for users who rely on the Google API, please ensure the PR description clearly flags this and that any usage instructions are included in docs or comments.
  • Quick tip for users in the PR body is helpful. Keeping it in sync with the updated function signature is appreciated.

For more guidance, please refer to our Contributing Guide. Don’t hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! πŸŽ‰

@glenn-jocher glenn-jocher merged commit f1251cc into main Sep 17, 2025
3 checks passed
@glenn-jocher glenn-jocher deleted the glenn-jocher-patch-1 branch September 17, 2025 10:24
@UltralyticsAssistant
Copy link
Member

πŸŽ‰ Mergedβ€”thank you, @glenn-jocher!

β€œAn ounce of prevention is worth a pound of cure.” β€” Benjamin Franklin
Your PR exemplifies this: removing the exposed Google API key, tightening up the MATLAB function, and guiding users toward proper key management elevates both security and maintainability. Calling out the breaking change and promoting environment variables sets a clear, best-practice path for the community.

Appreciate you raising the bar and making the codebase safer and cleaner. πŸš€

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants