Skip to content

Commit 2759c4b

Browse files
KatristIgnisRBX
andauthored
Fix auto-link, indenting, and improve code (#1258)
## Changes Fixed auto-link for CFrames Indented example code properly Improved code by using variables to store `:FindFirstChild` results ## Checks By submitting your pull request for review, you agree to the following: - [X] This contribution was created in whole or in part by me, and I have the right to submit it under the terms of this repository's open source licenses. - [X] I understand and agree that this contribution and a record of it are public, maintained indefinitely, and may be redistributed under the terms of this repository's open source licenses. - [X] To the best of my knowledge, all proposed changes are accurate. Co-authored-by: IgnisRBX <[email protected]>
1 parent d540e95 commit 2759c4b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

content/en-us/scripting/security/security-tactics.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,18 +199,20 @@ An exploiter can send NaN (Not a Number) as an argument. NaN is uniquely dangero
199199
local function onCreateTradeOffer(player, offeredGold)
200200
-- 1. TYPE CHECK: This passes! typeof(NaN) is "number".
201201
if typeof(offeredGold) ~= "number" then
202-
return "Invalid offer"
202+
return "Invalid offer"
203203
end
204204

205205
-- 2. RANGE CHECK: This is bypassed!
206206
-- (NaN < 0) is false. (NaN > 1000000) is also false. The check does nothing.
207207
if offeredGold < 0 or offeredGold > 1000000 then
208-
return "Offer out of range"
208+
return "Offer out of range"
209209
end
210210

211211
-- 3. INVENTORY CHECK: This is bypassed!
212212
-- (NaN > player.Gold.Value) is false.
213-
if offeredGold > player.Gold.Value then return "Not enough gold" end
213+
if offeredGold > player.Gold.Value then
214+
return "Not enough gold"
215+
end
214216

215217
-- VULNERABILITY: A fraudulent trade offer with NaN gold is created!
216218
createTrade(player, {gold = offeredGold})
@@ -467,11 +469,13 @@ castLightningEvent.OnServerEvent:Connect(function(player, strikePosition)
467469
end
468470

469471
-- 5. Example Range validation
470-
if not player.Character or not player.Character:FindFirstChild("HumanoidRootPart") then
472+
local character = player.Character
473+
local humanoidRootPart = character and character:FindFirstChild("HumanoidRootPart")
474+
if not humanoidRootPart then
471475
return
472476
end
473477

474-
local distance = (player.Character.HumanoidRootPart.Position - strikePosition).Magnitude
478+
local distance = (humanoidRootPart.Position - strikePosition).Magnitude
475479
if distance > 100 then
476480
return -- Out of range
477481
end
@@ -533,7 +537,7 @@ When a client has network ownership over parts (including their character), they
533537

534538
**Physics manipulation**
535539

536-
- Control the position and rotation of any unanchored parts or mechanisms, including replicating `Inf` or `NaN` components in `Class.CFrame|CFrames`.
540+
- Control the position and rotation of any unanchored parts or mechanisms, including replicating `Inf` or `NaN` components in `Datatype.CFrame|CFrames`.
537541
Set part velocities to extreme values (including `Inf` or `NaN`), which can interfere with the physics of other unanchored parts/assemblies, even those that are not owned by the exploiter.
538542
This is often used to fling other player characters and nearby parts.
539543
Manipulate the firing of Touched events, including not firing Touched at all.

0 commit comments

Comments
 (0)