Skip to content

Commit

Permalink
Merge pull request #39 from signalsciences/extend_ct
Browse files Browse the repository at this point in the history
Added new config option for more granular inspection
  • Loading branch information
amacnair authored Jul 6, 2023
2 parents d5a7ec3 + 4bb1360 commit 372a7ab
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.12.1
1.13.0
10 changes: 10 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type ModuleConfig struct {
anomalyDuration time.Duration
anomalySize int64
expectedContentTypes []string
extendContentTypes bool
debug bool
rawHeaderExtractor RawHeaderExtractorFunc
inspector Inspector
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package sigsci

const version = "1.12.1"
const version = "1.13.0"

0 comments on commit 372a7ab

Please sign in to comment.