Dependency version modification based on a flag; ModuleDependency#attributes not available from DependencyResolveDetails

Before each dependency in a build is resolved, I want to potentially change the resolved version based on a flag in that dependency.

I thought about storing the flag in ModuleDependency#attributes, but attributes don’t seem to be readable in the Action for ResolutionStrategy#eachDependency(Action<? super DependencyResolveDetails> rule).

Is there any other easy way to achieve what I want?

I thought about using a colon in the version value as a flag, then removing it in ResolutionStrategy#eachDependency(…) and processing the version differently there, but that is very hacky.