CSP violations on login page blocking inline scripts and font loading (17 errors)

未关闭
#430 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞

调研方向

从 https://hackmd.io/login 开始,打开浏览器 DevTools Console,并检查 response CSP header 以及被阻止的 script 和 font 请求。找出生成该 header 的 configuration,并将其与 issue 中列出的 resources 对照;当登录页面加载时不再出现报告中的 CSP violations,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Is this a hackmd.io issue?
What's the problem
Current behaviour

Opening the HackMD sign-in page triggers 17 Content Security Policy (CSP) errors in the browser console:

  1. script-src directive blocks inline script execution and scripts from multiple external domains (YouTube, Google, Stripe, Sentry, Plausible, Tally, etc.)
  2. font-src directive blocks font loading from several URLs (16 occurrences)

The CSP header appears to be missing required domains in its whitelist, and lacks proper nonce or 'unsafe-inline' configuration for inline scripts.

Screenshot:

Image

Steps to reproduce:

  1. Go to https://hackmd.io/login
  2. Open browser DevTools → Console tab
  3. Observe 17 CSP violation errors
Expected behaviour

The login page should load without CSP violations. All required external scripts (Google sign-in, Stripe, Sentry, analytics, etc.) and fonts should be whitelisted in the CSP header.

Environment

Desktop

  • OS: iOS, win 11
  • Browser: chrome, chrome
  • Browser Version: Version 146.0.7680.75 (Official Build) (64-bit)
Additional context

The blocked domains include: youtube.com, gist.github.com, slideshare.net, vimeo.com, google.com, stripe.com, sentry-cdn.com, plausible.io, tally.so, among others. This suggests the CSP script-src directive needs updating to match the scripts actually loaded by the page.

主要语言
没有语言数据
星标
40
派生
9
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

hackmdio/hackmd-io-issues 的其他 Issue

查看 hackmdio/hackmd-io-issues 的全部 Issue

相似的 Issue

更多 Security Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。