Skip to content

Validate container ID from XPC requests#1956

Open
katiewasnothere wants to merge 2 commits into
apple:mainfrom
katiewasnothere:validate_xpc_containerid
Open

Validate container ID from XPC requests#1956
katiewasnothere wants to merge 2 commits into
apple:mainfrom
katiewasnothere:validate_xpc_containerid

Conversation

@katiewasnothere

Copy link
Copy Markdown
Contributor

Type of Change

  • Bug fix

Motivation and Context

Validate XPC message provided container IDs in ContainersHarness to prevent file path traversal when container ID is invalid.

Testing

  • Tested locally

@github-actions github-actions Bot added the cli label Jul 16, 2026
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown

Code Coverage

Tier Line Coverage
Unit 23.4%
Integration 66.62%
Combined 75.53%

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
@katiewasnothere
katiewasnothere force-pushed the validate_xpc_containerid branch from 8ca584c to 12d7472 Compare July 16, 2026 21:08
/// Utility.validEntityName
/// Container name rule
public static func nameValid(_ name: String) -> Bool {
guard name.count < 63 else {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
guard name.count < 63 else {
// Maximum Linux hostname length is 64, but limit to maximum DNS label length
guard name.count =< 63 else {

Do we have a unit test that checks the length constraint?

@katiewasnothere
katiewasnothere force-pushed the validate_xpc_containerid branch from 9ec5fee to 2ec268f Compare July 16, 2026 21:51
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
@katiewasnothere
katiewasnothere force-pushed the validate_xpc_containerid branch from 2ec268f to 6e1c195 Compare July 17, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants