Skip to content

URL-encode query parameters in apiCalls/*ApiParams.jsp redirects #31

Description

@aaronbrethorst

CodeRabbit flagged that the JS in `reports/apiCalls/*ApiParams.jsp` builds API URLs by concatenating raw `selectedRouteId` / `stopId` / `tripId` / `format` / etc. into the query string before redirecting. Route ids that contain reserved characters (`&`, `=`, `+`, space, `#`) will silently corrupt the request. Wrap each dynamic value in `encodeURIComponent(...)`.

  • `transitclockWebapp/src/main/webapp/reports/apiCalls/blocksTerseApiParams.jsp` (lines 12–15)
  • `transitclockWebapp/src/main/webapp/reports/apiCalls/predsByRouteStopApiParams.jsp` (lines 11–18, 20–21)
  • `transitclockWebapp/src/main/webapp/reports/apiCalls/routeDetailsApiParams.jsp` (lines 11–20) — also crashes when no route is selected; guard `$("#route").val()` for null
  • `transitclockWebapp/src/main/webapp/reports/apiCalls/siriStopMonitoringApiParams.jsp` (lines 11–20)
  • `transitclockWebapp/src/main/webapp/reports/apiCalls/siriVehicleMonitoringApiParams.jsp` (line 14)
  • `transitclockWebapp/src/main/webapp/reports/apiCalls/tripApiParams.jsp` (lines 11–13)
  • `transitclockWebapp/src/main/webapp/reports/apiCalls/tripWithTravelTimesApiParams.jsp` (lines 7–16)
  • `transitclockWebapp/src/main/webapp/reports/apiCalls/vehicleConfigsApiParams.jsp` (lines 7–13)
  • `transitclockWebapp/src/main/webapp/reports/apiCalls/vehiclesApiParams.jsp` (lines 12–15)
  • `transitclockWebapp/src/main/webapp/reports/apiCalls/vehiclesDetailsApiParams.jsp` (lines 12–15)
  • `transitclockWebapp/src/main/webapp/reports/apiCalls/vertStopsScheduleApiParams.jsp` (lines 12–15)
  • `transitclockWebapp/src/main/webapp/testing/index.jsp` (lines 23–31) — `pushMeasuredArrivalTime` URL built the same way; consider `URLSearchParams` or `$.param({...})`

Source

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions