git: 5fb43742ad34 - main - lualoader: match the .lua extension literally

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Thu, 26 Nov 2026 04:02:33 UTC
The branch main has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=5fb43742ad34f3d3e84ef12eaad1068edbbd5616

commit 5fb43742ad34f3d3e84ef12eaad1068edbbd5616
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2026-11-26 04:00:54 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2026-11-26 04:01:03 +0000

    lualoader: match the .lua extension literally
    
    Both config.processFile() and try_include() checked for a .lua
    extension with ".lua$", but '.' matches any character, so a name like
    foo_lua also matched.
    
    In processFile(), that meant that a config file such as /boot/foo_lua
    was run as lua, though it was opened like any other config file.
    With veriexec, that file only needs VE_WANT rather than the VE_MUST
    that we expect for lua code, so an unverified file could be run as lua.
    
    Reviewed by:    imp
    Sponsored by:   The FreeBSD Foundation
    Sponsored by:   Klara, Inc.
    Differential Revision:  https://reviews.freebsd.org/D61843
---
 stand/lua/config.lua | 2 +-
 stand/lua/core.lua   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/stand/lua/config.lua b/stand/lua/config.lua
index 26f65ecc17b6..e2c44808697d 100644
--- a/stand/lua/config.lua
+++ b/stand/lua/config.lua
@@ -538,7 +538,7 @@ function config.processFile(name, silent)
 		return silent
 	end
 
-	if name:match(".lua$") then
+	if name:match("%.lua$") then
 		local cfg_env = setmetatable({}, {
 			indices = {},
 			__index = function(env, key)
diff --git a/stand/lua/core.lua b/stand/lua/core.lua
index 11fe17d7cfbe..455230471e7b 100644
--- a/stand/lua/core.lua
+++ b/stand/lua/core.lua
@@ -77,7 +77,7 @@ function try_include(module)
 		-- to treat this like it would require() and specify just the
 		-- base filename, or they know what they're doing as they've
 		-- specified an absolute path and we shouldn't impede.
-		if module:match(".lua$") == nil then
+		if module:match("%.lua$") == nil then
 			module = module .. ".lua"
 		end
 	end