dsh
7e6dd0cc02
fix: SECURITY_TODO #31 普通作者不可置顶全站文章
任意注册作者可经 /api/my/articles 提交 is_top=true 把文章钉在全站
首页最顶端(publishedArticleOrder 为 is_top DESC 优先),属影响公共
展示位的横向越权(确认非设计意图,予收紧)。
- handlers/article.go: 拆出共享实现 articleCreate/articleUpdate,
增加 allowIsTop 开关;admin 路径保持 true
- handlers/my_articles.go: 作者创建强制 is_top=false;编辑保留库中
现有值(管理员授权的置顶不因作者编辑而丢失,作者也无法自行取消)
- templates/user/my_article_form.html: 移除置顶复选框
- 测试: TestMyArticlesCannotPin(作者 create/update is_top=true →
落库 false;admin 路径可置顶;作者编辑不丢置顶)
2026-08-27 21:46:27 +08:00
..
2026-08-27 19:52:07 +08:00
2026-08-27 20:14:28 +08:00
2026-08-27 19:56:03 +08:00
2026-08-27 21:46:27 +08:00