Skip to content

Commit 52a2a97

Browse files
committed
fix: name some fields better
1 parent 7327629 commit 52a2a97

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

thorlog/v3/event_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func TestFinding_UnmarshalJSON(t *testing.T) {
134134
}
135135

136136
func TestFinding_UnmarshalIssue(t *testing.T) {
137-
finding := `{"type":"THOR finding","meta":{"time":"2025-07-01T12:05:12.993789131+02:00","level":"Info","module":"ProcessCheck","scan_id":"S-pSxgCmyvvfs","event_id":"","hostname":"dummy"},"message":"process found","subject":{"type":"process","pid":502168,"name":"chromium","command":"/usr/lib/chromium/chromium","owner":"owner","image":{"type":"file","path":"/usr/lib/chromium/chromium","exists":"yes","extension":"","magic_header":"ELF","hashes":{"md5":"fc04ee20f064adc18e370c22512e268e","sha1":"2c8b7d05d25e04db9c169ce85e8e8f84321ef0c8","sha256":"0cf1727aa8dc3995d5aa103001f656b8ee8a1b3ffbc6d8664c5ad95cf225771f"},"first_bytes":{"hex":"7f454c4602010100000000000000000003003e00","ascii":"ELF\u003e"},"file_times":{"modified":"2025-06-25T19:45:43+02:00","accessed":"2025-07-01T08:46:56.750309598+02:00","changed":"2025-06-26T08:39:59.980605063+02:00"},"size":252546120,"permissions":{"type":"Unix permissions","owner":"root","group":"root","permissions":{"user":{"readable":true,"writable":true,"executable":true},"group":{"readable":true,"writable":false,"executable":true},"world":{"readable":true,"writable":false,"executable":true}}}},"parent_info":{"pid":9011,"exe":"/usr/lib/chromium/chromium","command":"/usr/lib/chromium/chromium"},"tree":["/usr/lib/chromium/chromium","/usr/lib/chromium/chromium"],"created":"2025-07-01T12:00:05+02:00","session":"","listen_ports":null,"connections":[]},"score":0,"reasons":null,"reason_count":0,"context":null,"issues":[{"affected":"/subject/sections","category":"truncated","description":"Removed some sections from process memory (originally 638)"}],"log_version":"v3.0.0"}`
137+
finding := `{"type":"THOR finding","meta":{"time":"2025-07-01T12:05:12.993789131+02:00","level":"Info","module":"ProcessCheck","scan_id":"S-pSxgCmyvvfs","event_id":"","hostname":"dummy"},"message":"process found","subject":{"type":"process","pid":502168,"name":"chromium","command":"/usr/lib/chromium/chromium","owner":"owner","image":{"type":"file","path":"/usr/lib/chromium/chromium","exists":"yes","extension":"","magic_header":"ELF","hashes":{"md5":"fc04ee20f064adc18e370c22512e268e","sha1":"2c8b7d05d25e04db9c169ce85e8e8f84321ef0c8","sha256":"0cf1727aa8dc3995d5aa103001f656b8ee8a1b3ffbc6d8664c5ad95cf225771f"},"first_bytes":{"hex":"7f454c4602010100000000000000000003003e00","ascii":"ELF\u003e"},"file_times":{"modified":"2025-06-25T19:45:43+02:00","accessed":"2025-07-01T08:46:56.750309598+02:00","changed":"2025-06-26T08:39:59.980605063+02:00"},"size":252546120,"permissions":{"type":"Unix permissions","owner":"root","group":"root","mask":{"user":{"readable":true,"writable":true,"executable":true},"group":{"readable":true,"writable":false,"executable":true},"world":{"readable":true,"writable":false,"executable":true}}}},"parent_info":{"pid":9011,"exe":"/usr/lib/chromium/chromium","command":"/usr/lib/chromium/chromium"},"tree":["/usr/lib/chromium/chromium","/usr/lib/chromium/chromium"],"created":"2025-07-01T12:00:05+02:00","session":"","listen_ports":null,"connections":[]},"score":0,"reasons":null,"reason_count":0,"context":null,"issues":[{"affected":"/subject/sections","category":"truncated","description":"Removed some sections from process memory (originally 638)"}],"log_version":"v3.0.0"}`
138138
var findingObj Finding
139139
if err := json.Unmarshal([]byte(finding), &findingObj); err != nil {
140140
t.Fatalf("Failed to unmarshal finding: %v", err)

thorlog/v3/permissions.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type UnixPermissions struct {
2828

2929
Owner string `json:"owner" textlog:"owner"` // FIXME: Could explicitly include name / UID
3030
Group string `json:"group" textlog:"group"` // FIXME: Could explicitly include name / GID
31-
Mask PermissionMask `json:"permissions" textlog:"permissions"`
31+
Mask PermissionMask `json:"mask" textlog:"permissions"`
3232
}
3333

3434
func (p UnixPermissions) String() string {
@@ -88,7 +88,7 @@ type WindowsPermissions struct {
8888
LogObjectHeader
8989

9090
Owner string `json:"owner" textlog:"owner"` // FIXME: Could include information like the original SID
91-
Permissions AclEntries `json:"permissions" textlog:"permissions" jsonschema:"nullable"`
91+
Permissions AclEntries `json:"acl" textlog:"permissions" jsonschema:"nullable"`
9292
}
9393

9494
func (p WindowsPermissions) String() string {

thorlog/v3/reason.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ type Signature struct {
4444
// a likely false positive (which results in a score reduction on any related
4545
// finding).
4646
Score int64 `json:"score" textlog:"subscore"`
47-
// Ref contains a reference (usually in form of a link) for further information about
47+
// Ref contains references (usually as links) for further information about
4848
// the threat that is detected by this signature.
49-
Ref StringList `json:"ref" textlog:"ref" jsonschema:"nullable"`
49+
Ref StringList `json:"reference" textlog:"ref" jsonschema:"nullable"`
5050
// Type indicates whether a signature was part of THOR's built in signature set
5151
// or whether it was a custom signature provided by the user.
5252
Type Sigtype `json:"origin" textlog:"sigtype"`

0 commit comments

Comments
 (0)