Spaces:
Running
Running
| # Safe commit script - removes sensitive data before committing | |
| # سكريبت commit آمن - يزيل البيانات الحساسة قبل الرفع | |
| echo "🔒 فحص الأمان قبل الرفع | Security check before commit" | |
| echo "=" * 60 | |
| # Check for sensitive files | |
| echo "🔍 فحص الملفات الحساسة..." | |
| # Check if .env exists | |
| if [ -f ".env" ]; then | |
| echo "⚠️ تحذير: ملف .env موجود - سيتم تجاهله" | |
| echo "Warning: .env file exists - will be ignored" | |
| fi | |
| # Check for token patterns in files | |
| echo "🔍 البحث عن رموز في الملفات..." | |
| if grep -r "hf_[a-zA-Z0-9]\{34\}" . --exclude-dir=.git --exclude="*.md" --exclude=".env*" 2>/dev/null; then | |
| echo "❌ تم العثور على رموز في الملفات!" | |
| echo "Found tokens in files!" | |
| echo "يرجى إزالة الرموز قبل الرفع" | |
| echo "Please remove tokens before committing" | |
| exit 1 | |
| fi | |
| # Check for .token_key file | |
| if [ -f ".token_key" ]; then | |
| echo "⚠️ تحذير: ملف .token_key موجود - سيتم تجاهله" | |
| echo "Warning: .token_key file exists - will be ignored" | |
| fi | |
| echo "✅ فحص الأمان مكتمل - لا توجد مشاكل" | |
| echo "Security check complete - no issues found" | |
| # Add files safely | |
| echo "📁 إضافة الملفات الآمنة..." | |
| git add . | |
| git status | |
| echo "💬 رسالة الcommit:" | |
| echo "Fix security issues and remove sensitive tokens from documentation | |
| SECURITY IMPROVEMENTS: | |
| - Remove real tokens from TOKENS_GUIDE.md and setup_tokens.py | |
| - Add comprehensive SECURITY.md guide | |
| - Update .gitignore to prevent sensitive file commits | |
| - Create safe commit script for future use | |
| - Update README.md with security warnings | |
| TOKEN MANAGEMENT: | |
| - Modified setup_tokens.py to read from environment variables | |
| - Updated documentation to use placeholder tokens | |
| - Added security warnings throughout documentation | |
| - Enhanced .gitignore for better protection | |
| SAFE FOR PUBLIC REPOSITORY: | |
| - No real tokens in any committed files | |
| - All sensitive data moved to .env (ignored) | |
| - Comprehensive security documentation added | |
| - Safe development practices documented" | |
| # Commit with the message | |
| git commit -m "Fix security issues and remove sensitive tokens from documentation | |
| SECURITY IMPROVEMENTS: | |
| - Remove real tokens from TOKENS_GUIDE.md and setup_tokens.py | |
| - Add comprehensive SECURITY.md guide | |
| - Update .gitignore to prevent sensitive file commits | |
| - Create safe commit script for future use | |
| - Update README.md with security warnings | |
| TOKEN MANAGEMENT: | |
| - Modified setup_tokens.py to read from environment variables | |
| - Updated documentation to use placeholder tokens | |
| - Added security warnings throughout documentation | |
| - Enhanced .gitignore for better protection | |
| SAFE FOR PUBLIC REPOSITORY: | |
| - No real tokens in any committed files | |
| - All sensitive data moved to .env (ignored) | |
| - Comprehensive security documentation added | |
| - Safe development practices documented" | |
| echo "✅ تم الcommit بأمان!" | |
| echo "Safe commit completed!" | |
| echo "" | |
| echo "🚀 يمكنك الآن الرفع بأمان:" | |
| echo "You can now push safely:" | |
| echo "git push origin main" | |