# GHSA-f95p-4cv5-8w8x: linkme fails to ensure slice elements match the slice's declared type


- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Fix available:** Yes
- **Published:** 5 Mar 2024
- **Also known as:** RUSTSEC-2024-0407

## What is GHSA-f95p-4cv5-8w8x?

GHSA-f95p-4cv5-8w8x is a vulnerability in linkme, published on 5 Mar 2024. 

### Official description

Affected versions allow populating a DistributedSlice of T with elements of an arbitrary other type that coerces to T. For example, elements of type `&&str` could end up in a slice of type `[&str]`, since `&&str` coerces to `&str` via a deref coercion.

The flaw was corrected by implementing typechecking for distributed slice elements in such a way that coercion no longer occurs. The element's type must be a subtype of the slice's declared element type.

## Which versions are affected by GHSA-f95p-4cv5-8w8x?

3 open source packages ship an affected version, including linkme.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `linkme` | crates.io | All versions | 0.3.24 |
| `linkme` | crates.io | All versions | 0.3.24 |
| `linkme` | crates.io | From 0.0.0-0 | 0.3.24 |

## How do I fix GHSA-f95p-4cv5-8w8x?

Upgrade linkme to 0.3.24 or later.

## Is GHSA-f95p-4cv5-8w8x being exploited?

There is no known exploitation of GHSA-f95p-4cv5-8w8x in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-f95p-4cv5-8w8x and fix it if it is affected.

What it is: GHSA-f95p-4cv5-8w8x is a vulnerability in linkme, published on 5 Mar 2024. 
Exploitation: There is no known exploitation of GHSA-f95p-4cv5-8w8x in the wild and no public exploit code.

Affected packages and fixed versions:
- linkme (crates.io): affected all versions; fixed in 0.3.24
- linkme (crates.io): affected all versions; fixed in 0.3.24
- linkme (crates.io): affected from 0.0.0-0; fixed in 0.3.24

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-f95p-4cv5-8w8x/ (Markdown: https://insights.sbomify.com/GHSA-f95p-4cv5-8w8x/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-f95p-4cv5-8w8x

---
From sbomify Insights: https://insights.sbomify.com/GHSA-f95p-4cv5-8w8x/
Summaries are generated and may contain mistakes; the official description above is the record.
