MCPcopy Create free account
hub / github.com/erans/pgsqlite / analyze_table_factor

Method analyze_table_factor

src/security/sql_injection_detector.rs:260–290  ·  view source on GitHub ↗
(
        &self,
        table: &TableFactor,
        analysis: &mut SqlAnalysisResult,
        depth: usize,
        original_query: &str
    )

Source from the content-addressed store, hash-verified

258 }
259
260 fn analyze_table_factor(
261 &self,
262 table: &TableFactor,
263 analysis: &mut SqlAnalysisResult,
264 depth: usize,
265 original_query: &str
266 ) -> Result<(), PgSqliteError> {
267 match table {
268 TableFactor::Table { name, .. } => {
269 let table_name = name.to_string().to_lowercase();
270
271 // Check for system/sensitive tables
272 if self.is_sensitive_table(&table_name) {
273 analysis.accesses_sensitive_tables = true;
274
275 // System table access in complex queries is suspicious
276 if depth > 1 || analysis.union_count > 0 {
277 events::sql_injection_attempt(None, None, original_query, "suspicious system table access");
278 return Err(PgSqliteError::InvalidParameter(
279 "Suspicious system table access detected".to_string()
280 ));
281 }
282 }
283 }
284 TableFactor::Derived { subquery, .. } => {
285 self.analyze_query_statement(subquery, analysis, depth + 1, original_query)?;
286 }
287 _ => {}
288 }
289 Ok(())
290 }
291
292 fn analyze_join(
293 &self,

Callers 2

analyze_joinMethod · 0.80

Calls 3

sql_injection_attemptFunction · 0.85
is_sensitive_tableMethod · 0.80

Tested by

no test coverage detected