(function(){try{var t=localStorage.getItem("gw-theme");if(t==="dark"||t==="light"){document.documentElement.setAttribute("data-theme",t);}}catch(e){}})();

密码存储

密码使用 PBKDF2-HMAC-SHA256(120000 次迭代)加盐哈希,绝不明文保存,也不会在日志中出现。

会话

登录后会话令牌存放在 D1 中,浏览器侧使用 httpOnly Cookie 携带,SameSite 设为 Lax。

私有仓库

私有仓库的读取与写入都需要通过认证;Git 传输在未认证时返回 401 质询,客户端会自动带上 Basic 认证信息重试。

内容安全

README 等用户提交的内容在渲染前会经过转义与白名单过滤,脚本标签与危险链接会被拦截。

(function(){var b=document.getElementById("theme-toggle");if(!b){return;}b.addEventListener("click",function(){var r=document.documentElement.getAttribute("data-theme");var m=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;var n=r?r:(m?"dark":"light");n=n==="dark"?"light":"dark";document.documentElement.setAttribute("data-theme",n);try{localStorage.setItem("gw-theme",n);}catch(e){}b.setAttribute("data-theme-state",n);});})();