MajidBenam / seshat

This is the beginning of the Seshat Project code.
0 stars 3 forks source link

Spatial dev work v2 #12

Closed edwardchalstrey1 closed 3 months ago

edwardchalstrey1 commented 4 months ago

Hi @MajidBenam - this PR includes:

As we have discussed, you can set up a dev server to test this before we roll this out to the live site. You'll need to consider the following to test these changes:

  1. You can follow/adapt my instructions in docs/setup.md, which is similar to your own Notion documentation, but also includes installing the PostGIS extension and geospatial packages. You will also need to follow the instructions to populate the Cliopatria and GADM shape data tables from docs/spatialdb.md (ignore the top part of this doc about creating new datasets). I have added the latest Cliopatria shape dataset to a google drive here.
  2. The changes I have made in the settings (and to manage.py) can be changed to suit a configuration that matches your production server. I've tried to edit local.py and base.py so that it works for me without interfering with your production settings, but you can check that and modify if needed. A key change is the ENGINE is changed to 'django.contrib.gis.db.backends.postgis'.
    • Important: I haven't tested whether all aspects of the website work as expected with this new db engine, clicking through pages it all seems fine, but you'll know better if this is true!

If you want to look at a PR with a clearer diff with these changes that doesn't include your work on the Qing branch, there's one here on my fork which you may find easier to look through: https://github.com/edwardchalstrey1/seshat/pull/134/files

I think that should be all, let me know if you need some help with this. After we merge this and you are satisfied it works on a development environment (with any modifications you make to settings etc), I expect you can merge dev into Qing and perform the same steps on the live site.

gitguardian[bot] commented 4 months ago

⚠️ GitGuardian has uncovered 3 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 | | | -------------- | ------------------ | ------------------------------ | ---------------- | --------------- | -------------------- | | [-](https://dashboard.gitguardian.com/workspace/216221/incidents/secrets) | | Generic Password | d230bf9d8ff81f522c9d32255031dd4f1d141a9c | .github/workflows/tests.yml | [View secret](https://github.com/MajidBenam/seshat/commit/d230bf9d8ff81f522c9d32255031dd4f1d141a9c#diff-1db27d93186e46d3b441ece35801b244db8ee144ff1405ca27a163bfe878957fR24) | | [-](https://dashboard.gitguardian.com/workspace/216221/incidents/secrets) | | Generic Password | 4aac0fc2a61ecbd4057c26934f277f5d02d2b6b9 | .github/workflows/tests.yml | [View secret](https://github.com/MajidBenam/seshat/commit/4aac0fc2a61ecbd4057c26934f277f5d02d2b6b9#diff-1db27d93186e46d3b441ece35801b244db8ee144ff1405ca27a163bfe878957fL24) | | [-](https://dashboard.gitguardian.com/workspace/216221/incidents/secrets) | | Generic Password | 4aac0fc2a61ecbd4057c26934f277f5d02d2b6b9 | seshat/settings/local.py | [View secret](https://github.com/MajidBenam/seshat/commit/4aac0fc2a61ecbd4057c26934f277f5d02d2b6b9#diff-ddee1b2c1b81f22d73359bcddf3f4497f9852d9ddbc95bf161605115ef09f725L21) |
🛠 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_password#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.

edwardchalstrey1 commented 4 months ago

Ok with regard to the GitGuardian check, there's not any secrets in the code per se, but looks like it has an issue with the way I'm referencing my stored secret I use to build the docker container used to run my tests (which is safely secured on my GitHub account). I can look into this at a later date, but for now:

  1. I will remove the CI from this branch for now, this is used to run my tests, but we can merge this separately later if you want to have tests running on your repo too
  2. I will remove the highlighted part from the local.py settings
edwardchalstrey1 commented 4 months ago

Ok with regard to the GitGuardian check

  1. I will remove the CI from this branch for now, this is used to run my tests, but we can merge this separately later if you want to have tests running on your repo too
  2. I will remove the highlighted part from the local.py settings

This is still a problem because it's in the Git history, however I don't think the things identified actually pose any security risk. Let me know if you disagree, but hopefully I can avoid re-writing the Git history.

edwardchalstrey1 commented 3 months ago

Closing this as per discussion on https://github.com/edwardchalstrey1/seshat/issues/176 - we will instead set up a new GitHub organisation and repo