Skip to content

Commit 96fbdca

Browse files
committed
fix: address CodeRabbit review feedback
- Align settings precedence: read both override files and let appAsar win, matching the merge order in data.ts - Use getCACertificates() (no arg) to preserve NODE_EXTRA_CA_CERTS alongside system and bundled CAs - Clarify doc wording for app ASAR override location
1 parent 8e9dfa3 commit 96fbdca

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

docs/corporate-certificate-configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ This setting defaults to `false`. When both this and system CAs are active, a wa
6969
| **macOS** | `~/Library/Application Support/Rocket.Chat/overridden-settings.json` |
7070
| **Linux** | `~/.config/Rocket.Chat/overridden-settings.json` |
7171

72-
Settings can also be placed at the app ASAR level (outside the app bundle) for system-wide deployment by administrators.
72+
Settings can also be placed alongside `app.asar` (outside the ASAR archive) for system-wide deployment by administrators.
7373

7474
## Related
7575

src/systemCertificates.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ const readUseSystemCertificatesSetting = (): boolean => {
2424
),
2525
];
2626

27+
let enabled = true;
2728
for (const filePath of locations) {
2829
try {
2930
const content = fs.readFileSync(filePath, 'utf8');
3031
const json = JSON.parse(content);
3132
if (json && typeof json === 'object' && 'useSystemCertificates' in json) {
32-
return (
33+
enabled =
3334
json.useSystemCertificates !== false &&
34-
String(json.useSystemCertificates).toLowerCase() !== 'false'
35-
);
35+
String(json.useSystemCertificates).toLowerCase() !== 'false';
3636
}
3737
} catch {
3838
// File doesn't exist or is invalid — continue to next location
3939
}
4040
}
4141

42-
return true;
42+
return enabled;
4343
};
4444

4545
export const applySystemCertificates = (): void => {
@@ -61,8 +61,8 @@ export const applySystemCertificates = (): void => {
6161
return;
6262
}
6363

64-
const bundledCerts = tls.getCACertificates('bundled');
65-
tls.setDefaultCACertificates([...systemCerts, ...bundledCerts]);
64+
const defaultCerts = tls.getCACertificates();
65+
tls.setDefaultCACertificates([...defaultCerts, ...systemCerts]);
6666

6767
status = { applied: true, certCount: systemCerts.length };
6868
logger.info(

0 commit comments

Comments
 (0)