Skip to content

Add --ssl-reject-unauthorized flag for trusting self signed certs#25

Open
matteius wants to merge 3 commits intoexecuteautomation:mainfrom
opensensor:main
Open

Add --ssl-reject-unauthorized flag for trusting self signed certs#25
matteius wants to merge 3 commits intoexecuteautomation:mainfrom
opensensor:main

Conversation

@matteius
Copy link
Copy Markdown

No description provided.

matteius and others added 3 commits December 25, 2025 07:08
Root cause: pg.Client holds a single connection open forever with no
idle timeout, no statement timeout, and no lifecycle management. Every
MCP tool invocation that touches the DB opens a connection that never
closes, eventually exhausting all server connection slots.

Fix:
- Replace pg.Client with pg.Pool (max: 1) so idle connections are
  reaped after 10s via idleTimeoutMillis
- Add statement_timeout (30s) to kill runaway queries — prevents the
  multi-hour zombie SELECT/INSERT queries seen in production
- Add idle_in_transaction_session_timeout (60s) to kill abandoned
  transactions (stuck ROLLBACK/COMMIT)
- Add pool error handler to prevent silent crashes
- Verify connectivity on init with SELECT 1 + proper client.release()
…ction_and_trigger

Aligns the tool surface with the "safe migrations only" policy used by
host projects. Previously only CREATE TABLE / ALTER TABLE /
INSERT-UPDATE-DELETE were exposed, which forced out-of-band psql for
any migration involving enums, indexes, or audit-immutability triggers.

All three new channels prefix-gate their inputs, reject DROP / ALTER /
REPLACE / TRUNCATE / REINDEX in the body (word-boundary match, so
identifiers containing those substrings between underscores are still
allowed), and reject multi-statement submissions.

Validators are exported as pure functions (validateCreateType,
validateCreateIndex, validateFunctionAndTrigger) so they can be tested
without a DB connection; the async wrappers call the validator, then
dbExec. 19-case smoke test suite covers accept/reject paths.

create_function_and_trigger runs the function first, then the trigger;
a trigger failure leaves the function in place with a clear error
message. CREATE OR REPLACE is allowed for the function (trigger
helpers must be idempotent) but not for the trigger itself (triggers
have no OR REPLACE — callers must pick unique trigger names).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant