MCPcopy Index your code
hub / github.com/bytebase/dbhub / isReadOnlySQL

Function isReadOnlySQL

src/utils/allowed-keywords.ts:104–109  ·  view source on GitHub ↗
(sql: string, connectorType: ConnectorType | string)

Source from the content-addressed store, hash-verified

102 * 4. For EXPLAIN statements, rejects EXPLAIN ANALYZE with DML.
103 */
104export function isReadOnlySQL(sql: string, connectorType: ConnectorType | string): boolean {
105 return checkReadOnly(
106 stripCommentsAndStrings(sql, connectorType as ConnectorType).trim().toLowerCase(),
107 connectorType,
108 );
109}
110
111function checkReadOnly(cleanedSQL: string, connectorType: ConnectorType | string): boolean {
112 // Empty after stripping → deny. Attacker-crafted inputs may reduce to

Callers 4

registerCustomToolFunction · 0.85
areAllStatementsReadOnlyFunction · 0.85
areAllStatementsReadOnlyFunction · 0.85

Calls 2

checkReadOnlyFunction · 0.85
stripCommentsAndStringsFunction · 0.85

Tested by 1

areAllStatementsReadOnlyFunction · 0.68