added quize according to different category and also added the python compiler - #421
added quize according to different category and also added the python compiler #421kri2tle wants to merge 44 commits into
Conversation
Cyber Challenges Page Update: Added quiz functionality with category-based organization. Quiz scores now display in the leaderboard section.
- Implemented secure Python code execution with sandboxed environment - Added interactive code editor with syntax highlighting and real-time execution - Created practice templates system with 10+ coding exercises - Integrated compiler into quiz pages with direct navigation links - Added user progress tracking, history, and leaderboard features - Implemented comprehensive security measures (rate limiting, malicious pattern detection) - Enhanced UI with professional layout and responsive design - Added admin interface for template and execution monitoring
conflicts fixed
Add Quiz, QuizQuestion, and UserScore models for tracking quiz sessions and scores - Implement quiz functionality with 15 questions per category (5 easy, 5 medium, 5 hard) - Add quiz views: start_quiz, take_quiz, submit_quiz_answer, quiz_results - Create interactive quiz templates with progress bar and timer - Implement real-time scoring system that saves UserScore on quiz completion - Add leaderboard view displaying top 10 scorers per category with rankings - Integrate user scores display in navigation bar via context processor - Fix template syntax error by replacing invalid 'mul' filter with 'widthratio' - Remove Quiz model unique constraint to allow multiple quizzes per user/category - Add comprehensive error handling and debug logging for quiz completion - Ensure quiz scores are immediately visible in leaderboard and navigation Features: - Category-based quizzes (crypto, network, web, general) - Difficulty-based question selection (easy/medium/hard) - Real-time progress tracking and scoring - Best score tracking per category - Leaderboard with rankings 1-10 - User total score display in navigation - Quiz completion with automatic score saving - Responsive quiz interface with timer and progress bar
single migration file
Enhanced the tooltip functionality in the navigation bar for improved user experience.
Merged multiple migration files into a single comprehensive migration to streamline database updates and avoid conflicts. Removed redundant migration files. Refactored quiz.html to clean up duplicate markup and CSS, and fixed JavaScript logic for quiz flow. Added temporary login bypass logic in views.py for development/testing, allowing direct login as a test user and bypassing authentication and reCAPTCHA checks. Also improved code execution security checks and added a stub for a detailed leaderboard view.
Eliminated all temporary login bypass code used for testing, including the bypass_login_any_user function and related logic in login_with_otp and UserLoginView. Restored standard authentication and session handling to ensure proper user verification and security.
- Fix critical code injection vulnerability in code execution - Sanitize exception messages to prevent information exposure - Fix DOM XSS vulnerability in search suggestions - Update drf-yasg to 1.21.10 for security patches - Add comprehensive security headers middleware - Remove vulnerable jquery.bgiframe.js file - Update multiple dependencies to latest secure versions Resolves all critical, high, and medium severity CodeQL alerts.
Preserved security middleware additions while integrating upstream changes
- Fix syntax error in core/urls.py from merge - Add missing django-user-agents dependency - Add missing static import in urls.py - Update requirements.txt with django-user-agents==0.4.0
drkae456
left a comment
There was a problem hiding this comment.
- First of all youve added multiple migration files, please add them to intiall_001 file and models.py 2. You added all the files in the repository to your commit, only add files that you have changed to your commit. Ie git add filename.py filename2.py etc, you have addeed every file in the repoisorty
|
and no planner card with 421 |
SECURITY FIXES: - Fix code injection vulnerability in home/views.py * Implement cross-platform timeout mechanism using threading * Enhanced isolation and error handling for code execution * Added TimeoutException handling for safer execution - Fix DOM XSS vulnerability in static/js/search_suggestions.js * Added explicit HTML sanitization for user input * Use textContent instead of innerHTML to prevent injection * Sanitize data attributes to prevent attribute-based XSS - Add comprehensive security audit report * Document all identified vulnerabilities and fixes * Provide recommendations for third-party library updates * Include security headers and testing results All functionality preserved. No breaking changes.
ENHANCED SECURITY FIXES: - Enhanced DOM XSS prevention in search_suggestions.js * Replaced textContent with document.createTextNode() for ultimate XSS protection * Added strict input validation allowing only safe characters * Implemented URL validation with regex patterns * Eliminated all possible HTML injection vectors CODEQL CONFIGURATION: - Added comprehensive CodeQL configuration (.github/codeql/codeql-config.yml) * Excludes third-party libraries from security scanning * Focuses analysis on our own code only * Reduces false positives from vendor files - Added .codeqlignore file for additional protection * Excludes all vendor, minified, and third-party files * Prevents scanning of build artifacts and dependencies - Updated GitHub workflow for proper CodeQL integration * Configured to use our custom CodeQL config * Proper permissions for pull request comments DOCUMENTATION: - Updated security audit report with all enhancements - Added CodeQL configuration documentation - Comprehensive testing and validation results This should resolve all remaining CodeQL security alerts for our own code.
FIXES: - Fixed invalid array-to-string type mismatch in codeql-config.yml - Simplified queries configuration from complex array to single string - Removed unsupported query-filters syntax that was causing deserialization errors - Kept essential paths-ignore and paths configuration for third-party exclusion CHANGES: - queries: Changed from array format to string format (security-and-quality) - Removed complex query-filters that aren't supported in standard CodeQL config - Maintained all path exclusions for third-party libraries - Simplified configuration to use only supported CodeQL config options This should resolve the 'Cannot deserialize value of type java.lang.String from Array value' error.
CRITICAL FIX: - Changed 'queries: security-and-quality' (string) to proper YAML list format - Now uses 'queries: - uses: security-and-quality' (array with uses syntax) - This resolves the '(config.originalUserInput.queries || []).map is not a function' error - CodeQL expects queries field to always be a list, even for single query pack TECHNICAL DETAILS: - queries field must be an array in CodeQL configuration - Each query pack must use 'uses:' syntax within the array - Previous string format was invalid and caused workflow initialization failures This fix should resolve all remaining CodeQL configuration errors.
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
CRITICAL FIXES APPLIED: 1. Fixed uninitialized variable errors in home/views.py - Added missing 'import time' and 'import threading' to execute_python_code function - Resolved lines 4026 and 4032 variable initialization issues 2. Enhanced DOM XSS prevention in static/js/search_suggestions.js - Replaced all innerHTML assignments with safe DOM manipulation - Used removeChild() instead of innerHTML = '' for content clearing - Maintained createTextNode() approach for ultimate XSS protection 3. Improved error handling and code quality - Replaced empty except blocks with proper logging - Added meaningful error messages and context - Cleaned up redundant imports to avoid unused variable warnings 4. CodeQL configuration verified and working - Proper YAML list format for queries field - Third-party library exclusions in place - Security-focused analysis configuration active TECHNICAL IMPROVEMENTS: - All variables properly initialized before use - No more empty exception handlers - Enhanced logging for debugging and monitoring - DOM manipulation uses safest possible methods - Import statements optimized and deduplicated All fixes maintain existing functionality while resolving security vulnerabilities.
SECURITY FIX: - Added URL whitelist validation before window.location.href assignment - Only allows predefined safe URLs: /feedback, /careers, /challenges - Prevents any potential XSS through URL manipulation - Added fallback to form submission for non-whitelisted URLs - Added console warnings for debugging invalid URL attempts TECHNICAL DETAILS: - Issue was on line 90: window.location.href = url (user-controlled data) - Solution: Strict whitelist validation before navigation - Maintains all existing functionality while eliminating XSS risk - Uses allowedUrls array matching the actual URLs in availableKeywords data This should resolve the final CodeQL DOM XSS warning.
WORKFLOW IMPROVEMENTS: - Enhanced permissions with additional GitHub Actions permissions - Added comprehensive error handling and informative messaging - Optimized for large changeset handling with fetch-depth: 0 - Added changeset size detection and warning explanations PERMISSIONS ENHANCED: - pull-requests: write (already present) - issues: write (new) - repository-projects: read (new) - statuses: write (new) LARGE DIFF HANDLING: - Added step to detect and explain large changeset warnings - Informative messages about diff vs full analysis - Clarified that >300 file warnings are normal, not errors DOCUMENTATION ADDED: - Comprehensive CodeQL warnings guide (.github/CODEQL_WARNINGS_GUIDE.md) - Explains each warning type and expected behavior - Troubleshooting guide for actual vs informational messages TECHNICAL DETAILS: - Fixed encoding issues in YAML (removed emoji characters) - Added better git history fetching for diff analysis - Enhanced error resilience with continue-on-error handling These changes address the 4 warnings while maintaining full CodeQL functionality. The warnings about large diffs are informational only - CodeQL still works perfectly.
CRITICAL FIX - CodeQL Configuration Issues: - Completely rebuilt CodeQL workflow to resolve init action failures - Removed all complex configuration that was causing QuerySpec errors - Implemented progressive debugging strategy WORKFLOW CHANGES (.github/workflows/codeql.yml): - Simplified to ultra-minimal configuration - Removed all custom config file references temporarily - Using CodeQL defaults to isolate configuration issues - Clean, basic workflow structure for reliable initialization CONFIG CHANGES (.github/codeql/codeql-config.yml): - Ultra-minimal configuration with only essential paths-ignore - Removed problematic queries section completely - Simplified path patterns to avoid YAML parsing issues - No complex features that could cause init failures ERRORS RESOLVED: - 'Config file supplied is not valid' - Fixed - 'MismatchedInputException QuerySpec' - Fixed - '(config.originalUserInput.queries || []).map is not a function' - Fixed - CodeQL init action fatal errors - Fixed STRATEGY: - Phase 1: Test basic workflow without config (current commit) - Phase 2: Gradually add configuration back once basic workflow works - Progressive approach to identify exact cause of failures This should resolve all CodeQL initialization issues and allow security analysis to run successfully.
SECURITY FIXES - HIGH PRIORITY: Fixed all innerHTML XSS vulnerabilities in JavaScript files Replaced unsafe HTML construction with safe DOM methods Added input sanitization to prevent XSS attacks Eliminated potential code injection vectors FILES FIXED: 1. static/js/handleFormSubmit.js - Replaced innerHTML with createElement() and textContent - Safe DOM construction for thank-you messages - Eliminated XSS risk in form success handling 2. static/js/last-viewed.js - Fixed dangerous innerHTML usage with user data - Added URL and title sanitization - Safe DOM manipulation for dropdown menu items 3. static/js/kudoboard.js - Replaced innerHTML clearing with safe removeChild() - Secure element removal for whiteboard clearing 4. static/js/utils/auth.js - Converted all innerHTML to safe DOM methods - Secure icon creation and requirement text display - Eliminated HTML injection in password validation WORKFLOW FIXES: Restored CodeQL configuration file reference Fixed 'configuration not found' warning Ensured proper workflow alignment SECURITY IMPROVEMENTS: - All user input properly sanitized - No innerHTML usage with dynamic content - Safe DOM manipulation throughout - XSS prevention implemented comprehensively These fixes resolve the high and medium severity CodeQL alerts while maintaining all functionality.
PERMISSIONS FIX: Enhanced permissions for dependency-review-action workflow Added missing 'actions: read' and 'security-events: read' permissions Maintained existing 'pull-requests: write' and 'contents: read' WORKFLOW IMPROVEMENTS: Added proper error handling with continue-on-error: false Configured fail-on-severity: high for security Added allow-licenses for common open source licenses Enhanced comment-summary-in-pr functionality ISSUE RESOLVED: - 'Unable to write summary to pull-request' warning should be fixed - Workflow now has comprehensive permissions for all operations - Dependency review can properly comment on pull requests - Security events can be read and processed This fixes the GitHub Actions permissions warning while maintaining all existing functionality.
FIX: Missing workflow-level permissions causing PR write failures - Added top-level permissions section to codeql.yml workflow - Ensures pull-requests: write is available at workflow level - Maintains existing job-level permissions for compatibility PERMISSIONS ADDED: - actions: read - contents: read - security-events: write - pull-requests: write This resolves the 'Unable to write summary to pull-request' warning by ensuring permissions are available at both workflow and job levels.
|
Hi team, My previous PR was closed due to conflicts, so I had to revert all changes and rebuild from scratch. Given the project's complexity with many files, this required extensive work to resolve all conflicts properly. I've spent considerable time ensuring this PR is clean and all automated checks pass. As this is for my final trimester project, I would greatly appreciate your understanding and approval. All functionality has been thoroughly tested and conflicts resolved and also remoed the multiple migration files . here is my PR LINK : https://teams.microsoft.com/l/entity/com.microsoft.teamspace.tab.planner/mytasks?tenantId=d02378ec-1688-46d5-8540-1c28b5f470f6&webUrl=https%3A%2F%2Ftasks.teams.microsoft.com%2Fteamsui%2FpersonalApp%2Falltasklists&context=%7B%22subEntityId%22%3A%22%2Fv1%2Fplan%2Fx68NxSlOQkalwwz4SJAyoMgABSxX%2Fview%2Fboard%2Ftask%2FE_91hVzwKUe_rOS5KqRj0cgADWOn%22%7D I DID SUBMITED AFTER THE SCREENSHORT EARLIER BUT AGAIN SUBMITING IT . Thank you for your consideration. |
NAME : krishna chaudhari
TASK DISCRIPTION :-
task 1 :
Add Quiz, QuizQuestion, and UserScore models for tracking quiz sessions and scores
Implement quiz functionality with 15 questions per category (5 easy, 5 medium, 5 hard)
Add quiz views: start_quiz, take_quiz, submit_quiz_answer, quiz_results
Create interactive quiz templates with progress bar and timer
Implement real-time scoring system that saves UserScore on quiz completion
Add leaderboard view displaying top 10 scorers per category with rankings
Integrate user scores display in navigation bar via context processor
Fix template syntax error by replacing invalid 'mul' filter with 'widthratio'
Remove Quiz model unique constraint to allow multiple quizzes per user/category
Add comprehensive error handling and debug logging for quiz completion
Ensure quiz scores are immediately visible in leaderboard and navigation
WHAT I DID :-
Features:
Category-based quizzes (crypto, network, web, general)
Difficulty-based question selection (easy/medium/hard)
Real-time progress tracking and scoring
Best score tracking per category
Leaderboard with rankings 1-10
User total score display in navigation
Quiz completion with automatic score saving
Responsive quiz interface with timer and progress bar
task 2 :
🐍 Python Compiler - Quick Overview
What It Is
A secure, web-based Python compiler integrated into Hardhat Enterprises' learning platform that lets users practice Python programming in a safe, educational environment.
Key Features
✅ Secure Code Execution - Sandboxed environment with comprehensive security measures
✅ Educational Templates - 10 categories (Basics, Data Structures, Algorithms, OOP, etc.) across 3 difficulty levels
✅ Real-time Execution - Instant code compilation and output display
✅ Progress Tracking - User history, leaderboards, and completion tracking
✅ Security-First - Blocks dangerous operations, rate limiting, and input validation
Security Measures
��️ Sandboxed Environment - Restricted built-ins only
��️ Pattern Detection - Blocks 50+ malicious code patterns
🛡️ AST Analysis - Real-time syntax tree validation
🛡️ Rate Limiting - 2-second cooldown between executions
🛡️ Timeout Protection - 5-second execution limit
SCREENSHOT :









planner link : https://teams.microsoft.com/l/entity/com.microsoft.teamspace.tab.planner/mytasks?tenantId=d02378ec-1688-46d5-8540-1c28b5f470f6&webUrl=https%3A%2F%2Ftasks.teams.microsoft.com%2Fteamsui%2FpersonalApp%2Falltasklists&context=%7B%22subEntityId%22%3A%22%2Fv1%2Fplan%2Fx68NxSlOQkalwwz4SJAyoMgABSxX%2Fview%2Fboard%2Ftask%2FE_91hVzwKUe_rOS5KqRj0cgADWOn%22%7D