Documentation ¶
Index ¶
- type AllowAllHandler
- type AllowHandler
- func (handler *AllowHandler) AddPatterns(patterns []string) error
- func (handler *AllowHandler) AddQueries(queries []string) error
- func (handler *AllowHandler) AddTables(tableNames []string)
- func (handler *AllowHandler) CheckQuery(normalizedQuery string, parsedQuery sqlparser.Statement) (bool, error)
- func (handler *AllowHandler) Release()
- func (handler *AllowHandler) RemoveQueries(queries []string) error
- func (handler *AllowHandler) RemoveTables(tableNames []string)
- func (handler *AllowHandler) Reset()
- type DenyAllHandler
- type DenyHandler
- func (handler *DenyHandler) AddPatterns(patterns []string) error
- func (handler *DenyHandler) AddQueries(queries []string) error
- func (handler *DenyHandler) AddTables(tableNames []string)
- func (handler *DenyHandler) CheckQuery(normalizedQuery string, parsedQuery sqlparser.Statement) (bool, error)
- func (handler *DenyHandler) Release()
- func (handler *DenyHandler) RemoveQueries(queries []string) error
- func (handler *DenyHandler) RemoveTables(tableNames []string)
- func (handler *DenyHandler) Reset()
- type QueryCaptureHandler
- type QueryIgnoreHandler
- func (handler *QueryIgnoreHandler) AddQueries(queries []string)
- func (handler *QueryIgnoreHandler) CheckQuery(rawQuery string, parsedQuery sqlparser.Statement) (bool, error)
- func (handler *QueryIgnoreHandler) Release()
- func (handler *QueryIgnoreHandler) RemoveQueries(queries []string)
- func (handler *QueryIgnoreHandler) Reset()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowAllHandler ¶
type AllowAllHandler struct {
// contains filtered or unexported fields
}
AllowAllHandler allows any input query
func NewAllowallHandler ¶
func NewAllowallHandler() *AllowAllHandler
NewAllowallHandler is a constructor for AllowAllHandler
func (*AllowAllHandler) CheckQuery ¶
func (handler *AllowAllHandler) CheckQuery(sqlQuery string, parsedQuery sqlparser.Statement) (bool, error)
CheckQuery passes any input query
func (*AllowAllHandler) Release ¶
func (handler *AllowAllHandler) Release()
Release is for compliance with QueryHandlerInterface
type AllowHandler ¶
type AllowHandler struct {
// contains filtered or unexported fields
}
AllowHandler allows query/pattern/table and restricts/forbids everything else
func NewAllowHandler ¶
func NewAllowHandler(parser *sqlparser.Parser) *AllowHandler
NewAllowHandler creates new whitelist instance
func (*AllowHandler) AddPatterns ¶
func (handler *AllowHandler) AddPatterns(patterns []string) error
AddPatterns adds patterns that should be whitelisted
func (*AllowHandler) AddQueries ¶
func (handler *AllowHandler) AddQueries(queries []string) error
AddQueries normalizes and adds queries to the list that should be whitelisted
func (*AllowHandler) AddTables ¶
func (handler *AllowHandler) AddTables(tableNames []string)
AddTables adds tables that should be whitelisted
func (*AllowHandler) CheckQuery ¶
func (handler *AllowHandler) CheckQuery(normalizedQuery string, parsedQuery sqlparser.Statement) (bool, error)
CheckQuery checks each query, returns false and error if query is not whitelisted or if query tries to access to non-whitelisted table
func (*AllowHandler) Release ¶
func (handler *AllowHandler) Release()
Release releases all resources
func (*AllowHandler) RemoveQueries ¶
func (handler *AllowHandler) RemoveQueries(queries []string) error
RemoveQueries removes queries from the list that should be whitelisted
func (*AllowHandler) RemoveTables ¶
func (handler *AllowHandler) RemoveTables(tableNames []string)
RemoveTables removes whitelisted tables
func (*AllowHandler) Reset ¶
func (handler *AllowHandler) Reset()
Reset resets whitelist to initial state
type DenyAllHandler ¶
type DenyAllHandler struct {
// contains filtered or unexported fields
}
DenyAllHandler denies any input query
func NewDenyallHandler ¶
func NewDenyallHandler() *DenyAllHandler
NewDenyallHandler is a constructor for DenyAllHandler
func (*DenyAllHandler) CheckQuery ¶
func (handler *DenyAllHandler) CheckQuery(sqlQuery string, parsedQuery sqlparser.Statement) (bool, error)
CheckQuery blocks any input query
func (*DenyAllHandler) Release ¶
func (handler *DenyAllHandler) Release()
Release is for compliance with QueryHandlerInterface
type DenyHandler ¶
type DenyHandler struct {
// contains filtered or unexported fields
}
DenyHandler allows everything and forbids specific query/pattern/table
func NewDenyHandler ¶
func NewDenyHandler(parser *sqlparser.Parser) *DenyHandler
NewDenyHandler creates new blacklist instance
func (*DenyHandler) AddPatterns ¶
func (handler *DenyHandler) AddPatterns(patterns []string) error
AddPatterns adds patterns that should be blacklisted
func (*DenyHandler) AddQueries ¶
func (handler *DenyHandler) AddQueries(queries []string) error
AddQueries normalizes and adds queries to the list that should be blacklisted
func (*DenyHandler) AddTables ¶
func (handler *DenyHandler) AddTables(tableNames []string)
AddTables adds tables that should be blacklisted
func (*DenyHandler) CheckQuery ¶
func (handler *DenyHandler) CheckQuery(normalizedQuery string, parsedQuery sqlparser.Statement) (bool, error)
CheckQuery checks each query, returns false and error if query is blacklisted or if query tries to access to forbidden table
func (*DenyHandler) RemoveQueries ¶
func (handler *DenyHandler) RemoveQueries(queries []string) error
RemoveQueries removes queries from the list that should be blacklisted
func (*DenyHandler) RemoveTables ¶
func (handler *DenyHandler) RemoveTables(tableNames []string)
RemoveTables removes blacklisted tables
func (*DenyHandler) Reset ¶
func (handler *DenyHandler) Reset()
Reset resets blacklist to initial state
type QueryCaptureHandler ¶
type QueryCaptureHandler struct {
// contains filtered or unexported fields
}
QueryCaptureHandler provides logging mechanism of censor
func NewQueryCaptureHandler ¶
func NewQueryCaptureHandler(filePath string, parser *sqlparser.Parser) (*QueryCaptureHandler, error)
NewQueryCaptureHandler is a constructor of QueryCaptureHandler instance
func (*QueryCaptureHandler) CheckQuery ¶
func (handler *QueryCaptureHandler) CheckQuery(sqlQuery string, parsedQuery sqlparser.Statement) (bool, error)
CheckQuery sends query to internal writer to save
func (*QueryCaptureHandler) DumpQueries ¶
func (handler *QueryCaptureHandler) DumpQueries() error
DumpQueries saves all queries stored in memory of internal writer instance. Expected to be called after marking queries as forbidden
func (*QueryCaptureHandler) Release ¶
func (handler *QueryCaptureHandler) Release()
Release frees all resources
func (*QueryCaptureHandler) Start ¶
func (handler *QueryCaptureHandler) Start()
Start starts logging in background
type QueryIgnoreHandler ¶
type QueryIgnoreHandler struct {
// contains filtered or unexported fields
}
QueryIgnoreHandler allows to ignore any query
func NewQueryIgnoreHandler ¶
func NewQueryIgnoreHandler(parser *sqlparser.Parser) *QueryIgnoreHandler
NewQueryIgnoreHandler creates new ignore handler
func (*QueryIgnoreHandler) AddQueries ¶
func (handler *QueryIgnoreHandler) AddQueries(queries []string)
AddQueries normalizes and adds queries to the list that should be ignored
func (*QueryIgnoreHandler) CheckQuery ¶
func (handler *QueryIgnoreHandler) CheckQuery(rawQuery string, parsedQuery sqlparser.Statement) (bool, error)
CheckQuery checks each query, returns false if query handling should be ignored.
func (*QueryIgnoreHandler) Release ¶
func (handler *QueryIgnoreHandler) Release()
Release resets list of ignored patterns
func (*QueryIgnoreHandler) RemoveQueries ¶
func (handler *QueryIgnoreHandler) RemoveQueries(queries []string)
RemoveQueries removes queries from the list that should be ignored
func (*QueryIgnoreHandler) Reset ¶
func (handler *QueryIgnoreHandler) Reset()
Reset resets list of ignored patterns