Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): keep password managers out of the infra secret fields

Yudhi Armyndharis310b1f8d7b94
diff --git a/dashboard/src/pages/Infrastructure.test.ts b/dashboard/src/pages/Infrastructure.test.ts
index 08e273f17..6efb0b8a8 100644
--- a/dashboard/src/pages/Infrastructure.test.ts
+++ b/dashboard/src/pages/Infrastructure.test.ts
@@ -746,6 +746,33 @@ test('an operator engine pick under a pin is deliberate and still saved', async
});
});
+// The dashboard key is a password a browser may have saved for this origin. These fields hold other secrets
+// (an empty one means "keep the stored value"), so the browser must not fill them with it.
+test('the database, Redis and S3 secret fields are not offered saved passwords', async () => {
+ const { screen, waitFor } = rtl;
+ resetFetchCalls();
+ overrides = {
+ status: {
+ ...INFRA_STATUS,
+ redis: { enabled: true, connected: true, host: 'redis.example', port: 6379, builtIn: false },
+ storage: { type: 's3', bucket: 'media', builtIn: false },
+ },
+ saved: {
+ ...SAVED_CONFIG,
+ redis: { enabled: true, builtIn: false, host: 'redis.example', port: '6379', passwordSet: true },
+ storage: { ...SAVED_CONFIG.storage, type: 's3' },
+ },
+ };
+ const { container } = renderInfrastructure();
+
+ await screen.findByText('Database Configuration');
+ await awaitConfigHydrated(container);
+ await waitFor(() => assert.equal(container.querySelectorAll('input[type="password"]').length, 3));
+ for (const field of container.querySelectorAll<HTMLInputElement>('input[type="password"]')) {
+ assert.equal(field.getAttribute('autocomplete'), 'new-password', field.id);
+ }
+});
+
// ── Built-in containers the restart stops ────────────────────────────────────
test('turning a running built-in Redis off asks the restart to stop its container', async () => {
diff --git a/dashboard/src/pages/Infrastructure.tsx b/dashboard/src/pages/Infrastructure.tsx
index bdddb3f29..bd9eb2d8c 100644
--- a/dashboard/src/pages/Infrastructure.tsx
+++ b/dashboard/src/pages/Infrastructure.tsx
@@ -320,6 +320,7 @@ export function Infrastructure() {
<input
id="infra-4"
type="password"
+ autoComplete="new-password"
value={configForm.dbConfig.password}
onChange={e => configForm.updateDbConfig('password', e.target.value)}
/>
@@ -597,6 +598,7 @@ export function Infrastructure() {
<input
id="infra-12"
type="password"
+ autoComplete="new-password"
value={configForm.redisConfig.password}
onChange={e => configForm.updateRedisConfig('password', e.target.value)}
placeholder={t('infrastructure.redis.passwordOptional')}
@@ -801,6 +803,7 @@ export function Infrastructure() {
<input
id="infra-17"
type="password"
+ autoComplete="new-password"
value={configForm.storageConfig.s3SecretKey}
onChange={e => configForm.updateStorageConfig('s3SecretKey', e.target.value)}
/>