Skip to content

Fix MapRef.fromSeqRefs vulnerability#4208

Merged
djspiewak merged 10 commits into
typelevel:series/3.xfrom
underskyer:Fix-MapRef-constructor-vulnerability
Dec 21, 2024
Merged

Fix MapRef.fromSeqRefs vulnerability#4208
djspiewak merged 10 commits into
typelevel:series/3.xfrom
underskyer:Fix-MapRef-constructor-vulnerability

Conversation

@underskyer

Copy link
Copy Markdown
Contributor

I just fix fromSeqRefs constructor of MapRef. There it was possible to call this method with an empty list of shards, which resulted in a divide by zero exception. Now you can call it with nonempty sequence of shards only. That constructor is only used in two other constructors in the code base. So it no needs to fix some tests or docs, I think.

@underskyer

Copy link
Copy Markdown
Contributor Author

Maybe I should leave the old method as deprecated?

@armanbilge armanbilge linked an issue Dec 20, 2024 that may be closed by this pull request
@djspiewak

Copy link
Copy Markdown
Member

Maybe I should leave the old method as deprecated?

I think this will definitely be required for compatibility. Speaking of which, why didn't mima flag this?

@armanbilge

Copy link
Copy Markdown
Member

I think this will definitely be required for compatibility. Speaking of which, why didn't mima flag this?

It's actually not required for binary-compatibility, because NonEmptySeq is an AnyVal wrapper for Seq.

So it's really just a matter of source-compatibility.

@djspiewak

Copy link
Copy Markdown
Member

Oh, I didn't realize that. I'm totally cool with murdering source compat in 3.6 for something like this, so let's skip the deprecation.

@armanbilge armanbilge added this to the v3.6.0 milestone Dec 20, 2024
Comment thread std/shared/src/main/scala/cats/effect/std/MapRef.scala Outdated
Comment thread std/shared/src/main/scala/cats/effect/std/MapRef.scala Outdated
Comment thread std/shared/src/main/scala/cats/effect/std/MapRef.scala Outdated
Comment thread std/shared/src/main/scala/cats/effect/std/MapRef.scala Outdated
Comment thread std/shared/src/main/scala/cats/effect/std/MapRef.scala Outdated
Comment thread std/shared/src/main/scala/cats/effect/std/MapRef.scala Outdated
Comment thread std/shared/src/main/scala/cats/effect/std/MapRef.scala Outdated

@armanbilge armanbilge left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice work!

@djspiewak
djspiewak merged commit c7d3a03 into typelevel:series/3.x Dec 21, 2024
@underskyer
underskyer deleted the Fix-MapRef-constructor-vulnerability branch December 22, 2024 07:03
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.

MapRef.fromSeqRefs fails on Nil

4 participants