Skip to content

Releases: overextended/ox_inventory

v2.47.7

07 Jun 00:45

Choose a tag to compare

Bug Fixes

  • client: only set initial invBusy state locally (Linden)
  • server/shops: decrement item count before hooks (Linden)
  • server/inventory: early bailout if giveItem has no available slot (Linden)

v2.47.6

06 Jun 02:20

Choose a tag to compare

This update fixes an item duplication exploit exposed by a change in v2.47.3 which added a delay to the swapItems event. Some underlying behaviour has been changed which should prevent it from occurring again - additionally, hooks which yield (i.e. Wait) should no longer risk saving a dirty state to the database.

Bug Fixes

  • server/crafting: get locks on correct ids (Linden)
  • server: prevent item duplication on disconnect mid-swap (#1950) #1950 (Kenshin13)
  • server/hooks: correctly output hook rejections to console (Linden)
  • client: display serverId in give player list (Linden)
  • client/utils: get client's player index in defaultGetPlayerName (Linden)
  • server: commit swapItems atomically so a yielding hook cannot dupe (#1952) #1952 (Kenshin13)

v2.47.5

01 Jun 07:37

Choose a tag to compare

Bug Fixes

  • client: leftover print (Linden)

Chores

  • update ox_lib dependency to 3.36.4 (Linden)

v2.47.4

29 May 10:38

Choose a tag to compare

Bug Fixes

  • client: handle updateInventory in swapItems callback (Linden)
  • server/inventory: earlier invokingResource check on addItem (Linden)

Code Refactoring

  • init: use GetConvarBool (Linden)
  • server/hooks: print on hook rejection (Linden)
  • support strict state bags (Linden)

Chores

  • update ox_lib dependency to 3.36.0 (Linden)

v2.47.3

27 May 23:42

Choose a tag to compare

Bug Fixes

  • inventory: don't double up inventory updates (Linden)
  • server/hooks: delay post-hook events (Linden)
  • web: re-add sass dependency (Linden)

Chores

v2.47.1

16 May 23:56

Choose a tag to compare

Bug Fixes

v2.47.0

14 May 08:28

Choose a tag to compare

This release patches some potential vulnerabilities with modifying inventory state during actions, leading to incorrect item removal.

For third-party resources, new features have been added to improve security and reliability.

You can now register stashes with an instance field, which prevents any player from accessing it unless their instance state has been set to the same value. Note this is technically only secure when using strict statebags.

I have also added post-hook events to correctly support scripts that wish to run custom logic after completing certain actions. Many third-party scripts previously registered hooks which would trigger "side-effects", such as modifying an item or giving items when the hook ran. This leads to major issues and exploits, as hooks run before such an action has been completed and could still fail for a number of reasons (including other hooks rejecting it).

Hook callbacks are intended for validation only and should avoid side effects such as modifying data, writing to a database, or triggering additional operations.

Because actions may still be in progress or may fail, modifying item or inventory state before completion can lead to race conditions or inconsistent behavior.

To avoid issues, perform state changes or follow-up logic in post-hook events.

You can now safely run such logic after actions have been validated internally and by other hooks by using the hookId (returned by registerHook) as an event. The hook callback is also now optional if you only need to use the built-in filters and don't require custom validation.

---Use filter logic so only relevant inventories trigger the post-hook event.
local hookId = exports.ox_inventory:registerHook('swapItems', nil, {
    inventoryFilter = {
        '^glove[%w]+',
        '^trunk[%w]+',
    }
})
 
---Print everytime an item is moved to or from a vehicle inventory.
---Success will be false if the hook rejected the action or it failed elsewhere.
AddEventHandler(hookId, function(success, payload)
    print(hookId, success)
    lib.print.info(payload)
end)

Features

  • server/inventory: add instance field to registered stashes (Linden)
  • server: add instance validation to openInventory callback (Linden)
  • implement basic locks manager (Linden)
  • server/hooks: new hookId format and include id in payload (Linden)
  • server/hooks: Add post-action events to event hooks (Linden)
  • server/items: add invoking resource to createItem hook payload (Linden)

Bug Fixes

  • client: ensure currentInventory is always defined, type fixes (Linden)
  • server/inventory: ensure player inventory is open before swap (Linden)
  • client: always trigger closeInventory event on close (Linden)
  • client/inventory: clear evidence.zoneId (Linden)
  • server/crafting: add locks to crafting ingredients (Linden)
  • server/crafting: return if locks fail (Linden)
  • client: set coords when opening inventory (Linden)
  • server: add locks to useItem (Linden)
  • server/inventory: extra Inventory.SetSlot arg validation (Linden)
  • server/inventory: extra Inventory.RemoveItem arg validation (Linden)
  • server/inventory: inconsistent inventory.openedBy behaviour (Linden)
  • server/inventory: SetSlot error checking (Linden)
  • server/shops: add better fallbacks for openShop hook (#1933) #1933 (JHansen2000)
  • server/inventory: disallow negative values when updating weapons (Linden)
  • client: don't set coords on default inventory (Linden)
  • client: support txadmin's heal event (Linden)
  • server/inventory: SetSlot return value on item deletion (Linden)
  • server/inventory: typo in RemoveItem (Linden)

Code Refactoring

  • sync inventory.instance to client (Linden)
  • server/inventory: use Locks with swapItems and giveItem (Linden)
  • server/inventory: use more descriptive lock ids (Linden)
  • locks: take an array rather than varargs (Linden)
  • client: allow movement while using drop (Linden)
  • server/hooks: don't format post-hook event names (Linden)

Chores

v2.46.1

04 May 12:34

Choose a tag to compare

Bug Fixes

  • server/inventory: correction to swapItems exploit check (Linden)

v2.46.0

03 May 06:44

Choose a tag to compare

Patches an exploit that passed incorrect data to newly created drops, allowing item duplication.

Features

  • utils/server: add LogExploit function (Linden)
  • ui: add thousands separator formatting to item amount input (#1927) #1927 (Acc-Off)

Bug Fixes

  • server/inventory: ensure dropItem transfers from player inventory. (Linden)
  • support giving items to players in vehicles (#1925) #1925 (Marcelo Silva)

Code Refactoring

  • web: fetch stub (Linden)
  • server: add logging for some known exploits (Linden)
  • server/inventory: early bailout on invalid swapItems data (Linden)

Continuous Integration

  • release: update actor_id (Linden)

Chores

v2.45.1

25 Apr 00:06

Choose a tag to compare

Features

Bug Fixes

Read more