rusackas opened a new pull request, #40747:
URL: https://github.com/apache/superset/pull/40747

   ### SUMMARY
   
   Addresses a CodeQL **`js/unvalidated-dynamic-method-call`** (high) alert at
   `superset-frontend/src/middleware/asyncEvent.ts`. In `processEvents`, the
   listener is looked up from a plain object (`listenersByJobId`) keyed by
   `asyncEvent.job_id` — a server-supplied value — and then invoked. Because a
   plain object carries `Object.prototype`, a `job_id` matching an inherited 
member
   name (`toString`, `constructor`, …) could resolve the lookup to a prototype
   method, so the subsequent call would dispatch to an unexpected target. A
   `hasOwnProperty` guard mitigated it, but the lookup target was still a
   prototype-bearing object.
   
   This switches `listenersByJobId` and `retriesByJobId` from plain objects to
   **`Map`**. `Map.get()` only ever returns explicitly-`set` values — never
   inherited prototype methods — which removes the dynamic-dispatch hazard at 
the
   source and is the canonical remediation for this rule. The `hasOwnProperty`
   guard is dropped (no longer needed), and `addListener`'s `any` parameter is
   tightened to `ListenerFn`.
   
   **Behavior is unchanged** — the registry semantics (add/remove/lookup, the
   race-condition retry up to `MAX_RETRIES`, and the `loadEventsFromApi` empty
   check) are all preserved, just expressed via `Map` 
(`.set/.get/.has/.delete/.size`).
   
   ### TESTING INSTRUCTIONS
   
   `asyncEvent.test.ts` exercises the public API and passes unchanged. 
Type-check,
   prettier, and oxlint all pass.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to