fix(rock-ui): 修复Rock平台凭据配置项被浏览器误识别触发密码自动填充的问题

1. 根因防御(账密陷阱 Honeypot):在配置表单头部注入隐藏的 dummy username/password 输入框,阻断 Chrome/Edge 密码管理器将 BaseURL 和 BearerToken 误判为网站登录凭据;
2. 属性隔离:为 Base URL 和 Bearer Token 分别显式指定独有 name、id 以及 autoComplete 属性(off / new-password);
3. 样式重置:在全局 CSS 中添加 autofill 伪类样式重置,清除浏览器默认侵入的淡蓝/黄色背景色。
This commit is contained in:
yml2213
2026-10-05 16:41:16 +08:00
parent 83870843ed
commit 1df60e5fd5
2 changed files with 26 additions and 2 deletions
+10
View File
@@ -1092,3 +1092,13 @@ a:hover {
font-size: 12px;
font-weight: 700;
}
/* 消除浏览器自动填充默认淡蓝色/黄色背景侵入 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
-webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
-webkit-text-fill-color: #0f172a !important;
transition: background-color 5000s ease-in-out 0s;
}
+16 -2
View File
@@ -587,7 +587,13 @@ export default function PlatformRock() {
</div>
{/* 策略表单 */}
<Form form={form} layout="vertical">
<Form form={form} layout="vertical" autoComplete="off">
{/* 阻断浏览器对凭据配置项的强制账密自动填充 (Honeypot) */}
<div style={{ position: 'absolute', top: -9999, left: -9999, width: 0, height: 0, overflow: 'hidden' }} aria-hidden="true">
<input type="text" name="chrome_prevent_autofill_username" tabIndex={-1} autoComplete="username" />
<input type="password" name="chrome_prevent_autofill_password" tabIndex={-1} autoComplete="current-password" />
</div>
<Row gutter={24}>
<Col xs={24} lg={12}>
<div
@@ -605,7 +611,12 @@ export default function PlatformRock() {
</div>
<Form.Item name="base_url" label="上游平台接口地址 (Base URL)" style={{ marginBottom: 14 }}>
<Input placeholder="https://0666.pro" />
<Input
placeholder="https://0666.pro"
autoComplete="off"
name="upstream_base_url"
id="upstream_base_url"
/>
</Form.Item>
<Form.Item
@@ -622,6 +633,9 @@ export default function PlatformRock() {
>
<Input.Password
placeholder="粘贴 64 位十六进制 Bearer Token"
autoComplete="new-password"
name="upstream_bearer_token"
id="upstream_bearer_token"
addonAfter={
<Button
type="link"