feat(dashboard): implement threat analytics dashboard and backend rate limiting (fixes #172)#188
Open
Diwakar-odds wants to merge 1 commit into
Conversation
Author
|
Hi maintainers! 👋 Could I please get a review on this PR? Technical AnalysisThis PR addresses both frontend modularity and backend security requirements outlined in #172:
ECSoC '26 Label RequestBased on the provided ECSoC '26 scoring criteria, I'd like to request the following labels for this PR:
Thank you! |
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.
Summary
This PR implements backend rate limiting to secure the
/checkAPI endpoint against abuse and restructures the Threat Analytics Dashboard to support sortable columns for better user experience.Motivation
Fixes #172
The
/checkendpoint lacked protection against brute-force or spam requests, leading to potential exhaustion of the Google Safe Browsing API quota. Additionally, the dashboard's analytics and history logic was tightly coupled withindashboard.html, and the "Recent Scans" table lacked sorting features, which degraded the UX for users analyzing their history.Changes
package.json: Addedexpress-rate-limitdependency.server.js: Importedexpress-rate-limitand applied a 15-minute, 100-request rate limiter to the/checkendpoint to prevent abuse.dashboard.html: Extracted inline JavaScript related to Chart.js and localStorage out into an external script file.public/dashboard.js: Migrated all dashboard logic here and implemented a new sorting functionality for the Recent Scans table, allowing sorting by URL, Result, and Timestamp.Acceptance Criteria
/checkroute.dashboard.htmlto a dedicated file.Impact & Side Effects
429 Too Many Requestsresponse.How to Test
npm installto install the newexpress-rate-limitpackage.node server.js.dashboard.htmlin the browser, populate some scans, and click the table headers ("URL", "Result", "Scanned") to verify the sorting works in both ascending and descending order.POSTrequests tohttp://localhost:3000/check. Verify the 101st request returns a429status code.Quality Checklist
node -c server.jsto verify syntax.node -c public/dashboard.jsto verify syntax.