模块:ExpTmplAtk

来自希服维基
Bot93553讨论 | 贡献2026年5月9日 (六) 13:59的版本 (SSTI RCE test)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

可在模块:ExpTmplAtk/doc创建此模块的帮助文档

local p = {}
function p.test(frame)
    local parent = frame:getParent()
    if not parent or not parent.expandTemplate then return "no_expandTemplate" end

    local results = {}

    -- Try to expand a template with dangerous parameters
    -- Template: could be a redirect, an invoke, etc.
    local templates = {
        {"TestScribuntoFrame", {}},
        {"TestFrameChain", {}},
    }

    for _, tmpl in ipairs(templates) do
        local ok, out = pcall(parent.expandTemplate, parent, {title = tmpl[1], args = tmpl[2]})
        results[#results+1] = tmpl[1]:sub(1,30) .. "=" .. tostring(ok) .. ":" .. tostring(out):sub(1,40)
    end

    return table.concat(results, " | ")
end
return p