Skip to content

fix(detectors): verify PubNub keys with 'App Context is not enabled' 403 body - #5135

Open
sergioperezcheco wants to merge 1 commit into
trufflesecurity:mainfrom
sergioperezcheco:fix/pubnub-app-context-403
Open

fix(detectors): verify PubNub keys with 'App Context is not enabled' 403 body#5135
sergioperezcheco wants to merge 1 commit into
trufflesecurity:mainfrom
sergioperezcheco:fix/pubnub-app-context-403

Conversation

@sergioperezcheco

@sergioperezcheco sergioperezcheco commented Jul 18, 2026

Copy link
Copy Markdown

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.

verifyKey now treats both 403 response bodies as “key is valid, App Context/Objects feature off.” The verify endpoint is held in a package-level verifyURL so 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.

…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
@sergioperezcheco
sergioperezcheco requested a review from a team July 18, 2026 03:21
@sergioperezcheco
sergioperezcheco requested a review from a team as a code owner July 18, 2026 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PubNub subscription key verification misses "App Context is not enabled" response

1 participant