fix(detectors): verify PubNub keys with 'App Context is not enabled' 403 body - #5135
Open
sergioperezcheco wants to merge 1 commit into
Open
fix(detectors): verify PubNub keys with 'App Context is not enabled' 403 body#5135sergioperezcheco wants to merge 1 commit into
sergioperezcheco wants to merge 1 commit into
Conversation
…403 body PubNub renamed the 'Objects' feature to 'App Context'. When the feature is disabled on an otherwise valid subscription key, the App Context endpoint now returns 403 with body 'App Context is not enabled for this subscribe key.' instead of the legacy 'Objects not enabled for this subscriber key.'. The verifyKey handler only matched the legacy string, so valid keys were reported as unverified. Handle both 403 bodies as 'key is valid, feature disabled'. Extract the verify endpoint into a package var so the verification path is exercised against a stub HTTP server, and add regression tests covering both bodies and the 401 path. Fixes trufflesecurity#5099
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.
PubNub renamed the "Objects" feature to "App Context". When the feature is disabled on an otherwise valid subscription key, the App Context endpoint now returns 403 with body "App Context is not enabled for this subscribe key." instead of the legacy "Objects not enabled for this subscriber key.". The PubNub subscription key detector only matched the legacy string, so valid keys whose account had App Context off were reported as unverified.
This change treats both 403 bodies as "key is valid, feature disabled" so such keys are correctly verified. The verify endpoint URL is extracted into a package var so the verification path can be exercised against a stub HTTP server, and I added regression tests covering both 403 bodies and the 401 path.
Fixes #5099
Note
Low Risk
Scoped change to PubNub subscription key verification heuristics with stubbed HTTP tests; no broader auth or data-path impact.
Overview
Fixes false unverified results for valid PubNub subscription keys when PubNub returns 403 with the renamed App Context message instead of the legacy Objects wording.
verifyKeynow treats both 403 response bodies as “key is valid, App Context/Objects feature off.” The verify endpoint is held in a package-levelverifyURLso tests can stub HTTP. Regression tests cover both 403 bodies and unchanged 401 → unverified behavior (fixes #5099).Reviewed by Cursor Bugbot for commit dc567b4. Bugbot is set up for automated code reviews on this repo. Configure here.