Skip to content

Commit 37b3c20

Browse files
authored
Merge branch 'master' into changelog-merge
2 parents 54dfbdf + 7a22c7f commit 37b3c20

File tree

54 files changed

+383
-424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+383
-424
lines changed

CHANGELOG.md

100755100644
Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,51 @@
1+
12
## v0.33.9
23
- Upgrade Ubuntu version to 20.04 to be current.
4+
=======
5+
## next
6+
7+
- Add new secondary index 'PrincipalIdLastModifiedOn' for Lease table with range key as LastModifiedOn to get the records sort by last-modified
8+
- Update pkg/data/leases.go queryLeases method to use new IndexName PrincipalIdLastModifiedOn instead of existing IndexName PrincipalId in to get leases in order
9+
10+
## v0.33.9
11+
12+
- Upgrade to Go version 1.17
13+
- Upgrade Ubuntu version on Azure DevOps Agent
14+
- Fix Go dependency errors in pipeline
15+
- Require at least `0.12.31` or later `0.12.x` versions of Terraform to recieve new provider updates
16+
317

418
## v0.33.8
19+
520
- Upgrade the Swagger UI dependency to remove a very dangerous vulnerability (upgrade Swagger UI to v3.51.2).
621

722
## v0.33.7
23+
824
- Update requirements packages for docs.
925
- Update gotool version for pipeline.
1026

1127
## v0.33.6
28+
1229
- Add LakeFormation to the principal IAM policy.
1330
- Update mocks
1431
- updates requirements packages for docs
1532

1633
## v0.33.5
34+
1735
- rename pipeline credentials inputs
1836

1937
## v0.33.4
38+
2039
- Upgrade aws provider to v2.65.0 to fix SES configuration set. [terraform-provider-aws #12024](https://github.com/hashicorp/terraform-provider-aws/pull/12024)
2140
- Add firewall manager to principal IAM policy.
2241

2342
## v0.33.3
43+
2444
- Remove apigatewayv2 from the principal IAM policy.
2545
- Update to the principal IAM policy name lex-models.
2646

2747
## v0.33.2
48+
2849
- Add to the principal IAM policy:
2950
- apigatewayv2
3051
- comprehend
@@ -35,28 +56,34 @@
3556
- wafv2
3657

3758
## v0.33.1
59+
3860
- Fix populate reset queue when dynamodb returns paginated result
3961
- Add account status to last evaluated key when querying account table using global secondary index
4062
- Fix gosec issue related to G601 (CWE-118): Implicit memory aliasing in for loop
4163

4264
## v0.33.0
65+
4366
- Upgrade aws-nuke to v1.3.0
4467

4568
## v0.32.0
69+
4670
- Upgrade go to 1.15
4771
- Upgrade go mod dependencies version.
4872
- Improved test scenarios.
4973
- Add `iotanalytics:*` policy to the set of allowed services.
5074
- Increase timeout for functional test execution.
5175

5276
## v0.31.3
77+
5378
- Fix data and update visualization for codebuild reset widget and error scrappers.
5479

5580
## v0.31.2
56-
- Fix bug: Status change in account table fails for leased accounts that are expired. See https://github.com/Optum/dce/issues/344
81+
82+
- Fix bug: Status change in account table fails for leased accounts that are expired. See <https://github.com/Optum/dce/issues/344>
5783
- Fix bug: When lease starts today, fixed usage start and end date that was printed in log message.
5884

5985
## v0.30.1
86+
6087
- Added new tool in `tools` folder for generating Markdown and IAM example policy for AWS Nuke
6188
support. See README in `tools/awsnukedocgen`.
6289
- Added new services supported by DCE: Kinesis Analytics, Kinesis Video, Opsworks CM, Robomaker,
@@ -185,7 +212,6 @@ This release also removes the deprecated DynamoDB tables with "Redbox" prefixes.
185212
- RedboxLeaseProd --> Leases
186213
- UsageCache --> Usage
187214

188-
189215
**Migration Notes**
190216

191217
_DynamoDB Migration_
@@ -198,7 +224,6 @@ To do this, you may run the migration script in [/scripts/migrations/v0.21.0_ren
198224

199225
Note that this release does ***not*** delete the old tables, to provide the opportunity to migrate data. Subsequent releases _will_ destroy the old tables.
200226

201-
202227
## v0.20.0
203228

204229
- Fixed a bug in a migration script
@@ -213,12 +238,10 @@ Note that this release does ***not*** delete the old tables, to provide the oppo
213238
- Fixed issue with the lease check logic that was expiring non-expired leases.
214239
- Migration script to fix wrongly expired leases
215240

216-
217241
## v0.19.1
218242

219243
- Fixed issue with lease status reason not being set when the lease was newly created.
220244

221-
222245
## v0.19.0
223246

224247
**BREAKING CHANGES**
@@ -235,7 +258,6 @@ _Other Changes_
235258
- Refactored lease API controller and methods to organize methods into files.
236259
- Add functions to evaluate who is calling an API and what their role is
237260

238-
239261
### Migration Notes for v0.19.0
240262

241263
In order to upgrade your DCE deployment to v0.19.0, you will need to:
@@ -247,7 +269,6 @@ In order to upgrade your DCE deployment to v0.19.0, you will need to:
247269
- Marks all `*Locked` leases as `Inactive`
248270
- Update any DCE API clients to include the `expiresOn` property in their `Lease` record.
249271

250-
251272
### _Expiring Leases Model_
252273

253274
Prior to v0.19.0, leases were held in perpetuity by principals, or until the principal removed their lease via the `DELETE /leases` endpoint. Leased accounts would be "reset" at the end of the week. During reset, the lease would be marked as _Locked_, and then marked as _Active_ again after the reset was complete.
@@ -259,8 +280,8 @@ Changes for this new behavior include:
259280
- Simplified lease status model to include only two statuses: Inactive and Active.
260281
- Changed check_budget to update_lease_status and added check for expiration date.
261282
- Changed SQS and SNS notifications for lease status change to be triggered by lease status change in DB.
262-
- Added https://readthedocs.org/ style documentation, `make documentation` target
263-
- Added generation for API documentation from Swagger YAML to https://readthedocs.org/ format.
283+
- Added <https://readthedocs.org/> style documentation, `make documentation` target
284+
- Added generation for API documentation from Swagger YAML to <https://readthedocs.org/> format.
264285
- Added defaults for leases; if ID isn't specified upon save in the DB a new one will be assigned, and if
265286
the expiration date isn't defined the environment variable `DEFAULT_LEASE_LENGTH_IN_DAYS` will be used and
266287
if that is not defined, a default of seven (7) days will be used.
@@ -326,7 +347,6 @@ This release also disables `aws-nuke` by default, to prevent accidental destruct
326347
- Added publish_locks lambda
327348
- Adds a metadata property to the account object
328349

329-
330350
## v0.12.2
331351

332352
- Tag issue, updating to 0.12.2
@@ -355,7 +375,6 @@ This release also disables `aws-nuke` by default, to prevent accidental destruct
355375

356376
- **BREAKING** Add **required** budget fields to API `/leases` endpoint
357377

358-
359378
- Add local functional testing deployment method via Makefile
360379
- Target "make deploy_local" utilizes scripts/deploy_local terraform to build S3 backend
361380
- Target "make destroy_local" utilizes scripts/deploy_local terraform and modules/ terraform to destroy environment

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ vendor:
1313
go mod vendor
1414

1515
mod:
16-
-go mod init github.com/Optum/dce
16+
go mod tidy -v
1717

1818
vet:
1919
go vet

cmd/codebuild/reset/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package main
55
import (
66
"fmt"
77
"io"
8-
"io/ioutil"
98
"log"
109
"os"
1110
"text/template"
@@ -120,7 +119,7 @@ func nukeAccount(svc *service, isDryRun bool) error {
120119
/*
121120
#nosec CWE-22: This value is derived from env vars. I.e. it is not populated with data from external users.
122121
*/
123-
conf, err := ioutil.ReadFile(configFile)
122+
conf, err := os.ReadFile(configFile)
124123
if err != nil {
125124
return err
126125
}

cmd/lambda/accounts/create_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import (
1616

1717
func TestWhenCreate(t *testing.T) {
1818
standardMultiValueHeaders := map[string][]string{
19-
"Access-Control-Allow-Origin": []string{"*"},
20-
"Content-Type": []string{"application/json"},
19+
"Access-Control-Allow-Origin": {"*"},
20+
"Content-Type": {"application/json"},
2121
}
2222
standardHeaders := map[string]string{
2323
"Access-Control-Allow-Origin": "*",

cmd/lambda/accounts/delete_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import (
1616

1717
func TestWhenDelete(t *testing.T) {
1818
standardMultiValueHeaders := map[string][]string{
19-
"Access-Control-Allow-Origin": []string{"*"},
20-
"Content-Type": []string{"application/json"},
19+
"Access-Control-Allow-Origin": {"*"},
20+
"Content-Type": {"application/json"},
2121
}
2222
standardHeaders := map[string]string{
2323
"Access-Control-Allow-Origin": "*",

cmd/lambda/accounts/get_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
"fmt"
5-
"io/ioutil"
5+
"io"
66
"net/http/httptest"
77
"testing"
88

@@ -75,7 +75,7 @@ func TestGetAccountByID(t *testing.T) {
7575
GetAccountByID(w, r)
7676

7777
resp := w.Result()
78-
body, err := ioutil.ReadAll(resp.Body)
78+
body, err := io.ReadAll(resp.Body)
7979

8080
assert.Nil(t, err)
8181
assert.Equal(t, tt.expResp.StatusCode, resp.StatusCode)

cmd/lambda/accounts/list_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
"fmt"
5-
"io/ioutil"
5+
"io"
66
"net/http/httptest"
77
"net/url"
88
"testing"
@@ -118,7 +118,7 @@ func TestGetAccounts(t *testing.T) {
118118
GetAccounts(w, r)
119119

120120
resp := w.Result()
121-
body, err := ioutil.ReadAll(resp.Body)
121+
body, err := io.ReadAll(resp.Body)
122122

123123
assert.Nil(t, err)
124124
assert.Equal(t, tt.expResp.StatusCode, resp.StatusCode)

cmd/lambda/accounts/main.go

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@ package main
33
import (
44
"context"
55
"fmt"
6-
"log"
7-
"net/url"
8-
9-
"github.com/aws/aws-sdk-go/service/iam"
10-
116
"github.com/Optum/dce/pkg/api"
7+
"github.com/Optum/dce/pkg/config"
128
"github.com/aws/aws-lambda-go/events"
139
"github.com/aws/aws-lambda-go/lambda"
14-
15-
"github.com/Optum/dce/pkg/config"
10+
"github.com/aws/aws-sdk-go/service/iam"
1611
"github.com/awslabs/aws-lambda-go-api-proxy/gorillamux"
12+
"log"
13+
"net/url"
1714
)
1815

1916
type accountControllerConfiguration struct {
@@ -53,39 +50,39 @@ func init() {
5350
// Routes with query strings always go first,
5451
// because the matcher will stop on the first match
5552
api.Route{
56-
"GetAccounts",
57-
"GET",
58-
"/accounts",
59-
api.EmptyQueryString,
60-
GetAccounts,
53+
Name: "GetAccounts",
54+
Method: "GET",
55+
Pattern: "/accounts",
56+
Queries: api.EmptyQueryString,
57+
HandlerFunc: GetAccounts,
6158
},
6259
api.Route{
63-
"GetAccountByID",
64-
"GET",
65-
"/accounts/{accountId}",
66-
api.EmptyQueryString,
67-
GetAccountByID,
60+
Name: "GetAccountByID",
61+
Method: "GET",
62+
Pattern: "/accounts/{accountId}",
63+
Queries: api.EmptyQueryString,
64+
HandlerFunc: GetAccountByID,
6865
},
6966
api.Route{
70-
"UpdateAccountByID",
71-
"PUT",
72-
"/accounts/{accountId}",
73-
api.EmptyQueryString,
74-
UpdateAccountByID,
67+
Name: "UpdateAccountByID",
68+
Method: "PUT",
69+
Pattern: "/accounts/{accountId}",
70+
Queries: api.EmptyQueryString,
71+
HandlerFunc: UpdateAccountByID,
7572
},
7673
api.Route{
77-
"DeleteAccount",
78-
"DELETE",
79-
"/accounts/{accountId}",
80-
api.EmptyQueryString,
81-
DeleteAccount,
74+
Name: "DeleteAccount",
75+
Method: "DELETE",
76+
Pattern: "/accounts/{accountId}",
77+
Queries: api.EmptyQueryString,
78+
HandlerFunc: DeleteAccount,
8279
},
8380
api.Route{
84-
"CreateAccount",
85-
"POST",
86-
"/accounts",
87-
api.EmptyQueryString,
88-
CreateAccount,
81+
Name: "CreateAccount",
82+
Method: "POST",
83+
Pattern: "/accounts",
84+
Queries: api.EmptyQueryString,
85+
HandlerFunc: CreateAccount,
8986
},
9087
}
9188
r := api.NewRouter(accountRoutes)

cmd/lambda/accounts/update_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
"fmt"
5-
"io/ioutil"
5+
"io"
66
"net/http/httptest"
77
"strings"
88
"testing"
@@ -148,7 +148,7 @@ func TestUpdateAccountByID(t *testing.T) {
148148
UpdateAccountByID(w, r)
149149

150150
resp := w.Result()
151-
body, err := ioutil.ReadAll(resp.Body)
151+
body, err := io.ReadAll(resp.Body)
152152

153153
assert.Nil(t, err)
154154
assert.Equal(t, tt.expResp.StatusCode, resp.StatusCode)

cmd/lambda/credentials_web_page/get_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
"context"
5-
"io/ioutil"
5+
"io"
66
"log"
77
"net/http"
88
"os"
@@ -93,7 +93,6 @@ func readFile(path string) string {
9393
log.Fatal(err)
9494
}
9595
defer file.Close()
96-
97-
b, _ := ioutil.ReadAll(file)
96+
b, _ := io.ReadAll(file)
9897
return string(b)
9998
}

cmd/lambda/lease_auth/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7-
"io/ioutil"
7+
"io"
88
"log"
99
"net/http"
1010
"net/url"
@@ -169,7 +169,7 @@ func (controller CreateController) getSigninToken(creds sts.Credentials) (string
169169
log.Printf("Error getting signing token: %s", err)
170170
return "", err
171171
}
172-
bodySigninToken, err := ioutil.ReadAll(resSigninToken.Body)
172+
bodySigninToken, err := io.ReadAll(resSigninToken.Body)
173173
if err != nil {
174174
log.Printf("Error getting signing token: %s", err)
175175
return "", err

0 commit comments

Comments
 (0)