@bytebase/dbhub's read-only mode does not prevent database writes
### Summary Setting `readonly = true` on the `execute_sql` tool does not make the connection read-only. The connectors are written to set PostgreSQL `default_transaction_read_only=on` (and open SQLite in `readOnly` mode), but that code is gated on a config value that is never populated, so it never runs. The only thing left enforcing read-only is a classifier that inspects the first keyword of each statement. Any `SELECT` that writes or has side effects through a function call passes it. With an ordinary role this allows sequence tampering; with a privileged role it allows writing arbitrary files on the server (`lo_export`), reading arbitrary host files (`pg_read_file`), and remote code execution (`dblink` + `COPY ... TO PROGRAM`). The HTTP transport is unauthenticated and binds to `0.0.0.0` by default, so this is reachable by any network caller of `/mcp`. ### Details Two problems combine. **1. The database-level read-only control is dead code.** `PostgresConnector.connect()` only enables it when `config.readonly` is truthy (`src/connectors/postgres/index.ts:175-177`): ```ts // SDK-level readonly enforcement: Set default_transaction_read_only for the entire connection if (config?.readonly) { poolConfig.options = (poolConfig.options || '') + ' -c default_transaction_read_only=on'; } ``` SQLite is gated the same way (`src/connectors/sqlite/index.ts:192`). `ConnectorConfig.readonly` is assigned in exactly one place, and only from `source.readonly` (`src/connectors/manager.ts:236
GHSA-mwwr-p57h-56pf
Primary source · Revision 1
Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.
Security context
Source reference: osv:GHSA-mwwr-p57h-56pf
@bytebase/dbhub
Source reference: /affected/0/package/name
- Affected versions
- Not stated in this record
- Fixed versions
- 0.22.6
Source reference:
/affected/0/ranges - Prerequisites
- Not stated in this record
Structured affected-version data
Original package identities and version rules from this source.
[
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "0"
},
{
"fixed": "0.22.6"
}
]
}
],
"package": {
"name": "@bytebase/dbhub",
"purl": "pkg:npm/%40bytebase/dbhub",
"ecosystem": "npm"
},
"database_specific": {
"source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-mwwr-p57h-56pf/GHSA-mwwr-p57h-56pf.json"
}
}
]- Related CVEs
- CVE-2026-61788
Source reference:
/aliases
Publisher severity
high
Source reference: /database_specific/severity
- Event
- #14230 · Revision 1
- Added to Heist Feed
- Publisher date