feat(api): make tor and breached password lookups opt-in (#2834)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-19 01:22:17 +02:00
1 parent efd677f32b
commit f32356801d
17 files changed
+186 -40

No files matched your search

+2 -5
View File
@@ -252,15 +252,12 @@ function defaultConfig(): MasterConfig {
},
},
blocklist_feeds: {},
tor_exit_list: {},
breached_password_check: {},
risk_integration: {
enabled: false,
ipinfo_api_key: '',
account_policy_dsl: undefined,
tor: {
block_all_relays: false,
reverse_dns_heuristic: false,
reverse_dns_timeout_ms: 750,
},
},
push: {
apns: {
+6 -5
View File
@@ -298,15 +298,16 @@ export interface MasterConfig {
blocklist_feeds: {
enabled?: boolean;
};
tor_exit_list: {
enabled?: boolean;
};
breached_password_check: {
enabled?: boolean;
};
risk_integration: {
enabled: boolean;
ipinfo_api_key: string;
account_policy_dsl?: unknown;
tor: {
block_all_relays: boolean;
reverse_dns_heuristic: boolean;
reverse_dns_timeout_ms: number;
};
};
push: {
apns: {
@@ -638,6 +638,27 @@ describe('ConfigLoader', () => {
expect((await loadConfig()).integrations.cache_purge.adapter).toBe('none');
});
test('leaves the optional outbound lookups unset by default', async () => {
stubMinimalEnv();
const config = await loadConfig();
expect(config.integrations.tor_exit_list.enabled).toBeUndefined();
expect(config.integrations.breached_password_check.enabled).toBeUndefined();
});
test('reads the optional outbound lookup switches from the environment', async () => {
stubMinimalEnv({
FLUXER_TOR_EXIT_LIST_ENABLED: 'true',
FLUXER_BREACHED_PASSWORD_CHECK_ENABLED: 'false',
});
const config = await loadConfig();
expect(config.integrations.tor_exit_list.enabled).toBe(true);
expect(config.integrations.breached_password_check.enabled).toBe(false);
});
test('leaves Bluesky login off with no legal URLs by default', async () => {
stubMinimalEnv();
@@ -340,24 +340,17 @@ const NAMED_FLUXER_ENV_OVERRIDES: Record<string, NamedEnvOverride> = {
parse: parseInteger,
},
FLUXER_BLOCKLIST_FEEDS_ENABLED: {path: ['integrations', 'blocklist_feeds', 'enabled'], parse: parseBoolean},
FLUXER_TOR_EXIT_LIST_ENABLED: {path: ['integrations', 'tor_exit_list', 'enabled'], parse: parseBoolean},
FLUXER_BREACHED_PASSWORD_CHECK_ENABLED: {
path: ['integrations', 'breached_password_check', 'enabled'],
parse: parseBoolean,
},
FLUXER_RISK_INTEGRATION_ENABLED: {path: ['integrations', 'risk_integration', 'enabled'], parse: parseBoolean},
FLUXER_RISK_IPINFO_API_KEY: {path: ['integrations', 'risk_integration', 'ipinfo_api_key']},
FLUXER_ACCOUNT_POLICY_DSL: {
path: ['integrations', 'risk_integration', 'account_policy_dsl'],
parse: parseEnvValue,
},
FLUXER_RISK_TOR_BLOCK_ALL_RELAYS: {
path: ['integrations', 'risk_integration', 'tor', 'block_all_relays'],
parse: parseBoolean,
},
FLUXER_RISK_TOR_REVERSE_DNS_HEURISTIC: {
path: ['integrations', 'risk_integration', 'tor', 'reverse_dns_heuristic'],
parse: parseBoolean,
},
FLUXER_RISK_TOR_REVERSE_DNS_TIMEOUT_MS: {
path: ['integrations', 'risk_integration', 'tor', 'reverse_dns_timeout_ms'],
parse: parseInteger,
},
FLUXER_PUSH_APNS_ENABLED: {path: ['integrations', 'push', 'apns', 'enabled'], parse: parseBoolean},
FLUXER_PUSH_APNS_TEAM_ID: {path: ['integrations', 'push', 'apns', 'team_id']},
FLUXER_PUSH_APNS_KEY_ID: {path: ['integrations', 'push', 'apns', 'key_id']},