Skip to content

Commit a490e87

Browse files
committed
[CWS] Improve documentation for setsockopt fields
1 parent c6a252a commit a490e87

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

docs/cloud-workload-security/linux_expressions.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,17 +2190,17 @@ A setsockopt was executed
21902190

21912191
| Property | Definition |
21922192
| -------- | ------------- |
2193-
| [`setsockopt.filter_hash`](#setsockopt-filter_hash-doc) | Hash of the socket filter using sha256 |
2194-
| [`setsockopt.filter_instructions`](#setsockopt-filter_instructions-doc) | Filter instructions |
2195-
| [`setsockopt.filter_len`](#setsockopt-filter_len-doc) | Length of the filter |
2196-
| [`setsockopt.is_filter_truncated`](#setsockopt-is_filter_truncated-doc) | Indicates that the filter is truncated |
2193+
| [`setsockopt.filter_hash`](#setsockopt-filter_hash-doc) | Hash of the currently attached filter using sha256. Only available if the optname is SO_ATTACH_FILTER |
2194+
| [`setsockopt.filter_instructions`](#setsockopt-filter_instructions-doc) | Instructions of the currently attached filter. Only available if the optname is SO_ATTACH_FILTER |
2195+
| [`setsockopt.filter_len`](#setsockopt-filter_len-doc) | Length of the currently attached filter. Only available if the optname is SO_ATTACH_FILTER |
2196+
| [`setsockopt.is_filter_truncated`](#setsockopt-is_filter_truncated-doc) | Indicates that the currently attached filter is truncated. Only available if the optname is SO_ATTACH_FILTER |
21972197
| [`setsockopt.level`](#setsockopt-level-doc) | Socket level |
21982198
| [`setsockopt.optname`](#setsockopt-optname-doc) | Socket option name |
21992199
| [`setsockopt.retval`](#common-syscallevent-retval-doc) | Return value of the syscall |
22002200
| [`setsockopt.socket_family`](#setsockopt-socket_family-doc) | Socket family |
22012201
| [`setsockopt.socket_protocol`](#setsockopt-socket_protocol-doc) | Socket protocol |
22022202
| [`setsockopt.socket_type`](#setsockopt-socket_type-doc) | Socket type |
2203-
| [`setsockopt.used_immediates`](#setsockopt-used_immediates-doc) | List of immediate values used in the filter |
2203+
| [`setsockopt.used_immediates`](#setsockopt-used_immediates-doc) | List of immediate values used in the currently attached filter. Only available if the optname is SO_ATTACH_FILTER |
22042204

22052205
### Event `setuid`
22062206

@@ -4596,28 +4596,28 @@ Definition: Maximum (hard) limit value
45964596
### `setsockopt.filter_hash` {#setsockopt-filter_hash-doc}
45974597
Type: string
45984598

4599-
Definition: Hash of the socket filter using sha256
4599+
Definition: Hash of the currently attached filter using sha256. Only available if the optname is SO_ATTACH_FILTER
46004600

46014601

46024602

46034603
### `setsockopt.filter_instructions` {#setsockopt-filter_instructions-doc}
46044604
Type: string
46054605

4606-
Definition: Filter instructions
4606+
Definition: Instructions of the currently attached filter. Only available if the optname is SO_ATTACH_FILTER
46074607

46084608

46094609

46104610
### `setsockopt.filter_len` {#setsockopt-filter_len-doc}
46114611
Type: int
46124612

4613-
Definition: Length of the filter
4613+
Definition: Length of the currently attached filter. Only available if the optname is SO_ATTACH_FILTER
46144614

46154615

46164616

46174617
### `setsockopt.is_filter_truncated` {#setsockopt-is_filter_truncated-doc}
46184618
Type: bool
46194619

4620-
Definition: Indicates that the filter is truncated
4620+
Definition: Indicates that the currently attached filter is truncated. Only available if the optname is SO_ATTACH_FILTER
46214621

46224622

46234623

@@ -4659,7 +4659,7 @@ Definition: Socket type
46594659
### `setsockopt.used_immediates` {#setsockopt-used_immediates-doc}
46604660
Type: int
46614661

4662-
Definition: List of immediate values used in the filter
4662+
Definition: List of immediate values used in the currently attached filter. Only available if the optname is SO_ATTACH_FILTER
46634663

46644664

46654665

docs/cloud-workload-security/secl_linux.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9197,22 +9197,22 @@
91979197
"properties": [
91989198
{
91999199
"name": "setsockopt.filter_hash",
9200-
"definition": "Hash of the socket filter using sha256",
9200+
"definition": "Hash of the currently attached filter using sha256. Only available if the optname is SO_ATTACH_FILTER",
92019201
"property_doc_link": "setsockopt-filter_hash-doc"
92029202
},
92039203
{
92049204
"name": "setsockopt.filter_instructions",
9205-
"definition": "Filter instructions",
9205+
"definition": "Instructions of the currently attached filter. Only available if the optname is SO_ATTACH_FILTER",
92069206
"property_doc_link": "setsockopt-filter_instructions-doc"
92079207
},
92089208
{
92099209
"name": "setsockopt.filter_len",
9210-
"definition": "Length of the filter",
9210+
"definition": "Length of the currently attached filter. Only available if the optname is SO_ATTACH_FILTER",
92119211
"property_doc_link": "setsockopt-filter_len-doc"
92129212
},
92139213
{
92149214
"name": "setsockopt.is_filter_truncated",
9215-
"definition": "Indicates that the filter is truncated",
9215+
"definition": "Indicates that the currently attached filter is truncated. Only available if the optname is SO_ATTACH_FILTER",
92169216
"property_doc_link": "setsockopt-is_filter_truncated-doc"
92179217
},
92189218
{
@@ -9247,7 +9247,7 @@
92479247
},
92489248
{
92499249
"name": "setsockopt.used_immediates",
9250-
"definition": "List of immediate values used in the filter",
9250+
"definition": "List of immediate values used in the currently attached filter. Only available if the optname is SO_ATTACH_FILTER",
92519251
"property_doc_link": "setsockopt-used_immediates-doc"
92529252
}
92539253
]
@@ -16217,7 +16217,7 @@
1621716217
"name": "setsockopt.filter_hash",
1621816218
"link": "setsockopt-filter_hash-doc",
1621916219
"type": "string",
16220-
"definition": "Hash of the socket filter using sha256",
16220+
"definition": "Hash of the currently attached filter using sha256. Only available if the optname is SO_ATTACH_FILTER",
1622116221
"prefixes": [
1622216222
"setsockopt"
1622316223
],
@@ -16229,7 +16229,7 @@
1622916229
"name": "setsockopt.filter_instructions",
1623016230
"link": "setsockopt-filter_instructions-doc",
1623116231
"type": "string",
16232-
"definition": "Filter instructions",
16232+
"definition": "Instructions of the currently attached filter. Only available if the optname is SO_ATTACH_FILTER",
1623316233
"prefixes": [
1623416234
"setsockopt"
1623516235
],
@@ -16241,7 +16241,7 @@
1624116241
"name": "setsockopt.filter_len",
1624216242
"link": "setsockopt-filter_len-doc",
1624316243
"type": "int",
16244-
"definition": "Length of the filter",
16244+
"definition": "Length of the currently attached filter. Only available if the optname is SO_ATTACH_FILTER",
1624516245
"prefixes": [
1624616246
"setsockopt"
1624716247
],
@@ -16253,7 +16253,7 @@
1625316253
"name": "setsockopt.is_filter_truncated",
1625416254
"link": "setsockopt-is_filter_truncated-doc",
1625516255
"type": "bool",
16256-
"definition": "Indicates that the filter is truncated",
16256+
"definition": "Indicates that the currently attached filter is truncated. Only available if the optname is SO_ATTACH_FILTER",
1625716257
"prefixes": [
1625816258
"setsockopt"
1625916259
],
@@ -16325,7 +16325,7 @@
1632516325
"name": "setsockopt.used_immediates",
1632616326
"link": "setsockopt-used_immediates-doc",
1632716327
"type": "int",
16328-
"definition": "List of immediate values used in the filter",
16328+
"definition": "List of immediate values used in the currently attached filter. Only available if the optname is SO_ATTACH_FILTER",
1632916329
"prefixes": [
1633016330
"setsockopt"
1633116331
],

pkg/security/secl/model/model_unix.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,16 +1023,16 @@ type SetSockOptEvent struct {
10231023
SyscallEvent
10241024
SocketType uint16 `field:"socket_type"` // SECLDoc[socket_type] Definition:`Socket type`
10251025
SocketFamily uint16 `field:"socket_family"` // SECLDoc[socket_family] Definition:`Socket family`
1026-
FilterLen uint16 `field:"filter_len"` // SECLDoc[filter_len] Definition:`Length of the filter`
1026+
FilterLen uint16 `field:"filter_len"` // SECLDoc[filter_len] Definition:`Length of the currently attached filter. Only available if the optname is SO_ATTACH_FILTER`
10271027
SocketProtocol uint16 `field:"socket_protocol"` // SECLDoc[socket_protocol] Definition:`Socket protocol`
10281028
Level uint32 `field:"level"` // SECLDoc[level] Definition:`Socket level`
10291029
OptName uint32 `field:"optname"` // SECLDoc[optname] Definition:`Socket option name`
10301030
SizeToRead uint32 `field:"-"` // Internal field, not exposed to users
1031-
IsFilterTruncated bool `field:"is_filter_truncated"` // SECLDoc[is_filter_truncated] Definition:`Indicates that the filter is truncated`
1031+
IsFilterTruncated bool `field:"is_filter_truncated"` // SECLDoc[is_filter_truncated] Definition:`Indicates that the currently attached filter is truncated. Only available if the optname is SO_ATTACH_FILTER`
10321032
RawFilter []byte `field:"-"` // Internal field, not exposed to users
1033-
FilterInstructions string `field:"filter_instructions,handler:ResolveSetSockOptFilterInstructions"` // SECLDoc[filter_instructions] Definition:`Filter instructions`
1034-
FilterHash string `field:"filter_hash,handler:ResolveSetSockOptFilterHash:"` // SECLDoc[filter_hash] Definition:`Hash of the socket filter using sha256`
1035-
UsedImmediates []int `field:"used_immediates,handler:ResolveSetSockOptUsedImmediates, weight:999"` // SECLDoc[used_immediates] Definition:`List of immediate values used in the filter`
1033+
FilterInstructions string `field:"filter_instructions,handler:ResolveSetSockOptFilterInstructions"` // SECLDoc[filter_instructions] Definition:`Instructions of the currently attached filter. Only available if the optname is SO_ATTACH_FILTER`
1034+
FilterHash string `field:"filter_hash,handler:ResolveSetSockOptFilterHash:"` // SECLDoc[filter_hash] Definition:`Hash of the currently attached filter using sha256. Only available if the optname is SO_ATTACH_FILTER`
1035+
UsedImmediates []int `field:"used_immediates,handler:ResolveSetSockOptUsedImmediates, weight:999"` // SECLDoc[used_immediates] Definition:`List of immediate values used in the currently attached filter. Only available if the optname is SO_ATTACH_FILTER`
10361036
}
10371037

10381038
// CapabilitiesEvent is used to report capabilities usage

0 commit comments

Comments
 (0)