archethic-foundation / archethic-node

Official Archethic Blockchain node, written in Elixir
GNU Affero General Public License v3.0
75 stars 22 forks source link

Fix AEWeb SSL certs with multi wildcard domains (#1553) #1585

Closed wassimans closed 3 weeks ago

wassimans commented 1 month ago

Description

This PR addresses an issue with the SSL certificate verification logic in the node. Previously, the node validated the SSL certificate for a host domain by comparing it only to the last entry in the list of subjectAltName entries within the certificate. This approach neglected other domain entries and did not consider wildcard domains.

The fix introduces enhanced matching logic that:

This improvement ensures that requests to certified subdomains and wildcard domains are handled correctly according to the SSL certificate’s full set of authorized domains.

Fixes #1553

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

The solution has been tested by implementing and verifying the following test cases:

Checklist:

gitguardian[bot] commented 3 weeks 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.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard. Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secret in your pull request
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | | | -------------- | ------------------ | ------------------------------ | ---------------- | --------------- | -------------------- | | [-](https://dashboard.gitguardian.com/workspace/468086/incidents/secrets) | - | Generic Private Key | 5b9d528754bd7e5d08a305ad3ba19583b125d7b0 | test/archethic_web/aeweb/domain_test.exs | [View secret](https://github.com/archethic-foundation/archethic-node/commit/5b9d528754bd7e5d08a305ad3ba19583b125d7b0#diff-d970ec330b6246c0e4315170efb9fd5b6a8875d8a3969138713f056433d8f1cdL100) |
🛠 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/specifics/private_key_generic#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.