From 5cc74174090b8544beeac22c6be2df85968f1ee0 Mon Sep 17 00:00:00 2001 From: TameTheGame <45159255+TameTheGame@users.noreply.github.com> Date: Thu, 12 Nov 2026 07:37:58 -0500 Subject: [PATCH 1/4] Check prop protection before sockets weld to plugs A socket welded to any matching plug nearby without checking either owner's tool permission, so a player could weld their plug into someone else's socket and copy the build with AdvDupe2. CanLink now checks WireLib.CanTool both ways on the server. --- lua/entities/gmod_wire_socket.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/entities/gmod_wire_socket.lua b/lua/entities/gmod_wire_socket.lua index b8cdda6d9f..ab0700649d 100644 --- a/lua/entities/gmod_wire_socket.lua +++ b/lua/entities/gmod_wire_socket.lua @@ -18,6 +18,11 @@ end function ENT:CanLink( Target ) if (Target.Socket and Target.Socket:IsValid()) then return false end if (self.SockData.plug ~= Target:GetModel()) then return false end + if SERVER then + local owner, targetOwner = self:GetPlayer(), Target:GetPlayer() + if IsValid(owner) and not WireLib.CanTool(owner, Target, "weld") then return false end + if IsValid(targetOwner) and not WireLib.CanTool(targetOwner, self, "weld") then return false end + end return true end From 40aa4cac73ea0df615e5e99d7fb59019c6edba3a Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Sat, 14 Nov 2026 07:22:45 +0300 Subject: [PATCH 2/4] Cleanup slop code --- lua/entities/gmod_wire_socket.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lua/entities/gmod_wire_socket.lua b/lua/entities/gmod_wire_socket.lua index ab0700649d..1821f7fc3c 100644 --- a/lua/entities/gmod_wire_socket.lua +++ b/lua/entities/gmod_wire_socket.lua @@ -18,11 +18,10 @@ end function ENT:CanLink( Target ) if (Target.Socket and Target.Socket:IsValid()) then return false end if (self.SockData.plug ~= Target:GetModel()) then return false end - if SERVER then - local owner, targetOwner = self:GetPlayer(), Target:GetPlayer() - if IsValid(owner) and not WireLib.CanTool(owner, Target, "weld") then return false end - if IsValid(targetOwner) and not WireLib.CanTool(targetOwner, self, "weld") then return false end - end + + local ply = WireLib.GetOwner(self) + if not IsValid(ply) or not WireLib.CanTool(ply, Target, "wire_plug") then return false end + return true end From 8bdee7acc58b64aea011d90485205bd514710f2f Mon Sep 17 00:00:00 2001 From: TameTheGame <45159255+TameTheGame@users.noreply.github.com> Date: Sat, 14 Nov 2026 11:43:56 -0500 Subject: [PATCH 3/4] Check the plug owner too and skip the check on the client Without the plug owner check, a player can add the socket's owner as a buddy and their plug still welds into that socket. WireLib.GetOwner and WireLib.CanTool only exist on the server, but CanLink also runs on the client for the helper line. A socket or plug with no owner only has the other side checked, so map-spawned sockets link again. --- lua/entities/gmod_wire_socket.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/entities/gmod_wire_socket.lua b/lua/entities/gmod_wire_socket.lua index 1821f7fc3c..18147ee5b7 100644 --- a/lua/entities/gmod_wire_socket.lua +++ b/lua/entities/gmod_wire_socket.lua @@ -19,8 +19,11 @@ function ENT:CanLink( Target ) if (Target.Socket and Target.Socket:IsValid()) then return false end if (self.SockData.plug ~= Target:GetModel()) then return false end - local ply = WireLib.GetOwner(self) - if not IsValid(ply) or not WireLib.CanTool(ply, Target, "wire_plug") then return false end + if CLIENT then return true end + + local ply, targetPly = WireLib.GetOwner(self), WireLib.GetOwner(Target) + if IsValid(ply) and not WireLib.CanTool(ply, Target, "wire_plug") then return false end + if IsValid(targetPly) and not WireLib.CanTool(targetPly, self, "wire_plug") then return false end return true end From 9313998937c5ff5af3f0808f66e7728b0fbdc31b Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Sun, 15 Nov 2026 16:41:58 +0300 Subject: [PATCH 4/4] Cleanup more --- lua/entities/gmod_wire_socket.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lua/entities/gmod_wire_socket.lua b/lua/entities/gmod_wire_socket.lua index 18147ee5b7..77b480d7ce 100644 --- a/lua/entities/gmod_wire_socket.lua +++ b/lua/entities/gmod_wire_socket.lua @@ -19,11 +19,10 @@ function ENT:CanLink( Target ) if (Target.Socket and Target.Socket:IsValid()) then return false end if (self.SockData.plug ~= Target:GetModel()) then return false end - if CLIENT then return true end - - local ply, targetPly = WireLib.GetOwner(self), WireLib.GetOwner(Target) - if IsValid(ply) and not WireLib.CanTool(ply, Target, "wire_plug") then return false end - if IsValid(targetPly) and not WireLib.CanTool(targetPly, self, "wire_plug") then return false end + if SERVER then + local ply = WireLib.GetOwner(self) + if not IsValid(ply) or not WireLib.CanTool(ply, Target, "weld") then return false end + end return true end