0.0.1 • Published 7 years ago

sql-sniffer v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

sql-sniffer

Given a string, will return an array of recognize phrases (if present within that string) that pertain to certain System, Data Dictionary, Anonymous Block, DML or DDL database function.

Usage

A simple watchdog for sensitive Database commands and transactions.

Installation

npm install sql-sniffer

Recognized Phrase Patterns:

All patterns are case insensitive

Key:

symbolfunction
*any one of the folowing characters or combos--> ; ' \" -- \ /* \'
...any white space between
..W..any white space and/or words between
Cany "\w" character

Patterns:

Category: Removal

patterna.k.a.
*...truncate...table* truncate table
*...drop...table* drop table
*...drop...procedure* drop procedure
*...drop...package* drop package
*...drop...function* drop function
*...drop...index* drop index
*...drop...bitmap...index* drop bitmap index
*...drop...unique...index* drop unique index
*...drop...materialized...view* drop materialized view
*...drop...view* drop view
*...drop...trigger* drop trigger
*...drop...type* drop type
*...delete...from* delete from
*...purge...table* purge table
*...purge...recyclebin* purge recyclebin

Category: DDL

patterna.k.a.
*...create...or...replace* create or replace
*...create...table* create table
*...alter...table* alter table
*...create...procedure* create table
*...create...package* create package
*...create...function* create function
*...create...index* create index
*...alter...index..W..rebuild* alter index TEXT HERE rebuild
*...alter...index..W..rename* alter index TEXT HERE rename
*...create...bitmap...index* create bitmap index
*...create...unique..index* create unique index
*...create...materialized view* create materialized view
*...create...view* create view
*...alter...view* alter view
*...create...trigger* create trigger
*...create...type...as* create type as

Category: System

patterna.k.a.
*...alter...system...set* alter system
*...shutdown...normal* shutdown normal
*...shutdown...immediate* shutdown immediate
*...shutdown...transactional* shutdown transactional
*...shutdown...abort* shutdown abort

Category: DML

patterna.k.a.
*...update...set* update set
*...insert...into* insert into
*...insert...all...into* insert all into
*...merge...into..W..using* merge into TEXT HERE using

Category: Anonymous Block

patterna.k.a.
*...begin..W..;...endbegin TEXT HERE; end
*...sys.Csys.TEXT HERE
*...execute immediateexecute immediate
*...&&&&

Category: Data Dictionary

patterna.k.a.
v$v$
from..W..all_from TEXT HERE all_
from..W..dba_from TEXT HERE dba_
from..W..user_from TEXT HERE user_

Category: Additional Patterns

patterna.k.a.
1...=...1...--1=1--
1...=...1...#1=1#
1...=...1.../*1=1/*
'...1...'...=...'...1...--'1'='1--
admin...'...--admin'--
admin...'...#admin'#
admin...'.../*admin'/*