Open
Description
Description
OpenAPIObjectContainer
's API has a bug:
public struct OpenAPIObjectContainer: Codable, Hashable, Sendable {
// public
public var value: [String: (any Sendable)?]
public init() { self.init(validatedValue: [:]) }
public init(unvalidatedValue: [String: (any Sendable)?]) throws {
try self.init(validatedValue: Self.tryCast(unvalidatedValue))
}
// internals
init(validatedValue value: [String: (any Sendable)?]) { self.value = value }
Basically the public init
s force me to go through validation (and throw
) but the setter for self.value
accepts anything. So I can write
struct BadGuy: Sendable {}
var c = OpenAPIObjectContainer()
c.value["bad"] = BadGuy()
which now gives me a "validated" OpenAPIObjectContainer
without validation.
Reproduction
see above
Package version(s)
runtime 1.8.0
Expected behavior
won't let me set bad stuff
Environment
6.2
Additional information
No response