kbsali / php-redmine-api

A simple PHP Redmine API client, Object Oriented
MIT License
420 stars 183 forks source link

Deprecate `AbstractApi::get()` #381

Closed Art4 closed 8 months ago

Art4 commented 8 months ago

AbstractApi::get() does not allow to specify the content type header for the request and could return string|array|SimpleXMLElement|false. In this PR I moved the logic from this method into the API classes. There we can better see the possible return types and I've updated the phpdoc return types accordingly.

Thanks to new and improved tests I could also fix a bug in Redmine\Api\Attachment::download() returning false on error instead of the HTML 404 error page.

This PR removes the @internal mark from the new HttpClient and Request interfaces and deprecates AbstractApi::get().

I will do the same for AbstractApi::post(), AbstractApi::put() and AbstractApi::delete() in separate PRs, see #372.

Requires #378.

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (81259f3) 97.63% compared to head (2f6b3d7) 97.71%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## v2.x #381 +/- ## ============================================ + Coverage 97.63% 97.71% +0.07% - Complexity 563 589 +26 ============================================ Files 29 29 Lines 1609 1707 +98 ============================================ + Hits 1571 1668 +97 - Misses 38 39 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

gitguardian[bot] commented 8 months ago

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | | | -------------- | ------------------ | ------------------------------ | ---------------- | --------------- | -------------------- | | [9556153](https://dashboard.gitguardian.com/incidents/9556153?occurrence=124751081) | Triggered | Generic High Entropy Secret | 97b80d91a83103c318d2e71ea0366d4f9ae256d7 | tests/Behat/features/wiki.feature | [View secret](https://github.com/kbsali/php-redmine-api/commit/97b80d91a83103c318d2e71ea0366d4f9ae256d7#diff-81b87515920de852089dd866d2fc8f17b47155cf191be809e196960225700c7cR53) | | [9556153](https://dashboard.gitguardian.com/incidents/9556153?occurrence=124751082) | Triggered | Generic High Entropy Secret | 97b80d91a83103c318d2e71ea0366d4f9ae256d7 | tests/Behat/features/wiki.feature | [View secret](https://github.com/kbsali/php-redmine-api/commit/97b80d91a83103c318d2e71ea0366d4f9ae256d7#diff-81b87515920de852089dd866d2fc8f17b47155cf191be809e196960225700c7cR138) |
🛠 Guidelines to remediate hardcoded secrets
1. Understand the implications of revoking this secret by investigating where it is used in your code. 2. Replace and store your secrets safely. [Learn here](https://blog.gitguardian.com/secrets-api-management?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment) the best practices. 3. Revoke and [rotate these secrets](https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/generics/generic_high_entropy_secret#revoke-the-secret?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment). 4. If possible, [rewrite git history](https://blog.gitguardian.com/rewriting-git-history-cheatsheet?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment). Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data. To avoid such incidents in the future consider - following these [best practices](https://blog.gitguardian.com/secrets-api-management/?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment) for managing and storing secrets including API keys and other credentials - install [secret detection on pre-commit](https://docs.gitguardian.com/ggshield-docs/integrations/git-hooks/pre-commit?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment) to catch secret before it leaves your machine and ease remediation.

🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!