diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f7158e..de58475 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Golang Module Release Notes +## 1.13.0 2023-07-06 + +* Added new module configuration option for more granular inspection + ## 1.12.1 2023-02-24 * Sync versions diff --git a/LICENSE.md b/LICENSE.md index b7df6dc..a01ce7d 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -2,7 +2,7 @@ The MIT License (MIT) -Copyright (c) 2019-2022 Signal Sciences Corp. +Copyright (c) 2019-2023 Signal Sciences Corp. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/VERSION b/VERSION index f8f4f03..feaae22 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.12.1 +1.13.0 diff --git a/config.go b/config.go index 2cf82d4..b0edde1 100644 --- a/config.go +++ b/config.go @@ -47,6 +47,7 @@ type ModuleConfig struct { anomalyDuration time.Duration anomalySize int64 expectedContentTypes []string + extendContentTypes bool debug bool rawHeaderExtractor RawHeaderExtractorFunc inspector Inspector @@ -278,6 +279,15 @@ func ExpectedContentType(s string) ModuleConfigOption { } } +// ExtendContentTypes is a function argument to indicate that send request body +// of any content-type to the agent for inspection +func ExtendContentTypes(v bool) ModuleConfigOption { + return func(c *ModuleConfig) error { + c.extendContentTypes = v + return nil + } +} + // CustomInspector is a function argument that sets a custom inspector, // an optional inspector initializer to decide if inspection should occur, and // an optional inspector finalizer that can perform any post-inspection steps diff --git a/module.go b/module.go index e8b4457..ac214c6 100644 --- a/module.go +++ b/module.go @@ -375,6 +375,10 @@ func shouldReadBody(req *http.Request, m *Module) bool { } } + if m.config.extendContentTypes { + return true + } + // only read certain types of content if inspectableContentType(req.Header.Get("Content-Type")) { return true diff --git a/version.go b/version.go index caf6963..bc6f60f 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package sigsci -const version = "1.12.1" +const version = "1.13.0"