NEW @W-21910054@ Message sanitization - #368
Conversation
|
Git2Gus App is installed but the |
aruntyagiTutu
left a comment
There was a problem hiding this comment.
Nice fix — the core problem this solves is real: apiUnavailable/noOrgConnection previously interpolated raw exception/remediation text directly into a user-facing notification (apexGuruSkipped.apiUnavailable(message)). Since that text can originate from the backend/exception rather than a fixed set of known strings, displaying it verbatim in the UI is exactly the kind of thing "sanitization" should prevent. Replacing it with static, canned copy and routing the raw detail to logger.log() instead (visible via "Details" → log output) is the right shape. The new INVALID_SESSION/SCAN_TIMEOUT handlers correctly wire up the corresponding codes that code-analyzer-apexguru-engine's engine.ts (isInvalidSessionError/isScanTimeoutError) already emits, and the once-per-session suppression for INVALID_SESSION mirrors the existing NO_ORG_CONNECTION pattern appropriately (persistent condition) while SCAN_TIMEOUT correctly always shows (transient, matches API_UNAVAILABLE's behavior). Tests are thorough — cover the new banners, the once-vs-always suppression semantics, and the button callbacks.
One thing I'd like called out explicitly since the PR description is empty: this diff also silently removes the "Default target-org set to '{orgAlias}'. Re-run the scan to use ApexGuru." confirmation banner (orgSetSuccess) after a user picks an org from the QuickPick — that path now only logs internally, with zero user-facing feedback on success. Unlike the other changes here, orgAlias isn't attacker/backend-controlled text, so this doesn't look like it's motivated by the sanitization goal — it reads more like an unrelated UX regression that got swept in. Was dropping that toast intentional? If so, worth a line in the PR description; if not, it should probably be restored.
Minor/non-blocking: finishedScan's casing changed from "Scan complete" to "Scan Complete" — inconsistent with the sentence-case style used elsewhere in this same file (e.g. "ApexGuru analysis was skipped...").
Address review feedback on message sanitization PR: the org-set success banner was unintentionally dropped when routing raw exception text away from the UI, even though orgAlias is not attacker/backend-controlled and isn't a sanitization concern. Also revert the "Scan Complete" casing regression back to sentence case to match the rest of the file.
|
Thanks for the thorough review, @aruntyagiTutu! Both callouts were right — the
Also filled in the PR description with a summary of the sanitization change, since it was empty. All 373 unit tests + lint + typecheck pass locally. |
aruntyagiTutu
left a comment
There was a problem hiding this comment.
Thanks for addressing both points — the orgSetSuccess confirmation banner is restored (with a test asserting it's shown after setting target-org), and the "Scan Complete"/"Scan complete" casing is back to matching the rest of the file. LGTM.
Summary
Sanitizes user-facing ApexGuru notifications so that raw backend/exception text is never interpolated directly into a UI banner. Raw detail is now routed to
logger.log()(visible via the "Details" button → log output) while the banner itself shows static, canned copy.NO_ORG_CONNECTION/API_UNAVAILABLE: switched frommessages.insights.apexGuruSkipped.xxx(message)(raw text) to static message constants; rawmessage/remediationnow goes to the logger only.INVALID_SESSIONandSCAN_TIMEOUThandling, wired to the corresponding error codes emitted bycode-analyzer-apexguru-engine'sengine.ts(isInvalidSessionError/isScanTimeoutError).INVALID_SESSIONis shown once per session (persistent condition, mirrors the existingNO_ORG_CONNECTIONsuppression).SCAN_TIMEOUTalways shows (transient, matchesAPI_UNAVAILABLE's behavior).Test plan
insights-handler.test.tscovering the new banners, once-vs-always suppression semantics, and button callbacks.npm run test:unit— all tests pass.npm run lintand typecheck pass.