Skip to content

fix: make get_alert idempotent#5767

Merged
CarolYeh910 merged 1 commit intoaws:mainfrom
jmayclin:2026-03-02-idempotent-alert
Mar 4, 2026
Merged

fix: make get_alert idempotent#5767
CarolYeh910 merged 1 commit intoaws:mainfrom
jmayclin:2026-03-02-idempotent-alert

Conversation

@jmayclin
Copy link
Copy Markdown
Contributor

@jmayclin jmayclin commented Mar 2, 2026

Goal

Make s2n_connection_get_alert idempotent and thread-safe.

Why

s2n_connection_get_alert currently consumes the alert which is ... odd behavior.

It is also not safe to call concurrently, because it mutates the stuffer.

How

We shallow copy the stuffer, so that the write/read cursor increments are local to the function.

Callouts

Technically a behavior change, but I consider this low risk because the scenario where someone is relying on the non-idempotency of this behavior seems unlikely.

Testing

Added a unit test.

Related

#5756
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions bot added the s2n-core team label Mar 2, 2026
@jmayclin jmayclin marked this pull request as ready for review March 2, 2026 23:37
@CarolYeh910 CarolYeh910 added this pull request to the merge queue Mar 4, 2026
Merged via the queue into aws:main with commit 5f54315 Mar 4, 2026
55 checks passed
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.

3 participants