Code Quality
What This Demonstrates
Section titled “What This Demonstrates”GitHub Code Quality features — CodeQL analysis, Copilot Autofix, dependency review, and secret scanning — work directly from the GitHub UI and PR workflow.
Prerequisites
Section titled “Prerequisites”- Repository admin access (for enabling features)
- GitHub web UI
a) Enable Code Scanning (CodeQL)
Section titled “a) Enable Code Scanning (CodeQL)”- Navigate to the repo on GitHub → Settings → Code security and analysis. 2. Enable
Code scanning with the default CodeQL setup. 3. Show the auto-generated
codeql.ymlworkflow detecting JavaScript/TypeScript. 4. Trigger a scan and walk through the results under Security → Code scanning alerts.
b) Copilot Autofix on Code Scanning Alerts
Section titled “b) Copilot Autofix on Code Scanning Alerts”- Open a code scanning alert from the Security tab. 2. Click Generate fix (Copilot Autofix) on a finding. 3. Walk through the suggested patch — explain how it addresses the vulnerability. 4. Commit the fix directly or open a PR from the suggestion.
c) Dependency Review in PRs
Section titled “c) Dependency Review in PRs”- Create a branch and add or bump a dependency in one of the services’
package.json. 2. Open a PR — show the Dependency Review summary that appears. 3. Point out how vulnerable or license-incompatible dependencies are flagged before merge.
d) Secret Scanning + Push Protection
Section titled “d) Secret Scanning + Push Protection”- Navigate to Settings → Code security → Secret scanning — show it’s enabled. 2. Show Push protection is on (blocks pushes containing detected secrets). 3. Optionally demo by attempting to push a dummy secret pattern and showing the block.
e) Security Overview Dashboard
Section titled “e) Security Overview Dashboard”- Go to Security → Overview at the repo or org level. 2. Walk through the dashboard: open alerts, fixed alerts, coverage. 3. Highlight how code quality findings, dependency alerts, and secret alerts roll up into one view.
f) Code Scanning in a PR (Inline Experience)
Section titled “f) Code Scanning in a PR (Inline Experience)”- Open a PR that triggers a CodeQL finding (e.g., missing input validation). 2. Show the inline annotation on the PR diff with the finding details. 3. Show Copilot Autofix suggesting a remediation inline. 4. Accept or dismiss the suggestion.
Follow-Up Prompts
Section titled “Follow-Up Prompts”- “What other CodeQL queries should we enable for this Node.js project?”
- “Generate a dependency review action that blocks PRs with critical vulnerabilities.”