Skip to content

Commit 83153fa

Browse files
committed
chore: update project configuration and improve documentation
- Updated .gitignore to include .codex directory. - Changed Gitleaks configuration title to reflect the new project name. - Enhanced SSL configuration logic in db.js for better handling of local and non-local connections. - Updated roleMenuTemplates.js to improve conflict handling in SQL insertions. - Adjusted links in safeSend.js and sanitizeMentions.js to point to the new repository. - Modified Pricing.tsx to reflect updated pricing tiers. - Updated header.tsx to link to the new project repository.
1 parent 9e1c9df commit 83153fa

9 files changed

Lines changed: 73 additions & 18 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@ web/.env.local
3838
web/.env.*.local
3939
web/tsconfig.tsbuildinfo
4040

41-
# OpenClaw
41+
# Tools
4242
openclaw-studio/
43+
.codex/

.gitleaks.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Gitleaks configuration for bills-bot
1+
# Gitleaks configuration for volvox-bot
22
# https://github.com/gitleaks/gitleaks
33

4-
title = "bills-bot gitleaks config"
4+
title = "volvox-bot gitleaks config"
55

66
# Extend the default ruleset — adds standard rules for AWS, GCP, GitHub tokens, etc.
77
[extend]

src/db.js

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,65 @@ let leakDetectionInterval = null;
2424
* Selects the SSL configuration for a pg.Pool based on DATABASE_SSL and the connection string.
2525
*
2626
* DATABASE_SSL values:
27-
* "false" / "off" → SSL disabled
28-
* "no-verify" → SSL enabled but server certificate not verified
29-
* "true" / "on" / unset → SSL enabled with server certificate verification
27+
* "false" / "off" / "disable" → SSL disabled
28+
* "no-verify" → SSL enabled but server certificate not verified
29+
* "true" / "on" / "require" → SSL enabled with server certificate verification
3030
*
31-
* Connections whose host contains "railway.internal" always disable SSL.
31+
* If DATABASE_SSL is unset, SSL is disabled for local connections and enabled
32+
* with full certificate verification for non-local connections.
3233
*
3334
* @param {string} connectionString - Database connection URL
3435
* @returns {false|{rejectUnauthorized: boolean}} `false` to disable SSL, or an object with `rejectUnauthorized` indicating whether server certificates must be verified
3536
*/
3637
function getSslConfig(connectionString) {
37-
// Railway internal connections never need SSL
38-
if (connectionString.includes('railway.internal')) {
38+
let hostname = '';
39+
let sslMode = '';
40+
41+
try {
42+
const connectionUrl = new URL(connectionString);
43+
hostname = connectionUrl.hostname.toLowerCase();
44+
sslMode = (connectionUrl.searchParams.get('sslmode') || '').toLowerCase().trim();
45+
} catch {
46+
// Ignore malformed URLs and fall back to safe defaults.
47+
}
48+
49+
// Explicit sslmode=disable in connection string takes precedence.
50+
if (sslMode === 'disable' || sslMode === 'off' || sslMode === 'false') {
51+
return false;
52+
}
53+
54+
// Railway internal connections never need SSL.
55+
if (hostname.includes('railway.internal') || connectionString.includes('railway.internal')) {
3956
return false;
4057
}
4158

4259
const sslEnv = (process.env.DATABASE_SSL || '').toLowerCase().trim();
4360

44-
if (sslEnv === 'false' || sslEnv === 'off') {
61+
if (sslEnv === 'false' || sslEnv === 'off' || sslEnv === 'disable' || sslEnv === '0') {
4562
return false;
4663
}
4764

4865
if (sslEnv === 'no-verify') {
4966
return { rejectUnauthorized: false };
5067
}
5168

52-
// Default: SSL with full verification
69+
if (sslEnv === 'true' || sslEnv === 'on' || sslEnv === 'require' || sslEnv === '1') {
70+
return { rejectUnauthorized: true };
71+
}
72+
73+
// Local development databases commonly run without TLS.
74+
if (!sslEnv && ['localhost', '127.0.0.1', '::1'].includes(hostname)) {
75+
return false;
76+
}
77+
78+
if (sslEnv) {
79+
warn('Unrecognized DATABASE_SSL value, using secure default', {
80+
value: sslEnv,
81+
source: 'database_ssl',
82+
});
83+
}
84+
85+
// Default: SSL with full verification.
5386
return { rejectUnauthorized: true };
5487
}
5588

src/modules/roleMenuTemplates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export async function seedBuiltinTemplates() {
244244
`INSERT INTO role_menu_templates
245245
(name, description, category, created_by_guild_id, is_builtin, is_shared, options)
246246
VALUES ($1, $2, $3, NULL, TRUE, TRUE, $4::jsonb)
247-
ON CONFLICT ON CONSTRAINT idx_rmt_name_guild DO NOTHING`,
247+
ON CONFLICT (LOWER(name), COALESCE(created_by_guild_id, '__builtin__')) DO NOTHING`,
248248
[tpl.name, tpl.description, tpl.category, JSON.stringify(tpl.options)],
249249
);
250250
}

src/utils/safeSend.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* truncated instead — Discord only allows a single response per interaction
88
* method call (reply/editReply/followUp).
99
*
10-
* @see https://github.com/BillChirico/bills-bot/issues/61
10+
* @see https://github.com/VolvoxLLC/volvox-bot/issues/61
1111
*/
1212

1313
import { error as logError, warn as logWarn } from '../logger.js';

src/utils/sanitizeMentions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Even though allowedMentions is set at the Client level, this ensures
55
* the raw text never contains these pings.
66
*
7-
* @see https://github.com/BillChirico/bills-bot/issues/61
7+
* @see https://github.com/VolvoxLLC/volvox-bot/issues/61
88
*/
99

1010
/**

tests/db.test.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,31 @@ describe('db module', () => {
227227
expect(pgMocks.poolConfig.ssl).toEqual({ rejectUnauthorized: false });
228228
});
229229

230-
it('should use rejectUnauthorized: true by default', async () => {
230+
it('should disable SSL by default for localhost connections', async () => {
231231
process.env.DATABASE_URL = 'postgresql://test@localhost/db';
232232
delete process.env.DATABASE_SSL;
233233
await dbModule.initDb();
234+
expect(pgMocks.poolConfig.ssl).toBe(false);
235+
});
236+
237+
it('should use rejectUnauthorized: true by default for non-local hosts', async () => {
238+
process.env.DATABASE_URL = 'postgresql://test@db.example.com/db';
239+
delete process.env.DATABASE_SSL;
240+
await dbModule.initDb();
241+
expect(pgMocks.poolConfig.ssl).toEqual({ rejectUnauthorized: true });
242+
});
243+
244+
it('should disable SSL when connection string uses sslmode=disable', async () => {
245+
process.env.DATABASE_URL = 'postgresql://test@db.example.com/db?sslmode=disable';
246+
delete process.env.DATABASE_SSL;
247+
await dbModule.initDb();
248+
expect(pgMocks.poolConfig.ssl).toBe(false);
249+
});
250+
251+
it('should allow explicit DATABASE_SSL=true override for localhost', async () => {
252+
process.env.DATABASE_URL = 'postgresql://test@localhost/db';
253+
process.env.DATABASE_SSL = 'true';
254+
await dbModule.initDb();
234255
expect(pgMocks.poolConfig.ssl).toEqual({ rejectUnauthorized: true });
235256
});
236257
});

web/src/components/landing/Pricing.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const tiers = [
2020
},
2121
{
2222
name: './configure',
23-
price: { monthly: 12, annual: 115 },
23+
price: { monthly: 14.99, annual: 115 },
2424
description: 'For growing communities that ship.',
2525
cta: 'npm install',
2626
href: null, // Will use bot invite URL
@@ -36,7 +36,7 @@ const tiers = [
3636
},
3737
{
3838
name: 'make install',
39-
price: { monthly: 49, annual: 470 },
39+
price: { monthly: 49.99, annual: 470 },
4040
description: 'For communities that mean business.',
4141
cta: 'curl | bash',
4242
href: null, // Will use bot invite URL

web/src/components/layout/header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function Header() {
8787
<DropdownMenuSeparator />
8888
<DropdownMenuItem asChild>
8989
<a
90-
href="https://github.com/BillChirico/bills-bot"
90+
href="https://github.com/VolvoxLLC/volvox-bot"
9191
target="_blank"
9292
rel="noopener noreferrer"
9393
className="flex items-center"

0 commit comments

Comments
 (0)