Repository navigation
MLE-34739 Set .gdbinit to mode 0740 and reuse built images only when IDs match - #504
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A critical race in Jenkinsfile can record another build’s image IDs after archiving, causing tests or publishing to use the wrong images; capture IDs from the archive or use build-unique tags.
1 open issue
What changed in this PR
This PR hardens rootless MarkLogic images and updates Jenkins to check recorded image IDs before reusing locally tagged images.
Changes:
- Set
.gdbinitpermissions to0740to address the OpenSCAP finding. - Add rootless-only structure tests for
.gdbinitpermissions and ownership. - Record server and platform image IDs and centralize Jenkins image reuse and archive loading.
| File | Description |
|---|---|
test/structure-test-rootless.yaml |
Adds .gdbinit mode, UID, and GID checks. |
Makefile |
Includes the additional checks only for rootless image types. |
Jenkinsfile |
Records built image IDs and checks them before reusing local images. |
dockerFiles/marklogic-server-ubi-rootless:base |
Changes .gdbinit permissions from 0644 to 0740. |
.github/copilot-instructions.md |
Documents home-file permissions and rootless test configuration. |
Review effort: Balanced
…IDs match The rootless Dockerfile ran chmod 644 on /home/marklogic_user/.gdbinit after the CIS hardening step. That left the others-read bit, which the CIS rule file_permission_user_init_files (0740 or less permissive, CCE-83637-9) rejects. Set the file to 0740 to match other home-directory files such as .bashrc. Add test/structure-test-rootless.yaml, which make structure-test loads only for rootless image types, to assert the mode, uid, and gid of .gdbinit. Root images do not ship this file, so the check stays out of the shared config. Build-Image records the server and platform image IDs in built-image-ids.txt and stashes it separately from the archive. The IDs are read before and after the archive is written, and the build fails if a tag moved in between, so the recorded IDs always describe the archived images. SCAP-Scan, Load-Image (ARM), Structure-Tests, Docker-Run-Tests, and Publish-Image call ensureBuiltImagesLoaded(), which reuses a local tag only when its image ID matches the recorded one. Otherwise it unstashes and loads the archive, which replaces the stale tag. Previously these stages loaded the archive only when no image existed under the same tag, so an image left by an earlier build could be tested or published instead. This showed up in build #2 of this branch, where Structure-Tests ran on cld-docker5 and tested a develop image. Each cld-docker agent has one executor, so the stale image came from an earlier sequential build, not a concurrent one.
vitalykorolev
force-pushed
the
MLE-34739_gdbinit-structure-test
branch
from
November 22, 2026 03:39
16cf9e4 to
8337731
Compare
vitalykorolev
requested review from
barkhachoithani,
pengzhouml,
rwinieski and
sumanthravipati
November 22, 2026 17:40
rwinieski
approved these changes
Nov 23, 2026
3 of 6 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Fixes OpenSCAP finding CCE-83637-9 (CIS file_permission_user_init_files) on rootless images. An explicit
chmod 644on /home/marklogic_user/.gdbinit ran after the CIS hardening step. The file is now 0740, matching other home-directory files such as .bashrc.Adds test/structure-test-rootless.yaml, which
make structure-testloads only for rootless image types. It asserts the mode, uid, and gid of .gdbinit.Jenkins image reuse: stages reused any local image with the same tag. Build #2 of this branch tested a develop image left on the agent. Build-Image now records the server and platform image IDs. Stages reuse a local tag only when its ID matches, otherwise they unstash and load the archive. Publish keeps its exact-tag checks.
Validation (Jenkins, commit 16cf9e4):
make -n structure-testadds the rootless config only for rootless types. The rootless check fails on the published pre-fix image (-rw-r--r--) and passes on a fixed image.Not exercised by these builds: SCAP-Scan, the ARM Load-Image path, and Publish-Image. The upgrade image is still always loaded because its tag is mutable.
Checklist:
Owner:
JIRA_ID as part of branch/PR name
Rebase the branch with upstream
Squashed all commits into a single commit
Added Tests
Reviewer:
Reviewed Tests
Added to Release Wiki/Jira