安全审计与加固:爱发电回调防投毒、回调日志封顶、令牌定长比较、转义补全;nginx 安全头 / 挡备份与原始内容文件(片段 + 文档)

Browse Source
- 没验证过的爱发电回调不再写进账本 pay_orders,只进 50 条封顶的待核对清单;回调日志只记关键头 + 正文 4KB、5MB 轮转(测试 +2)
- 福利券领取令牌定长比较;ys_admin.py 转义补上引号;星门格子提示转义;首页价格改读公开接口
- nginx 片段:安全头(HSTS/nosniff/XFO/Referrer/Permissions/CSP)、挡备份 / 预览稿 / 隐藏文件 / 原始内容 json、回调单独限流、server_tokens off
- 交接文档 2.9 安全加固 + 维护页挂法更新

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
yws
2026-10-06 12:52:16 +00:00
co-authored by Claude Opus 5.5
parent 9f2322e7ae
commit cb7cd3649b
13 changed files with 133 additions and 53 deletions
+2 -1
View File
@@ -496,7 +496,8 @@ const STN={unpaid:'待付款',paid:'买家说付好了',waiting:'排队中',work
const STC={unpaid:'n',paid:'g',waiting:'b',working:'b',done:'g',failed:'r',void:'n'}; const STC={unpaid:'n',paid:'g',waiting:'b',working:'b',done:'g',failed:'r',void:'n'};
const CSTN={active:'还没用',inactive:'停用',bound:'已激活',used:'已核销'}; const CSTN={active:'还没用',inactive:'停用',bound:'已激活',used:'已核销'};
const CSTC={active:'g',inactive:'n',bound:'b',used:'n'}; const CSTC={active:'g',inactive:'n',bound:'b',used:'n'};
function esc(s){const d=document.createElement('div');d.textContent=s==null?'':String(s);return d.innerHTML;} /* 转义:连引号一起转(2026-10-06 安全加固:原来用 textContent 只转 <>&,放进属性里会被买家写的备注撑破) */
function esc(s){return String(s==null?'':s).replace(/[&<>"']/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]));}
function when(s){return String(s||'').replace('T',' ').slice(5,16);} function when(s){return String(s||'').replace('T',' ').slice(5,16);}
function toast(t){const e=$('#toast');e.textContent=t;e.classList.add('on');clearTimeout(e._t);e._t=setTimeout(()=>e.classList.remove('on'),2600);} function toast(t){const e=$('#toast');e.textContent=t;e.classList.add('on');clearTimeout(e._t);e._t=setTimeout(()=>e.classList.remove('on'),2600);}
function copytxt(t,what){ function copytxt(t,what){