Skip to content

[Bug]: Text-salting detection API is unreachable — router never mounted, and targets a non-existent .js script instead of text_salting_detector.py #1001

Description

@Rudra-clrscr

Bug Description

The text-salting defense feature (originally implemented for #896, which is closed) is broken in two independent ways:

  1. backend/routes/saltingRoutes.js is never require'd or app.use()'d in backend/server.js, so any endpoint it defines doesn't exist on the running server at all.
  2. Even if the router were mounted, it targets the wrong file: it builds its script path as text_salting_detector.js, but the actual detector shipped in the repo is backend/text_salting_detector.py (a Python file). spawn('python', [SALTING_SCRIPT, ...]) would try to run a .js file that doesn't exist, so every call would fail with ENOENT regardless.
    Wrong script extension: backend/routes/saltingRoutes.js L8
    Unmounted router: not referenced anywhere in backend/server.js — compare with sibling routers adversarialRoutes, evoMailRoutes, poisoningRoutes, which are all required (L31–L33) and mounted (L287–L289)
    Actual detector file: backend/text_salting_detector.py

Steps to Reproduce

  1. Confirm the router is never mounted:
   grep -n "saltingRoutes" backend/server.js
   # (no output — the file is never required or app.use()'d)
  1. Start the server and hit any plausible salting endpoint:
   curl -i http://localhost:5000/api/salting/detect -X POST -d '{"html":"<p>test</p>"}'
  1. Separately confirm the script path mismatch:
   ls backend/text_salting_detector.js   # No such file or directory
   ls backend/text_salting_detector.py   # <- this is the real file

Expected Behavior

POST /api/salting/detect should run text_salting_detector.py against the supplied HTML and return a salting-attack analysis; GET /api/salting/status should return detector status.

Actual Behavior

POST /api/salting/detect (or any salting route) returns 404 Not Found because the router is never registered with the Express app. If manually mounted for testing, it then fails with spawn python ENOENT because it targets text_salting_detector.js, which doesn't exist.

Screenshots

No response

Additional Information

No response

Metadata

Metadata

Assignees

Labels

SSoC26bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions