celo-org / celo-monorepo

Official repository for core projects comprising the Celo platform
https://celo.org
Apache License 2.0
687 stars 362 forks source link

Added Check to CeloDistributionSchedule `activate` function #11109

Closed soloseng closed 6 days ago

soloseng commented 2 weeks ago

Description

Added a check that prevents activating the CeloDistributionSchedule contract if the distributionSchedule contract address if not set in CELO token contract.

Previously, it was expected that the CeloDistributionSchedule address would be manually set in the GoldToken contract by calling setCeloTokenDistributionSchedule(). This was expected to be done before calling activate() in the CeloDistributionSchedule. However, the CeloDistributionSchedule contract did not verify that the CeloDistributionSchedule address was set in the GoldToken contract, allowing for the CeloDistributionSchedule to be incorrectly activated.

These new changes get the CeloDistributionSchedule address from the registry, instead of setting it in the GoldToken contract. Hence, no longer requiring that the CeloDistributionSchedule address be manually set in the GoldToken contract before activating the CeloDistributionSchedule contract.

Tested

unit tested

gitguardian[bot] commented 1 week ago

⚠️ GitGuardian has uncovered 1 secret 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 secret in your pull request
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | | | -------------- | ------------------ | ------------------------------ | ---------------- | --------------- | -------------------- | | [10538986](https://dashboard.gitguardian.com/workspace/286247/incidents/10538986?occurrence=160551688) | Triggered | Generic High Entropy Secret | e379b5c43548b915d8a9e03f9c2d9b48d31f60a2 | packages/protocol/scripts/foundry/constants.sh | [View secret](https://github.com/celo-org/celo-monorepo/commit/e379b5c43548b915d8a9e03f9c2d9b48d31f60a2#diff-6dbf3b6a58b42af6d81011adca70b6cd3db90af76d9216223576607ff06f60ecR4) |
🛠 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 secret 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 this secret](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.

soloseng commented 1 week ago

I'm not 100% sure I understand the original bug, and how this PR fixes it, so not super comfortable approving. But left some nit comments from reading through the PR.

Updated the PR description to make it more clear what the changes are and why they were needed.