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

+44 -18
View File
@@ -9,6 +9,26 @@ layui.define(['form', 'table', 'http', 'auth'], function (exports) {
auth.init(_savedPerms);
auth.setController('score');
// 动作候选(核心预置 + 插件注册 + 规则表已使用),供 datalist 提示
var actionList = [];
function loadActions() {
http.get('actions').then(function (res) {
if (res.code === 0 && res.data) {
actionList = res.data;
var html = '';
layui.$.each(actionList, function (i, item) {
html += '<option value="' + item.action + '">' + item.title + (item.addon ? '(插件:' + item.addon + ')' : '') + '</option>';
});
$('#action-list').html(html);
}
}).catch(function () { });
}
loadActions();
function dateStr(v) {
return v ? layui.util.toDateString(v * 1000) : '-';
}
table.render({
elem: '#dataTable',
url: "index",
@@ -20,13 +40,15 @@ layui.define(['form', 'table', 'http', 'auth'], function (exports) {
cols: [[
{ type: "checkbox", width: 50 },
{ field: 'id', width: 80, title: 'ID', sort: true },
{ field: 'name', minWidth: 160, title: '规则名称' },
{ field: 'action', width: 160, title: '触发动作' },
{ field: 'title', minWidth: 160, title: '规则名称' },
{ field: 'action', width: 170, title: '触发动作' },
{ field: 'type_text', width: 90, title: '类型', templet: '#typeTpl' },
{ field: 'value', width: 90, title: '变动值', sort: true },
{ field: 'sort', width: 90, title: '排序', sort: true },
{ field: 'limit_text', width: 110, title: '限次' },
{ field: 'addon', width: 100, title: '归属', templet: '#addonTpl' },
{ field: 'sort', width: 80, title: '排序', sort: true },
{ field: 'status', width: 100, title: '状态', templet: '#statusTpl' },
{ field: 'create_time', width: 180, title: '创建时间' },
{ field: 'create_at', width: 170, title: '创建时间', templet: function (d) { return dateStr(d.create_at); } },
{ title: '操作', minWidth: 120, toolbar: '#dataBar', align: "center" }
]],
limits: [10, 15, 20, 25, 50, 100],
@@ -35,24 +57,20 @@ layui.define(['form', 'table', 'http', 'auth'], function (exports) {
skin: 'line',
done: function () {
var view = $('#dataTable').next('.layui-table-view');
view.find('[data-perm]').each(function () {
var perm = $(this).attr('data-perm');
if (perm && !auth.has(perm)) { $(this).remove(); }
});
$('.layui-btn[data-perm]').each(function () {
var perm = $(this).attr('data-perm');
if (perm && !auth.has(perm)) { $(this).remove(); }
});
auth.filterDom(view);
auth.filterDom('.layui-btn[data-perm]');
}
});
form.on('submit(data-search-btn)', function (data) {
table.reload('dataTable', { page: { curr: 1 }, where: { name: data.field.name } });
table.reload('dataTable', { page: { curr: 1 }, where: { title: data.field.title, action: data.field.action } });
return false;
});
$('#btn-reset').on('click', function () {
$('input[name="name"]').val('');
table.reload('dataTable', { page: { curr: 1 }, where: { name: '' } });
$('input[name="title"]').val('');
$('select[name="action"]').val('');
form.render('select');
table.reload('dataTable', { page: { curr: 1 }, where: { title: '', action: '' } });
});
table.on('toolbar(dataTable)', function (elem) {
@@ -91,7 +109,15 @@ layui.define(['form', 'table', 'http', 'auth'], function (exports) {
title: title, content: formHtml, anim: "slideLeft", offset: "r",
btnAlign: "l", area: [window.width > 768 ? '50%' : '99%', '99%'],
shade: 0.1, shadeClose: true, btn: ['确定', '取消'],
success: function (layero, index) { callback(layero, index); form.render(); },
success: function (layero, index) {
// 重新填充动作候选(弹层是新建 DOM)
var html = '';
layui.$.each(actionList, function (i, item) {
html += '<option value="' + item.action + '">' + item.title + (item.addon ? '(插件:' + item.addon + ')' : '') + '</option>';
});
layero.find('#action-list').html(html);
callback(layero, index); form.render();
},
yes: function (index, layero) {
window.layui.form.on('submit(wxapp-form-submit)', function (elem) {
done(layero, index, elem); layui.off('submit(wxapp-form)', 'from'); return false;
@@ -145,9 +171,9 @@ layui.define(['form', 'table', 'http', 'auth'], function (exports) {
cols: [[
{ type: 'checkbox', fixed: 'left' },
{ field: 'id', title: 'ID', width: 80, sort: true, fixed: 'left' },
{ field: 'name', title: '规则名称', minWidth: 160, fixed: 'left' },
{ field: 'title', title: '规则名称', minWidth: 160, fixed: 'left' },
{ field: 'sort', title: '排序', width: 80 },
{ field: 'delete_at', title: '删除时间', width: 160 },
{ field: 'delete_at', title: '删除时间', width: 170, templet: function (d) { return dateStr(d.delete_at); } },
{ fixed: "right", title: "操作", width: 140, align: "center", toolbar: "#dataRecybinBarTpl" }
]],
page: true