Skip to content

Using non-collections with every should fail #6762

@anderseknert

Description

@anderseknert

Given an input object like this:

{
    "items": {
        "a": "b"
    }
}

I made a mistake in how I interpreted the input, and used every like this:

allow if {
    some key in ["a", "b", "c"]
    every item in input.items[key] {
        item == "foo"
    }
}

This is non-sensical, as input.items["a"] will return the string "b" and not a collection, but surprisingly this passed.

Not just a runtime issue either, as the this also passes:

every item in 1 {
    item == "foo"
}

I'd expect the every keyword to fail evaluation on anything but a valid collection, both at compile time and runtime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions