Skip to content

Commit

Permalink
Merge pull request #163 from akamai/release/v2.15.0
Browse files Browse the repository at this point in the history
Release/v2.15.0
  • Loading branch information
mgwoj authored Aug 22, 2022
2 parents 4fb2703 + 522c2b5 commit fb79ddd
Show file tree
Hide file tree
Showing 10 changed files with 777 additions and 91 deletions.
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
# EDGEGRID GOLANG RELEASE NOTES

## 2.15.0 (August 22, 2022)

#### FEATURES/ENHANCEMENTS:

* APPSEC
* Add xff field to custom rule conditions
* Add NotificationEmails to Activation struct

* GTM
* Improved error messages

* CPS
* Add cps ListEnrollments
* Extend CreateEnrollment with AllowDuplicateCN option

## 2.14.1 (July 26, 2022)

### BUG FIXES:
#### BUG FIXES:

* IAM
* Change IAM GroupID type to int64

## 2.14.0 (June 28, 2022)

#### FEATURES/ENHANCEMENTS:

* APPSEC
* Added penalty box support for security policy in evaluation mode

Expand Down
15 changes: 8 additions & 7 deletions pkg/appsec/activations.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ type (

// Activation represents the status of a configuration activation.
Activation struct {
ActivationID int `json:"activationId"`
Version int `json:"version"`
Status string `json:"status"`
Network string `json:"Network"`
ActivatedBy string `json:"activatedBy"`
ActivationDate time.Time `json:"activationDate"`
Notes string `json:"notes"`
ActivationID int `json:"activationId"`
Version int `json:"version"`
Status string `json:"status"`
Network string `json:"Network"`
ActivatedBy string `json:"activatedBy"`
ActivationDate time.Time `json:"activationDate"`
Notes string `json:"notes"`
NotificationEmails []string `json:"notificationEmails"`
}

// CreateActivationsRequest is used to request activation or deactivation of a configuration.
Expand Down
50 changes: 26 additions & 24 deletions pkg/appsec/custom_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,19 @@ type (
Structured bool `json:"-"`
Tag []string `json:"tag"`
Conditions []struct {
Name *json.RawMessage `json:"name,omitempty"`
NameCase *json.RawMessage `json:"nameCase,omitempty"`
NameWildcard *json.RawMessage `json:"nameWildcard,omitempty"`
PositiveMatch bool `json:"positiveMatch"`
Type string `json:"type"`
Value *json.RawMessage `json:"value,omitempty"`
ValueCase *json.RawMessage `json:"valueCase,omitempty"`
ValueExactMatch *json.RawMessage `json:"valueExactMatch,omitempty"`
ValueIgnoreSegment *json.RawMessage `json:"valueIgnoreSegment,omitempty"`
ValueNormalize *json.RawMessage `json:"valueNormalize,omitempty"`
ValueRecursive *json.RawMessage `json:"valueRecursive,omitempty"`
ValueWildcard *json.RawMessage `json:"valueWildcard,omitempty"`
Name *json.RawMessage `json:"name,omitempty"`
NameCase *bool `json:"nameCase,omitempty"`
NameWildcard *bool `json:"nameWildcard,omitempty"`
PositiveMatch bool `json:"positiveMatch"`
Type string `json:"type"`
Value *json.RawMessage `json:"value,omitempty"`
ValueCase *bool `json:"valueCase,omitempty"`
ValueExactMatch *bool `json:"valueExactMatch,omitempty"`
ValueIgnoreSegment *bool `json:"valueIgnoreSegment,omitempty"`
ValueNormalize *bool `json:"valueNormalize,omitempty"`
ValueRecursive *bool `json:"valueRecursive,omitempty"`
ValueWildcard *bool `json:"valueWildcard,omitempty"`
UseXForwardForHeaders *bool `json:"useXForwardForHeaders,omitempty"`
} `json:"conditions"`
EffectiveTimePeriod *CustomRuleEffectivePeriod `json:"effectiveTimePeriod,omitempty"`
SamplingRate int `json:"samplingRate,omitempty"`
Expand Down Expand Up @@ -120,18 +121,19 @@ type (
Structured bool `json:"-"`
Tag []string `json:"tag"`
Conditions []struct {
Name *json.RawMessage `json:"name,omitempty"`
NameCase *json.RawMessage `json:"nameCase,omitempty"`
NameWildcard *json.RawMessage `json:"nameWildcard,omitempty"`
PositiveMatch bool `json:"positiveMatch"`
Type string `json:"type"`
Value *json.RawMessage `json:"value,omitempty"`
ValueCase *json.RawMessage `json:"valueCase,omitempty"`
ValueExactMatch *json.RawMessage `json:"valueExactMatch,omitempty"`
ValueIgnoreSegment *json.RawMessage `json:"valueIgnoreSegment,omitempty"`
ValueNormalize *json.RawMessage `json:"valueNormalize,omitempty"`
ValueRecursive *json.RawMessage `json:"valueRecursive,omitempty"`
ValueWildcard *json.RawMessage `json:"valueWildcard,omitempty"`
Name *json.RawMessage `json:"name,omitempty"`
NameCase *bool `json:"nameCase,omitempty"`
NameWildcard *bool `json:"nameWildcard,omitempty"`
PositiveMatch bool `json:"positiveMatch"`
Type string `json:"type"`
Value *json.RawMessage `json:"value,omitempty"`
ValueCase *bool `json:"valueCase,omitempty"`
ValueExactMatch *bool `json:"valueExactMatch,omitempty"`
ValueIgnoreSegment *bool `json:"valueIgnoreSegment,omitempty"`
ValueNormalize *bool `json:"valueNormalize,omitempty"`
ValueRecursive *bool `json:"valueRecursive,omitempty"`
ValueWildcard *bool `json:"valueWildcard,omitempty"`
UseXForwardForHeaders *bool `json:"useXForwardForHeaders,omitempty"`
} `json:"conditions"`
EffectiveTimePeriod *CustomRuleEffectivePeriod `json:"effectiveTimePeriod,omitempty"`
SamplingRate int `json:"samplingRate,omitempty"`
Expand Down
10 changes: 5 additions & 5 deletions pkg/appsec/custom_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestAppSec_GetCustomRule(t *testing.T) {

result := GetCustomRuleResponse{}

respData := compactJSON(loadFixtureBytes("testdata/TestCustomRules/CustomRules.json"))
respData := compactJSON(loadFixtureBytes("testdata/TestCustomRules/CustomRule.json"))
json.Unmarshal([]byte(respData), &result)

tests := map[string]struct {
Expand Down Expand Up @@ -164,12 +164,12 @@ func TestAppSec_CreateCustomRule(t *testing.T) {

result := CreateCustomRuleResponse{}

respData := compactJSON(loadFixtureBytes("testdata/TestCustomRules/CustomRules.json"))
respData := compactJSON(loadFixtureBytes("testdata/TestCustomRules/CustomRule.json"))
json.Unmarshal([]byte(respData), &result)

req := CreateCustomRuleRequest{}

reqData := compactJSON(loadFixtureBytes("testdata/TestCustomRules/CustomRules.json"))
reqData := compactJSON(loadFixtureBytes("testdata/TestCustomRules/CustomRule.json"))
json.Unmarshal([]byte(reqData), &req)

tests := map[string]struct {
Expand Down Expand Up @@ -244,12 +244,12 @@ func TestAppSec_CreateCustomRule(t *testing.T) {
func TestAppSec_UpdateCustomRule(t *testing.T) {
result := UpdateCustomRuleResponse{}

respData := compactJSON(loadFixtureBytes("testdata/TestCustomRules/CustomRules.json"))
respData := compactJSON(loadFixtureBytes("testdata/TestCustomRules/CustomRule.json"))
json.Unmarshal([]byte(respData), &result)

req := UpdateCustomRuleRequest{}

reqData := compactJSON(loadFixtureBytes("testdata/TestCustomRules/CustomRules.json"))
reqData := compactJSON(loadFixtureBytes("testdata/TestCustomRules/CustomRule.json"))
json.Unmarshal([]byte(reqData), &req)

tests := map[string]struct {
Expand Down
25 changes: 13 additions & 12 deletions pkg/appsec/export_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,19 @@ type (
Structured bool `json:"-"`
Tag []string `json:"tag"`
Conditions []struct {
Name *json.RawMessage `json:"name,omitempty"`
NameCase *json.RawMessage `json:"nameCase,omitempty"`
NameWildcard *json.RawMessage `json:"nameWildcard,omitempty"`
PositiveMatch bool `json:"positiveMatch"`
Type string `json:"type"`
Value *json.RawMessage `json:"value,omitempty"`
ValueCase *json.RawMessage `json:"valueCase,omitempty"`
ValueExactMatch *json.RawMessage `json:"valueExactMatch,omitempty"`
ValueIgnoreSegment *json.RawMessage `json:"valueIgnoreSegment,omitempty"`
ValueNormalize *json.RawMessage `json:"valueNormalize,omitempty"`
ValueRecursive *json.RawMessage `json:"valueRecursive,omitempty"`
ValueWildcard *json.RawMessage `json:"valueWildcard,omitempty"`
Name *json.RawMessage `json:"name,omitempty"`
NameCase *bool `json:"nameCase,omitempty"`
NameWildcard *bool `json:"nameWildcard,omitempty"`
PositiveMatch bool `json:"positiveMatch"`
Type string `json:"type"`
Value *json.RawMessage `json:"value,omitempty"`
ValueCase *bool `json:"valueCase,omitempty"`
ValueExactMatch *bool `json:"valueExactMatch,omitempty"`
ValueIgnoreSegment *bool `json:"valueIgnoreSegment,omitempty"`
ValueNormalize *bool `json:"valueNormalize,omitempty"`
ValueRecursive *bool `json:"valueRecursive,omitempty"`
ValueWildcard *bool `json:"valueWildcard,omitempty"`
UseXForwardForHeaders *bool `json:"useXForwardForHeaders,omitempty"`
} `json:"conditions"`
EffectiveTimePeriod *CustomRuleEffectivePeriod `json:"effectiveTimePeriod,omitempty"`
SamplingRate int `json:"samplingRate,omitempty"`
Expand Down
60 changes: 60 additions & 0 deletions pkg/appsec/testdata/TestCustomRules/CustomRule.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"conditions": [
{
"type": "hostMatch",
"positiveMatch": true,
"value": [
"www.g.com",
"www.f"
]
},
{
"type": "argsPostMatch",
"name": "asdfas",
"positiveMatch": true,
"value": [
"asfsdfsa"
]
},
{
"type": "argsPostNamesMatch",
"positiveMatch": true,
"value": [
"sfosadfasdf"
]
},
{
"type": "asNumberMatch",
"positiveMatch": false,
"value": [
"2145697538"
],
"useXForwardForHeaders": true
},
{
"type": "geoMatch",
"positiveMatch": false,
"value": [
"Argentina"
],
"useXForwardForHeaders": true
},
{
"type": "ipAddressMatch",
"positiveMatch": false,
"value": [
"81.477.377.57"
],
"useXForwardForHeaders": true
}
],
"id": 60022381,
"name": "ak CR",
"operation": "AND",
"ruleActivated": false,
"structured": true,
"tag": [
"tag"
],
"version": 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -3322,6 +3322,14 @@
"customRules": [
{
"conditions": [
{
"positiveMatch": true,
"type": "geoMatch",
"value": [
"AD"
],
"useXForwardForHeaders": false
},
{
"type": "requestMethodMatch",
"positiveMatch": true,
Expand Down
6 changes: 5 additions & 1 deletion pkg/configgtm/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ func (p *gtm) Error(r *http.Response) error {
}

func (e *Error) Error() string {
return fmt.Sprintf("Title: %s; Type: %s; Detail: %s", e.Title, e.Type, e.Detail)
msg, err := json.MarshalIndent(e, "", "\t")
if err != nil {
return fmt.Sprintf("error marshaling API error: %s", err)
}
return fmt.Sprintf("API error: \n%s", msg)
}

// Is handles error comparisons
Expand Down
Loading

0 comments on commit fb79ddd

Please sign in to comment.