Skip to content

Commit 24655a1

Browse files
committed
Docker relabels both the file and its parent directory
1 parent 7d3a9b3 commit 24655a1

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

tests/conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ def test_container(
222222
@pytest.fixture
223223
def docker_selinux_xattr(
224224
docker_client: docker.DockerClient,
225+
monitored_dir: str,
225226
test_file: str,
226227
) -> list[Event]:
227228
"""
@@ -231,6 +232,8 @@ def docker_selinux_xattr(
231232
relabels files with security.selinux. This fixture returns the
232233
expected events if Docker has SELinux enabled, or an empty list
233234
otherwise.
235+
236+
Docker relabels both the file and its parent directory.
234237
"""
235238
info = docker_client.info()
236239
selinux = any('selinux' in opt for opt in info.get('SecurityOptions', []))
@@ -247,6 +250,13 @@ def docker_selinux_xattr(
247250
host_path=test_file,
248251
xattr_name='security.selinux',
249252
),
253+
Event(
254+
process=dockerd,
255+
event_type=EventType.XATTR_SET,
256+
file='',
257+
host_path=monitored_dir,
258+
xattr_name='security.selinux',
259+
),
250260
]
251261

252262

0 commit comments

Comments
 (0)