Skip to content

Conversation

@troglobit
Copy link
Contributor

Description

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

@troglobit troglobit requested review from axkar, Copilot and wkz June 25, 2025 17:51
@troglobit troglobit linked an issue Jun 25, 2025 that may be closed by this pull request
@troglobit troglobit self-assigned this Jun 25, 2025
@troglobit troglobit added enhancement New feature or request ci:main Build default defconfig, not minimal labels Jun 25, 2025
@troglobit troglobit added this to the Infix v25.06 milestone Jun 25, 2025
Copy link

Copilot AI left a 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);
Copy link

Copilot AI Jun 25, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@axkar axkar left a 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

Copy link
Contributor

@wkz wkz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@troglobit troglobit merged commit 9629e2e into main Jun 26, 2025
13 of 17 checks passed
@troglobit troglobit deleted the mount-mode branch June 26, 2025 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:main Build default defconfig, not minimal enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for setting mode of a container content mount

4 participants