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

feat(teler): add deprecated Excludes message #180

Merged
Merged
Changes from all commits
Commits
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
16 changes: 13 additions & 3 deletions teler.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ import (
"path/filepath"

"github.com/expr-lang/expr/vm"
"github.com/teler-sh/dsl"
"github.com/kitabisa/teler-waf/request"
"github.com/kitabisa/teler-waf/threat"
"github.com/klauspost/compress/zstd"
"github.com/patrickmn/go-cache"
"github.com/scorpionknifes/go-pcre"
"github.com/teler-sh/dsl"
"github.com/valyala/fastjson"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
Expand Down Expand Up @@ -181,8 +181,7 @@ func New(opts ...Options) *Teler {
_ = t.log.Sync()
}()

// Initialize the excludes field of the Threat struct to a new map and
// set the boolean flag for each threat category specified in the Excludes option to true
// Initialize the excludes field of the Threat struct to a new map
t.threat.excludes = map[threat.Threat]bool{
threat.CommonWebAttack: false,
threat.CVE: false,
Expand All @@ -191,6 +190,17 @@ func New(opts ...Options) *Teler {
threat.BadCrawler: false,
threat.DirectoryBruteforce: false,
}

// Deprecation notice for Excludes options
if len(o.Excludes) > 0 {
deprecatedExcludesMsg := "threat exclusions (Excludes) will be " +
"deprecated in the upcoming release (v2), use Whitelists instead. " +
"See teler-waf#73 & teler-waf#64."
t.log.Warn(deprecatedExcludesMsg)
}

// set the boolean flag for each threat category specified in the Excludes
// option to true
for _, ex := range o.Excludes {
t.threat.excludes[ex] = true
}
Expand Down
Loading