Skip to content

fix: require complete [server] overrides and cap lambda2html nesting depth - #483

Open
polterguy wants to merge 2 commits into
masterfrom
fix/mail-server-override-html-depth
Open

polterguy wants to merge 2 commits into
masterfrom
fix/mail-server-override-html-depth

Conversation

@polterguy

Copy link
Copy Markdown
Owner

What

Two hardening fixes:

mail: all-or-nothing [server] override

mail.smtp.send and mail.pop3.fetch previously merged a caller-supplied [server]
child with the configured server's connection settings property-by-property. A caller
overriding only host could cause the server's configured username/password to be
transmitted to a host of the caller's choosing.

A [server] override must now supply all of host, port, secure, username
and password — enforced in the slot signature (all five children required:true)
and at runtime in Utilities.Connect (ValidateServerOverride) for direct callers.
With a complete override, a caller can only ever submit his own credentials.

html: lambda2html depth cap

lambda2html recursively converted lambda to HTML with no nesting bound, so a deeply
nested lambda object could overflow the stack and kill the process
(StackOverflowException is uncatchable).

Added MaxDepth = 256, mirroring the existing guards in html2lambda,
html2markdown and xml2lambda. Deeper input raises HyperlambdaException instead.

Tests

  • mail: 21/21 pass — partial and empty [server] overrides are now asserted to
    throw; the full-override and no-override paths remain covered.
  • html: 153/153 pass — added a 300-deep reject test and a 100-deep accept test.

…ail.pop3.fetch

Refuses partial [server] overrides so the configured server's username
and password can never be forwarded to a host of the caller's choosing.
A [server] node must supply host, port, secure, username and password
together - enforced in the slot signature (all children required) and
at runtime in Utilities.Connect for direct callers of both slots.
Adds a MaxDepth of 256 to Lambda2Html.CreateElement, mirroring the
guard in html2lambda, html2markdown and xml2lambda, so deeply nested
lambda objects raise a HyperlambdaException instead of overflowing
the stack and killing the process.
@sonarqubecloud

sonarqubecloud Bot commented Dec 6, 2026

Copy link
Copy Markdown

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.

1 participant