Perf & security: DB indexes, partial updates, route dedup, XSS fix#8
Draft
Perf & security: DB indexes, partial updates, route dedup, XSS fix#8
Conversation
Co-authored-by: kavyashri-as <213833080+kavyashri-as@users.noreply.github.com>
…S/injection fixes Co-authored-by: kavyashri-as <213833080+kavyashri-as@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Identify and improve slow or inefficient code
Perf & security: DB indexes, partial updates, route dedup, XSS fix
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Several inefficiencies and one XSS vulnerability across the data layer, server routes, and client-side rendering.
Database (
database.js)CREATE INDEX IF NOT EXISTSoncompleted,priority, andcreated_at DESC; previously every query did a full table scanupdateTaskalways sent all 4 columns, setting unprovided fields toNULL; now builds theSETclause dynamically from only the defined argumentsServer routes (
index.js)GET /andGET /taskswere identical 10-line blocks; extracted into a singlerenderTaskshandlerClient (
public/script.js)GET /api/tasksreload; now renders the empty state directlytitle,description,priority, andidwere interpolated raw intoinnerHTML; addedescapeHtml()applied to all user-supplied valuestask.prioritywas used as a class name without validation; whitelisted tolow/medium/highwithmediumas fallbackTests (
tests/database.test.js)New test file using an in-memory SQLite DB covering partial-update correctness and the no-fields error path of
updateTask.💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.