Minimal and modern developer portfolio template built with Next.js - intentionally vulnerable for educational purposes.
THIS REPOSITORY CONTAINS INTENTIONAL SECURITY VULNERABILITIES
This is a demonstration repository for teaching GitHub Advanced Security features. It includes:
- Exposed secrets and API keys
- Vulnerable dependencies
- Insecure code patterns
DO NOT USE THIS CODE IN PRODUCTION
Files to review:
What will be detected:
- Stripe API keys
- AWS credentials
- Azure connection strings
- GitHub tokens
- Database passwords
Expected behavior: GitHub Secret Scanning will automatically detect these patterns and create alerts in the Security tab.
Files to review:
Vulnerable dependencies included:
axios@0.21.1- Known CVE for Server-Side Request Forgerylodash@4.17.19- Multiple security vulnerabilitiesexpress@4.17.1- Potential security issuesnext@12.0.0- Outdated versionreact@17.0.2- Outdated version
Expected behavior: Dependabot will:
- Scan dependencies on push
- Create alerts for known vulnerabilities
- Automatically open pull requests with suggested updates
Vulnerable API endpoints:
- File: pages/api/user-search.js
- Vulnerability: User input directly concatenated into shell command
- Attack example:
username=admin; rm -rf /
- File: lib/db.js
- Vulnerability: Unsanitized user input in SQL queries
- Attack example:
username=admin' OR '1'='1
- File: pages/api/download.js
- Vulnerability: Unrestricted file path access
- Attack example:
filename=../../../../etc/passwd
- File: pages/api/display-message.js
- Vulnerability: Unsanitized user input rendered in HTML
- Attack example:
message=<script>alert('XSS')</script>
Expected behavior: CodeQL will trace data flow from user inputs to dangerous sinks and create security alerts.
- Node.js 14+ installed
- GitHub account with Advanced Security enabled
- Git configured locally
- Push code to GitHub:
git add .
git commit -m "Add security demo scenarios"
git push origin security-for-beginners-
Enable Advanced Security features:
- Go to repository Settings → Security & analysis
- Enable Dependency graph
- Enable Dependabot alerts
- Enable Dependabot security updates
- Enable Secret scanning
- Enable Code scanning (CodeQL analysis)
-
View security alerts:
- Navigate to Security tab
- Check "Code scanning" for CodeQL alerts
- Check "Secret scanning" for exposed credentials
- Check "Dependabot" for vulnerable dependencies
- Remove hardcoded secrets from code
- Use environment variables properly
- Add
.envto.gitignore - Rotate exposed credentials
- Use GitHub Secrets for CI/CD
- Review Dependabot PRs
- Test updated dependencies
- Merge security updates
- Configure Dependabot settings
- Command Injection: Use parameterized commands or allowlists
- SQL Injection: Use prepared statements/parameterized queries
- Path Traversal: Validate and sanitize file paths
- XSS: Sanitize user input, use React's built-in escaping
- GitHub Advanced Security Documentation
- CodeQL Documentation
- Secret Scanning Patterns
- Dependabot Documentation
After working through this demo, you should understand:
- How GitHub automatically detects security vulnerabilities
- The difference between Secret Scanning, Dependabot, and CodeQL
- How to interpret and remediate security alerts
- Best practices for secure coding
- How to configure security policies for your repositories
Remember: This repository is for educational purposes only. Never deploy vulnerable code to production!