Skip to content

Conversation

Copy link
Contributor

Copilot AI commented May 20, 2025

This PR adds expanded workshop materials with additional labs to provide more comprehensive coverage of GitHub Copilot features and use cases, addressing the requirements in issue #12.

New Labs Added

Advanced Code Refactoring

  • Added examples of complex legacy code that can benefit from advanced refactoring patterns
  • Included scenarios for architectural refactoring from monolithic to modular design
  • Added examples for optimizing complex algorithms

API Integration Examples

  • Created comprehensive examples for RESTful API integration
  • Added GraphQL API client implementation examples
  • Included authentication patterns with OAuth2 implementation

Security Best Practices with Copilot

  • Added secure password validation and authentication examples
  • Included SQL injection prevention patterns
  • Added JWT security best practices implementation

Complex Unit Testing

  • Added examples of advanced mocking for complex dependencies
  • Included comprehensive integration testing patterns

Database Interaction Patterns

  • Created examples of complex SQL query patterns for data analysis
  • Added ORM implementation patterns with repositories and query builders

UI Automation Scenarios

  • Added advanced test strategy patterns using page objects and design patterns

Documentation Updates

  • Updated github-copilot-lab/note.md with references to new labs
  • Updated main README.md with descriptions of the new workshop materials

The new content provides real-world scenarios that highlight GitHub Copilot's capabilities for assisting with complex development tasks, making the workshop materials more comprehensive and valuable for participants.

Fixes #12.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: jacwu <16080993+jacwu@users.noreply.github.com>
Copilot AI changed the title [WIP] add more workshop labs Add new workshop labs for advanced GitHub Copilot use cases May 20, 2025
Copilot AI requested a review from jacwu May 20, 2025 06:12
Copilot finished work on behalf of jacwu May 20, 2025 06:12
}

// Create session
const sessionId = Math.random().toString(36).substring(2, 15);

Check failure

Code scanning / CodeQL

Insecure randomness High

This uses a cryptographically insecure random number generated at
Math.random()
in a security context.

Copilot Autofix

AI 9 months ago

To fix the issue, replace the use of Math.random() with a cryptographically secure random number generator. In Node.js, the crypto module provides the randomBytes method, which can generate cryptographically secure random values.

The session ID generation logic on line 150 should be updated to use crypto.randomBytes to generate a secure random string. This ensures that the session ID is unpredictable and resistant to attacks.

Steps to implement the fix:

  1. Import the crypto module at the top of the file if it is not already imported.
  2. Replace the Math.random().toString(36).substring(2, 15) logic with a secure random string generated using crypto.randomBytes.

Suggested changeset 1
github-copilot-features/advanced-refactor/monolithic_app.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/github-copilot-features/advanced-refactor/monolithic_app.js b/github-copilot-features/advanced-refactor/monolithic_app.js
--- a/github-copilot-features/advanced-refactor/monolithic_app.js
+++ b/github-copilot-features/advanced-refactor/monolithic_app.js
@@ -4,2 +4,3 @@
 const express = require('express');
+const crypto = require('crypto');
 const bodyParser = require('body-parser');
@@ -149,3 +150,3 @@
     // Create session
-    const sessionId = Math.random().toString(36).substring(2, 15);
+    const sessionId = crypto.randomBytes(16).toString('hex');
     db.sessions[sessionId] = {
EOF
@@ -4,2 +4,3 @@
const express = require('express');
const crypto = require('crypto');
const bodyParser = require('body-parser');
@@ -149,3 +150,3 @@
// Create session
const sessionId = Math.random().toString(36).substring(2, 15);
const sessionId = crypto.randomBytes(16).toString('hex');
db.sessions[sessionId] = {
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add more workshop labs

2 participants