SuffolkLITLab / FormFyxer

A tool for learning about and pre-processing forms
MIT License
11 stars 1 forks source link

Add some DOCX modification functions #130

Closed nonprofittechy closed 7 months ago

nonprofittechy commented 7 months ago

Close #125 Close #22

This adds functions to automatically add Jinja2 labels to a DOCX template, while preserving the formatting. It's a multi-step process that gives an author a chance to review each change before accepting it.

In tests its performed pretty well as a time-saving step. The output is not guaranteed to be valid Jinja2 syntax. I've experimented mostly with a temperature of 0.5 which can lead to interesting variation.

Going to merge, but welcome feedback on the PR after. This should be considered an experimental feature for a bit.

gitguardian[bot] commented 7 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 | Secret | Commit | Filename | | | -------------- | ------------------------- | ---------------- | --------------- | -------------------- | | [8798756](https://dashboard.gitguardian.com/incidents/8798756?occurrence=119716730) | OpenAI API Key | ebafa0fd4939b6baffbe73952ba3950bb0d88d09 | formfyxer/docx_wrangling.py | [View secret](https://github.com/SuffolkLITLab/FormFyxer/commit/ebafa0fd4939b6baffbe73952ba3950bb0d88d09#diff-ae6830d8b745137aceec017783021eff2dd59848a0e0b4ace86af9ee430a8ab5L11) | | [8798756](https://dashboard.gitguardian.com/incidents/8798756?occurrence=119716702) | OpenAI API Key | 573c485ed6d7b5bb5b1140e3b36ba14dac7ae990 | formfyxer/docx_wrangling.py | [View secret](https://github.com/SuffolkLITLab/FormFyxer/commit/573c485ed6d7b5bb5b1140e3b36ba14dac7ae990#diff-ae6830d8b745137aceec017783021eff2dd59848a0e0b4ace86af9ee430a8ab5R11) |
🛠 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/detectors/specifics/openai_apikey#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!