Skip to content

Validate DHCP client identity and source address - #191

Merged
fkorotkov-oai merged 3 commits into
mainfrom
dev/edi/codex/dhcp-client-validation
Aug 11, 2026
Merged

Validate DHCP client identity and source address#191
fkorotkov-oai merged 3 commits into
mainfrom
dev/edi/codex/dhcp-client-validation

Conversation

@edi-oai

@edi-oai edi-oai commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

This improves DHCP-path packet validation and hardens bootpd(8) configuration.

Thanks to Darryl Jaskolski for finding and reporting these issues!

@edi-oai
edi-oai requested a review from fkorotkov-oai August 11, 2026 00:22

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8aeb89bf97

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/main.rs Outdated
Comment on lines +285 to +286
CFString::new("dhcp_ignore_client_identifier"),
CFNumber::from(1_i32),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Store the ignore-client-identifier flag as a Boolean

When a DHCP client supplies or rotates option 61, this value is written to the plist as a numeric CFNumber, but bootpd defines dhcp_ignore_client_identifier as a Boolean preference and does not coerce an integer into that setting. The flag therefore remains ineffective, allowing a client to obtain leases under multiple identifiers and potentially exhaust the address pool; construct this entry with CFBoolean::true_value() instead.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This does not appear to be an issue.

bootpd loads this property with SET_NUMBER_FROM_PLIST, and it explicitly accepts a CFNumber.

But I agree that using CFBoolean is more sound here, fixing in 30787c8.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30787c8c67

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/main.rs Outdated

SCPreferencesCommitChanges(prefs.as_concrete_TypeRef());
anyhow::ensure!(
SCPreferencesCommitChanges(prefs.as_concrete_TypeRef()) != 0,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Serialize preference commits before failing startup

When multiple VMs start concurrently, each process opens an unlocked SCPreferences session for the same plist, so one process can commit after another session was created and cause the latter's SCPreferencesCommitChanges to fail with stale preferences. Unlike the previous code, this failure now propagates out of try_main and prevents that VM's proxy from starting even when both processes are writing identical defaults. Lock the preferences before mutation/commit or synchronize and retry stale commits before treating the result as fatal.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 6595a6c.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6595a6c226

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/main.rs
),
(
CFString::new("dhcp_ignore_client_identifier"),
CFBoolean::true_value().as_CFType(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Store ignore-client-identifier as a CFNumber

The fresh evidence in the current diff is that this setting has now been changed to CFBoolean, whereas bootpd loads dhcp_ignore_client_identifier through SET_NUMBER_FROM_PLIST, which expects a CFNumber; Core Foundation booleans have a different type ID and are therefore ignored. When a client changes option 61, bootpd will continue allocating leases by client identifier, defeating the intended protection against exhausting the DHCP pool; encode 1 as a CFNumber instead.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

SET_NUMBER_FROM_PLIST does not require a CFNumber, see #191 (comment) for a proof.

@fkorotkov-oai
fkorotkov-oai merged commit 28bb29d into main Aug 11, 2026
2 checks passed
@fkorotkov-oai
fkorotkov-oai deleted the dev/edi/codex/dhcp-client-validation branch August 11, 2026 02:10
edi-oai added a commit that referenced this pull request Aug 14, 2026
* Require BOOTP chaddr match for host→VM DHCP responses

Mirror #191 request-path identity checks: admit/forward DHCP
BootReplies only when chaddr matches the VM MAC, so foreign
client replies are not written into the guest fd.

Co-authored-by: Cursor <cursoragent@cursor.com>

* $ cargo fmt

---------

Co-authored-by: genforAI <genforAI@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Nikolay Edigaryev <edi@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants