Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add patterns functionality to whitelist #231

Merged
merged 19 commits into from
Aug 6, 2018
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions acra-censor/acra-censor_configuration_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import (
"strings"
)

//Query handlers' names.
// Query handlers' names.
const (
BlacklistConfigStr = "blacklist"
WhitelistConfigStr = "whitelist"
QueryCaptureConfigStr = "query_capture"
QueryIgnoreConfigStr = "query_ignore"
)

//Config shows handlers configuration: queries, tables, patterns
// Config shows handlers configuration: queries, tables, patterns
type Config struct {
Handlers []struct {
Handler string
Expand All @@ -26,7 +26,7 @@ type Config struct {
IgnoreParseError bool `yaml:"ignore_parse_error"`
}

//LoadConfiguration loads configuration of AcraCensor
// LoadConfiguration loads configuration of AcraCensor
func (acraCensor *AcraCensor) LoadConfiguration(configuration []byte) error {
var censorConfiguration Config
err := yaml.Unmarshal(configuration, &censorConfiguration)
Expand Down
2 changes: 2 additions & 0 deletions acra-censor/acra-censor_implementation.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ func (acraCensor *AcraCensor) HandleQuery(query string) error {
acraCensor.logger.Errorf("Forbidden query: '%s'", queryWithHiddenValues)
return err
}
//we don't have errors so allow query
if !continueHandling {
acraCensor.logger.Infof("Allowed query: '%s'", queryWithHiddenValues)
return nil
}
}
Expand Down
4 changes: 2 additions & 2 deletions acra-censor/acra-censor_interfaces.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package acracensor

//QueryHandlerInterface describes what actions are available for queries.
// QueryHandlerInterface describes what actions are available for queries.
type QueryHandlerInterface interface {
CheckQuery(sqlQuery string) (bool, error) //1st return arg specifies whether continue verification or not, 2nd specifies whether query is forbidden
Release()
}

//Interface describes main AcraCensor methods: adding and removing query handlers and processing query
// Interface describes main AcraCensor methods: adding and removing query handlers and processing query
type Interface interface {
HandleQuery(sqlQuery string) error
AddHandler(handler QueryHandlerInterface)
Expand Down
Loading