The current git repository may contain sensitive information in its history.
Before doing anything else: rotate and revoke every exposed credential. Rewriting or replacing the repository does not protect secrets that were already cloned, forked, or seen by CI systems. Treat any secret that ever appeared in a commit as compromised and replace it immediately (new API keys, new Django SECRET_KEY, new tokens, etc.).
Once credentials are rotated, clean the history using one of the approaches below.
mkdir new_repo
cd new_repo
# Copy all files, including hidden ones (dotfiles such as .gitignore, .env.sample)
cp -r /path/to/original/repo/. .
# Remove the old git history
rm -rf .git
# Initialize a fresh repository
git init
git branch -m main # ensure the branch is named 'main'
git add .
git commit -m "Initial commit"
# Add remote and push
git remote add origin <new-repository-url>
git push -u origin main# Install git-filter-repo
pip install git-filter-repo
# Create patterns.txt — prefix literal strings with "literal:" and
# regex patterns with "regex:" so they are matched correctly.
# Example patterns.txt:
# literal:actualSecretKeyValueHere==>REDACTED
# regex:SECRET_KEY\s*=\s*\S+==>SECRET_KEY=REDACTED
# regex:password\s*=\s*\S+==>password=REDACTED
git-filter-repo --replace-text patterns.txt
# git-filter-repo removes the origin remote as a safety measure.
# Re-add it before pushing.
git remote add origin <repository-url>
# Force-push all branches and tags after rewriting
git push --force --all
git push --force --tagsNote:
git-filter-repotreats each line as a literal replacement unless it is prefixed withregex:. Generic glob-style patterns such asSECRET_KEY=.*will not match — useregex:for variable-value patterns.
After cleaning the repository, ensure no new secrets are committed:
- Never commit
.envfiles — add.envto.gitignore - Use a secrets manager or CI secret store to share credentials with team members
- Consider running a pre-commit hook (e.g.
detect-secrets) to catch credentials before they are committed
The following security issues have been addressed in this repository:
-
XSS Vulnerability in Fake Triage Screen:
- Fixed by validating URLs and ensuring only http/https URLs are allowed
- Added URL validation in both frontend templates and backend views
-
HMAC Generation for Media URLs:
- Fixed by removing all percent-decoding from HMAC generation
- Token is now bound to the exact URL byte sequence:
path%2Fmoreandpath/moreproduce different tokens - Prevents reuse of a signed token via a percent-encoded URL variant that could resolve to a different host (e.g.
cdn.example%2F@evil.comauthority mutation)
-
Rate Limiting for Resource-Intensive Endpoints:
- Added rate limiting to the
/proxy/mapendpoint - Added caching to reduce server load
- Added rate limiting to the
- Implement Content Security Policy (CSP) to prevent XSS attacks
- Use HTTPS for all connections
- Regularly update dependencies to patch security vulnerabilities
- Implement proper input validation for all user inputs
- Use a secrets management solution for production environments