-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MLPAB-2318: Support ATTORNEY_OPT_OUT (#241)
- Loading branch information
Showing
14 changed files
with
515 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ repos: | |
rev: v8.18.4 | ||
hooks: | ||
- id: gitleaks | ||
args: [ "--baseline-path", "./gitleaks-report.json" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"type": "ATTORNEY_OPT_OUT", | ||
"changes": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[ | ||
{ | ||
"Description": "Detected a Generic API Key, potentially exposing access to various services and sensitive operations.", | ||
"StartLine": 71, | ||
"EndLine": 71, | ||
"StartColumn": 77, | ||
"EndColumn": 123, | ||
"Match": "authorUID=9ac5cb7c-fc75-40c7-8e53-059f36dbbe3d ", | ||
"Secret": "9ac5cb7c-fc75-40c7-8e53-059f36dbbe3d", | ||
"File": "Makefile", | ||
"SymlinkFile": "", | ||
"Commit": "4155b1eec33bdadc524a0582b4b858599f624466", | ||
"Entropy": 3.7289722, | ||
"Author": "Alex Saunders", | ||
"Email": "[email protected]", | ||
"Date": "2024-08-08T15:50:22Z", | ||
"Message": "add api test for attorney opt out", | ||
"Tags": [], | ||
"RuleID": "generic-api-key", | ||
"Fingerprint": "4155b1eec33bdadc524a0582b4b858599f624466:Makefile:generic-api-key:71" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,41 @@ | ||
package shared | ||
|
||
import "encoding/json" | ||
import ( | ||
"encoding/json" | ||
"strings" | ||
) | ||
|
||
type Change struct { | ||
Key string `json:"key"` | ||
Old json.RawMessage `json:"old"` | ||
New json.RawMessage `json:"new"` | ||
} | ||
|
||
type URN string | ||
|
||
func (u URN) Details() AuthorDetails { | ||
parts := strings.Split(string(u), ":") | ||
|
||
if len(parts) != 6 || parts[3] == "" || parts[5] == "" { | ||
return AuthorDetails{} | ||
} | ||
|
||
return AuthorDetails{ | ||
UID: parts[5], | ||
Service: parts[3], | ||
} | ||
} | ||
|
||
type Update struct { | ||
Id string `json:"id"` // UUID for the update | ||
Uid string `json:"uid"` // UID of the changed LPA | ||
Applied string `json:"applied"` // RFC3339 datetime | ||
Author string `json:"author"` | ||
Author URN `json:"author"` | ||
Type string `json:"type"` | ||
Changes []Change `json:"changes"` | ||
} | ||
|
||
type AuthorDetails struct { | ||
UID string | ||
Service string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package shared | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestURNDetails(t *testing.T) { | ||
testcases := map[URN]struct { | ||
UID string | ||
Service string | ||
}{ | ||
"urn:opg:poas:makeregister:users:123": { | ||
UID: "123", | ||
Service: "makeregister", | ||
}, | ||
"urn:opg:poas:sirius:users:456": { | ||
UID: "456", | ||
Service: "sirius", | ||
}, | ||
} | ||
|
||
for urn, tc := range testcases { | ||
t.Run(string(urn), func(t *testing.T) { | ||
details := urn.Details() | ||
|
||
assert.Equal(t, tc.UID, details.UID) | ||
assert.Equal(t, tc.Service, details.Service) | ||
}) | ||
} | ||
|
||
} | ||
|
||
func TestURNDetailsWhenURNInvalidFormat(t *testing.T) { | ||
testcases := []URN{ | ||
"urn:opg:poas:makeregister:users:", | ||
"urn-opg-poas-makeregister-users-123", | ||
} | ||
|
||
for _, urn := range testcases { | ||
t.Run(string(urn), func(t *testing.T) { | ||
details := urn.Details() | ||
|
||
assert.Equal(t, AuthorDetails{}, details) | ||
}) | ||
} | ||
} |
Oops, something went wrong.