feat: 上线前安全加固与发布工程化;appmall 由插件迁移为独立应用

安全(P0)
- 发布包签名:新增 scripts/package_keygen.php、scripts/package_verify.php、
  ywxapp\service\PackageVerifier;FrameworkService::apply() 解压前强制验签
  (ywxapp.framework_package_verify,默认开启)
- JWT 收紧:config/jwt.php 移除公开默认密钥,JwtService::assertStrongSecret()
  校验非空 / 长度≥32 / 已知弱值;.env.production.example 键名由 JWT_SECRET_KEY 修正为 JWT_SECRET
- /api/v1/Article:免登录白名单收窄为只读接口,写操作字段白名单 + assertOwner() 越权校验
- 开发者令牌:查找接口不再回显明文、统一失败文案 + 限流
- TemplateInstaller:文件名白名单 + realpath 归一化 + 目录内断言,修复 Zip Slip;补 use ZipArchive
- 后台登录:接入验证码、失败锁定与登录限流(config/ratelimit.php)
- 缓存 / Session 驱动可由 .env 覆盖(CACHE_DRIVER / SESSION_TYPE),集群部署改 redis
- paycenter 支付日志开关改为 PAY_LOG,不再跟随 APP_DEBUG

工程化 / 交付
- 新增 CHANGELOG.md 与 .env.production.example;composer.lock 入库锁定依赖版本
- 插件离线安装 CLI 增加 --uid,后台上传安装透传 uid,付费插件授权校验可通过
- 授权拒绝文案区分「未携带 uid」与「未找到有效授权」,便于排障
- .gitignore 放行 .env.production.example / .env.addon.example / .gitattributes / public/.htaccess

结构
- appmall 由 addon/appmall 迁移为独立应用 app/appmall(市场 / 开发者中心 / 审核 / 分润)
This commit is contained in:
yangwx committed 2026-10-22 00:53:39 +08:00
1 parent 1d49e6f5ee
commit 18101cf11a
636 files changed
+58517 -9519

No files matched your search

+40 -6
View File
@@ -97,6 +97,32 @@
{/volist}
{elseif $f.type == 'number' /}
<input type="number" name="{$f.name}" value="{$f.value}" class="layui-input">
{elseif $f.type == 'switch' /}
<!-- 隐藏域保证「关闭」也能提交 0(layui switch 未勾选时不提交) -->
<input type="hidden" name="{$f.name}" value="0">
<input type="checkbox" name="{$f.name}" value="1" lay-skin="switch" lay-text="开|关" {if $f.value}checked{/if}>
{elseif $f.type == 'array' /}
<textarea name="{$f.name}" class="layui-textarea" rows="5"
placeholder="每行一条,格式:键=值(不写等号则作为列表项)">{$f.value}</textarea>
{elseif $f.type == 'date' /}
<input type="text" name="{$f.name}" value="{$f.value}" class="layui-input cfg-date"
placeholder="YYYY-MM-DD" autocomplete="off">
{elseif $f.type == 'image' /}
<input type="text" name="{$f.name}" value="{$f.value}" class="layui-input" placeholder="图片地址">
{if $f.value}
<div style="margin-top:6px;"><img src="{$f.value}" style="max-height:80px;"></div>
{/if}
{elseif $f.type == 'file' /}
<input type="text" name="{$f.name}" value="{$f.value}" class="layui-input" placeholder="文件路径或 URL">
{elseif $f.type == 'color' /}
<input type="color" name="{$f.name}" value="{$f.value|default='#1E9FFF'}" class="layui-input"
style="width:80px;padding:2px;height:38px;">
{elseif $f.type == 'tags' /}
<input type="text" name="{$f.name}" value="{$f.value}" class="layui-input" placeholder="多个用逗号分隔">
{elseif $f.type == 'password' /}
<input type="password" name="{$f.name}" value="{$f.value}" class="layui-input" autocomplete="new-password">
{elseif $f.type == 'editor' /}
<textarea name="{$f.name}" class="layui-textarea cfg-editor" rows="8" placeholder="支持 HTML">{$f.value}</textarea>
{else /}
<input type="text" name="{$f.name}" value="{$f.value}" class="layui-input">
{/if}
@@ -114,12 +140,18 @@
</div>
</div>
<script src="/assets/layui/layui.js"></script>
<!-- 本页是独立页(不走 layout),必须自己引入 ywxapp.js 才能用集成的 http -->
<script src="/assets/ywxapp/ywxapp.js" module="backend"></script>
<script>
layui.use(['form', 'layer'], function () {
var form = layui.form, $ = layui.jquery, layer = layui.layer;
layui.use(['form', 'layer', 'ywxapp', 'http', 'laydate'], function () {
var form = layui.form, $ = layui.jquery, layer = layui.layer, http = layui.http, laydate = layui.laydate;
// date 型字段:逐个绑定日期选择(laydate 的 class 选择器只渲染首个,故遍历 DOM)
Array.prototype.forEach.call(document.querySelectorAll('input.cfg-date'), function (el) {
laydate.render({ elem: el, type: 'date' });
});
form.on('submit(cfgForm)', function (data) {
$.post(window.location.href, data.field, function (r) {
if (r.code === 0) {
http.post(window.location.href, data.field).then(function (r) {
if (r && r.code === 0) {
layer.msg(r.message || '保存成功', { icon: 1 });
// 保存成功后自动跳回插件列表(兼容 layui admin 的 tab 场景),
// 避免停留在配置 tab 需要手动关闭重开才能看到列表。
@@ -127,9 +159,11 @@
window.location.href = '{:url("addon/index")}';
}, 800);
} else {
layer.msg(r.message || '保存失败', { icon: 2 });
layer.msg((r && r.message) || '保存失败', { icon: 2 });
}
}, 'json');
}).catch(function (err) {
layer.msg('请求失败:' + (err && err.message ? err.message : '网络异常'), { icon: 2 });
});
return false;
});
});