@quenty/gameproductservice 14.66.8 → 14.66.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [14.66.10](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gameproductservice@14.66.9...@quenty/gameproductservice@14.66.10) (2026-08-10)
7
+
8
+ **Note:** Version bump only for package @quenty/gameproductservice
9
+
10
+ ## [14.66.9](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gameproductservice@14.66.8...@quenty/gameproductservice@14.66.9) (2026-08-08)
11
+
12
+ ### Bug Fixes
13
+
14
+ - Server validation gate ([90ee99b](https://github.com/Quenty/NevermoreEngine/commit/90ee99be70cb20ddb01dc8cc43ed12974405d22e))
15
+
6
16
  ## [14.66.8](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gameproductservice@14.66.7...@quenty/gameproductservice@14.66.8) (2026-08-08)
7
17
 
8
18
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/gameproductservice",
3
- "version": "14.66.8",
3
+ "version": "14.66.10",
4
4
  "description": "Generalized monetization system for handling products and purchases correctly.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -35,23 +35,23 @@
35
35
  "@quenty/baseobject": "10.15.0",
36
36
  "@quenty/binder": "14.43.1",
37
37
  "@quenty/brio": "14.35.1",
38
- "@quenty/cmdrservice": "13.56.0",
38
+ "@quenty/cmdrservice": "13.56.1",
39
39
  "@quenty/enumutils": "3.4.6",
40
- "@quenty/gameconfig": "12.62.5",
40
+ "@quenty/gameconfig": "12.62.6",
41
41
  "@quenty/instanceutils": "13.35.1",
42
42
  "@quenty/loader": "10.11.0",
43
43
  "@quenty/maid": "3.11.0",
44
44
  "@quenty/marketplaceutils": "11.30.0",
45
45
  "@quenty/nevermore-test-runner": "1.5.0",
46
46
  "@quenty/observablecollection": "12.47.0",
47
- "@quenty/permissionprovider": "14.49.0",
47
+ "@quenty/permissionprovider": "14.49.1",
48
48
  "@quenty/playerbinder": "14.46.0",
49
49
  "@quenty/playermock": "1.6.0",
50
50
  "@quenty/playerutils": "8.41.0",
51
51
  "@quenty/promise": "10.23.0",
52
52
  "@quenty/promisemaid": "5.23.0",
53
53
  "@quenty/receiptprocessing": "7.42.1",
54
- "@quenty/remoting": "12.41.0",
54
+ "@quenty/remoting": "12.41.1",
55
55
  "@quenty/rx": "13.33.0",
56
56
  "@quenty/rxbinderutils": "14.43.1",
57
57
  "@quenty/servicebag": "11.20.0",
@@ -64,5 +64,5 @@
64
64
  "@quenty/valueobject": "13.36.1",
65
65
  "@quentystudios/jest-lua": "3.10.0-quenty.2"
66
66
  },
67
- "gitHead": "4e0025faa5102babf56713d741b96fcec319ce14"
67
+ "gitHead": "18496d9898c68e0a8cf456fcdba4c76b75d1ada4"
68
68
  }
@@ -309,6 +309,17 @@ end
309
309
  rejects); prompts must be initiated from the server, where the developer can validate
310
310
  the asset id. Defaults to disabled.
311
311
 
312
+ Enabling this also makes the server verify gamepass purchases against the marketplace
313
+ before granting them, instead of trusting the client's report that the prompt
314
+ succeeded. The two travel together deliberately: a game that has moved prompting to
315
+ the server is one that wants purchases established server-side.
316
+
317
+ Be aware of what that verification costs. `UserOwnsGamePassAsync` answers from a cache
318
+ held per server, so immediately after a real purchase it can still report the player
319
+ does not own the pass -- and a purchase that fails to verify is granted nothing. Games
320
+ whose flows depend on the pass being usable the instant the prompt closes should leave
321
+ this disabled until they can tolerate that delay.
322
+
312
323
  @param enabled boolean
313
324
  ]=]
314
325
  function GameProductService.SetServerOnlyPromptingEnabled(self: GameProductService, enabled: boolean)
@@ -12,6 +12,11 @@
12
12
  a mock, and a client-initiated accept replicates to the server over the production remoting
13
13
  path (session purchase, ownership, and both realms' purchase signals).
14
14
 
15
+ Server-side verification of a client's gamepass purchase claim is gated on server-only prompting
16
+ (see [GameProductService.SetServerOnlyPromptingEnabled]), so it is covered from both sides: with
17
+ the flag off the server takes the client's word, and with it on an unconfirmed claim grants
18
+ nothing while a confirmed one grants the pass.
19
+
15
20
  @class GameProductService.spec.lua
16
21
  ]]
17
22
 
@@ -347,12 +352,13 @@ describe("client-initiated gamepass prompt", function()
347
352
  controller:destroy()
348
353
  end)
349
354
 
350
- it("does not grant server ownership for a purchase the marketplace never confirms", function()
355
+ it("takes the client's word for a purchase the marketplace never confirms", function()
351
356
  local controller = setup()
352
- -- The client reports the prompt succeeded, but the marketplace never shows the player owning the
353
- -- pass (UserOwnsGamePassAsync stays at its false default). A client saying "I bought it" is an
354
- -- unverified claim -- on its own it must grant nothing, or any client could fire this remote for
355
- -- any gamepass id and be handed the pass for free.
357
+ -- Server-only prompting is off (the default), so the server has not been asked to establish
358
+ -- purchases itself and grants on the client's report. This is a known trust gap, kept because
359
+ -- verifying here would read UserOwnsGamePassAsync's per-server cache, which can still answer
360
+ -- `false` for a purchase that just completed and would lose a pass the player paid for. Games
361
+ -- that want the claim checked enable server-only prompting; see the verification describe below.
356
362
  PlayerMock.writeLookup(controller.playerMock, "MarketplaceService.PromptGamePassPurchase", GAME_PASS_ID, true)
357
363
 
358
364
  local serverFired = {}
@@ -360,7 +366,6 @@ describe("client-initiated gamepass prompt", function()
360
366
  table.insert(serverFired, { player = player, gamePassId = gamePassId })
361
367
  end)
362
368
 
363
- -- The client still resolves its own prompt as accepted: its local UX is not the trust boundary.
364
369
  expect(
365
370
  controller.awaitBool(
366
371
  controller.gameProductServiceClient:PromisePromptPurchase(
@@ -371,25 +376,18 @@ describe("client-initiated gamepass prompt", function()
371
376
  )
372
377
  ).toEqual(true)
373
378
 
374
- -- The server rejects the unverified claim: no ownership, no session purchase, no purchase signal.
375
- -- Awaiting the ownership query also lets the server's verification settle first.
376
- expect(
377
- controller.awaitBool(
378
- controller.gameProductService:PromisePlayerOwnership(
379
- controller.playerMock,
380
- GameConfigAssetTypes.PASS,
381
- GAME_PASS_ID
382
- )
383
- )
384
- ).toEqual(false)
385
- expect(#serverFired).toEqual(0)
379
+ PromiseTestUtils.awaitValue(function()
380
+ return #serverFired > 0
381
+ end, 10)
382
+
383
+ expect(#serverFired).toEqual(1)
386
384
  expect(
387
385
  controller.gameProductService:HasPlayerPurchasedThisSession(
388
386
  controller.playerMock,
389
387
  GameConfigAssetTypes.PASS,
390
388
  GAME_PASS_ID
391
389
  )
392
- ).toEqual(false)
390
+ ).toEqual(true)
393
391
 
394
392
  controller:destroy()
395
393
  end)
@@ -436,6 +434,109 @@ describe("client-initiated gamepass prompt", function()
436
434
  end)
437
435
  end)
438
436
 
437
+ describe("gamepass purchase verification under server-only prompting", function()
438
+ -- With server-only prompting enabled the client may no longer prompt, so these drive the client's
439
+ -- prompt-finished handler directly. That is the same entry point the engine's
440
+ -- PromptGamePassPurchaseFinished reaches, and the one an exploiter reaches by firing the remote
441
+ -- themselves -- which is exactly the claim under test.
442
+ local function claimPurchaseFromClient(controller: any, gamePassId: number)
443
+ local clientBinder = controller.clientBag:GetService((require :: any)("PlayerProductManagerClient"))
444
+
445
+ PromiseTestUtils.awaitValue(function()
446
+ return clientBinder:Get(controller.playerMock) ~= nil
447
+ end, 10)
448
+
449
+ local manager: any = clientBinder:Get(controller.playerMock)
450
+ manager:_handleGamePassPromptFinished(gamePassId, true)
451
+ end
452
+
453
+ it("grants nothing for a claim the marketplace does not confirm", function()
454
+ local controller = setup()
455
+ controller.gameProductService:SetServerOnlyPromptingEnabled(true)
456
+
457
+ -- UserOwnsGamePassAsync stays at its false default: the player never bought this pass. Any
458
+ -- client can fire this remote for any gamepass id, so on its own the claim must grant nothing.
459
+ local serverFired = {}
460
+ controller.gameProductService.GamePassPurchased:Connect(function(player, gamePassId)
461
+ table.insert(serverFired, { player = player, gamePassId = gamePassId })
462
+ end)
463
+
464
+ claimPurchaseFromClient(controller, GAME_PASS_ID)
465
+
466
+ -- Awaiting the ownership query also lets the server's verification settle first.
467
+ expect(
468
+ controller.awaitBool(
469
+ controller.gameProductService:PromisePlayerOwnership(
470
+ controller.playerMock,
471
+ GameConfigAssetTypes.PASS,
472
+ GAME_PASS_ID
473
+ )
474
+ )
475
+ ).toEqual(false)
476
+ expect(#serverFired).toEqual(0)
477
+ expect(
478
+ controller.gameProductService:HasPlayerPurchasedThisSession(
479
+ controller.playerMock,
480
+ GameConfigAssetTypes.PASS,
481
+ GAME_PASS_ID
482
+ )
483
+ ).toEqual(false)
484
+
485
+ controller:destroy()
486
+ end)
487
+
488
+ it("grants the pass for a claim the marketplace confirms", function()
489
+ local controller = setup()
490
+ controller.gameProductService:SetServerOnlyPromptingEnabled(true)
491
+
492
+ -- The marketplace shows the player owning the pass, as it would after a real purchase.
493
+ PlayerMock.writeLookup(controller.playerMock, "MarketplaceService.UserOwnsGamePassAsync", GAME_PASS_ID, true)
494
+
495
+ local serverFired = {}
496
+ controller.gameProductService.GamePassPurchased:Connect(function(player, gamePassId)
497
+ table.insert(serverFired, { player = player, gamePassId = gamePassId })
498
+ end)
499
+
500
+ claimPurchaseFromClient(controller, GAME_PASS_ID)
501
+
502
+ PromiseTestUtils.awaitValue(function()
503
+ return #serverFired > 0
504
+ end, 10)
505
+
506
+ expect(#serverFired).toEqual(1)
507
+ expect(serverFired[1].player).toBe(controller.playerMock)
508
+ expect(serverFired[1].gamePassId).toEqual(GAME_PASS_ID)
509
+ expect(
510
+ controller.gameProductService:HasPlayerPurchasedThisSession(
511
+ controller.playerMock,
512
+ GameConfigAssetTypes.PASS,
513
+ GAME_PASS_ID
514
+ )
515
+ ).toEqual(true)
516
+
517
+ controller:destroy()
518
+ end)
519
+
520
+ it("still refuses a client-initiated prompt", function()
521
+ local controller = setup()
522
+ controller.gameProductService:SetServerOnlyPromptingEnabled(true)
523
+
524
+ -- Verification and the prompting restriction ship together: a game cannot take one without
525
+ -- the other, so this records what enabling the flag costs the client realm.
526
+ local outcome = PromiseTestUtils.awaitOutcome(
527
+ controller.gameProductServiceClient:PromisePromptPurchase(
528
+ controller.playerMock,
529
+ GameConfigAssetTypes.PASS,
530
+ GAME_PASS_ID
531
+ ),
532
+ 10
533
+ )
534
+ expect(outcome).toEqual("rejected")
535
+
536
+ controller:destroy()
537
+ end)
538
+ end)
539
+
439
540
  describe("server-initiated gamepass prompt", function()
440
541
  it("resolves true on accept and marks the session purchase", function()
441
542
  local controller = setup()
@@ -32,6 +32,7 @@ export type PlayerProductManager =
32
32
  {} :: {
33
33
  _serviceBag: ServiceBag.ServiceBag,
34
34
  _receiptProcessingService: any, -- ReceiptProcessingService.ReceiptProcessingService
35
+ _gameProductDataService: any, -- GameProductDataService.GameProductDataService
35
36
  _remoting: any,
36
37
  },
37
38
  {} :: typeof({ __index = PlayerProductManager })
@@ -51,6 +52,7 @@ function PlayerProductManager.new(player: Player, serviceBag: ServiceBag.Service
51
52
 
52
53
  self._serviceBag = assert(serviceBag, "No serviceBag")
53
54
  self._receiptProcessingService = self._serviceBag:GetService(ReceiptProcessingService) :: any
55
+ self._gameProductDataService = self._serviceBag:GetService(GameProductDataService) :: any
54
56
 
55
57
  -- Route internal setup through an `any` view: resolving these heavy-`self` method
56
58
  -- calls against the intersected type otherwise overwhelms the old solver.
@@ -67,7 +69,7 @@ function PlayerProductManager.new(player: Player, serviceBag: ServiceBag.Service
67
69
 
68
70
  -- Initialize attributes
69
71
 
70
- local serverOnlyPrompting = self._serviceBag:GetService(GameProductDataService):GetServerOnlyPromptingValue()
72
+ local serverOnlyPrompting = self._gameProductDataService:GetServerOnlyPromptingValue()
71
73
  self._maid:GiveTask(serverOnlyPrompting:Observe():Subscribe(function(value)
72
74
  self._obj:SetAttribute(GameProductDataService.ServerOnlyPromptingAttribute, value)
73
75
  end))
@@ -147,6 +149,17 @@ function PlayerProductManager._setupPassTracker(self: PlayerProductManager): ()
147
149
  return
148
150
  end
149
151
 
152
+ -- Verification rides on server-only prompting rather than a switch of its own. Enabling it is a
153
+ -- game saying the server drives purchases, which is also what makes the ownership check safe to
154
+ -- pay for. Left off, this stays on the client's word -- knowingly, because
155
+ -- UserOwnsGamePassAsync answers from a per-server cache that can still read `false` for the
156
+ -- purchase that just completed, and denying on that stale read loses a pass the player paid for.
157
+ -- See [GameProductService.SetServerOnlyPromptingEnabled].
158
+ if not self._gameProductDataService:GetServerOnlyPromptingValue().Value then
159
+ tracker:HandlePurchaseEvent(gamePassId, true)
160
+ return
161
+ end
162
+
150
163
  -- The purchase itself is not. This event is fired by the client, so `isPurchased == true` is an
151
164
  -- unverified claim -- a client can fire it for any gamepass id without ever paying, and granting
152
165
  -- ownership on it hands the pass out for free. Confirm against the marketplace before it counts,