-
Notifications
You must be signed in to change notification settings - Fork 14
Add support for setting mode of a container content mount #1071
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes #1070 Signed-off-by: Joachim Wiberg <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for setting a file mode for container content mounts by updating the YANG model and implementing the corresponding logic in the container processing code.
- Updated YANG module with a new revision and added the "mode" leaf with an octal string pattern.
- Modified the container creation logic in C to parse the mode value and apply it using fchmod.
- Updated the module reference and ChangeLog to reflect the new feature.
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/confd/yang/containers.inc | Updated the referred YANG file revision to the new version. |
| src/confd/yang/confd/infix-containers.yang | Added a new revision and introduced the "mode" leaf for file permissions. |
| src/confd/src/infix-containers.c | Implemented mode parsing and applied file permissions using fchmod. |
| doc/ChangeLog.md | Documented the new feature in the ChangeLog. |
| close(fd); | ||
|
|
||
| /* Now decode base64 content into the properly secured file */ | ||
| snprintf(cmd, sizeof(cmd), "base64 -d > %s", nm); |
Copilot
AI
Jun 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the file name (nm) directly in a shell command via snprintf could allow command injection if nm contains unexpected characters. Consider sanitizing nm or using a safer method to decode base64 content without invoking a shell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work 🥇
P.S. Verified in my container remote host command exec test as well :)
LGTM
wkz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
Description
Checklist
Tick relevant boxes, this PR is-a or has-a: