-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google proto timestamps support #510
base: main
Are you sure you want to change the base?
Conversation
…json - converted to rfc3339 Signed-off-by: Guilherme Cassolato <[email protected]>
dbe9477
to
09861a4
Compare
@guicassolato not sure what we want to do with this given it is a breaking change? When you mention CEL here is that via AuthConfig or AuthPolicy? |
@maleck13, this was an attempt to "hotfix" specifically for the case of the Timestamp data type, before v1 went out. I still think it is a somewhat valid approach in spite of the breaking change it would introduce indeed. I struggle to believe users are doing anything useful today with the timestamp as-is. Maybe in OPA, but even so that would be such an edge case. To have in mind this PR modifies objects like That said, @alexsnaps has shared some concerns and proposed a more holistic strategy to tackle the issue of data types and well-known attributes. I trust him 100% on this. Unless this other strategy turns out not to be possible for any non-technical reason or we find out the issue is (and will ever be!) in fact exclusive of the Timestamp data type, I'm happy to sink the PR and let @alexsnaps guide the fix. It is also true that this PR, apart from being limited to timestamps, takes a heuristic approach to detect the data type. In the long-term, this is not great. So another reason.
The change would kind of surface to the AuthPolicy, although there is no actual change in the API, neither in the AuthConfig nor in the AuthPolicy. Just the internals. |
My $.02, I don't think we can get out of our way to introduce a breaking change here. Or say at least not for CEL. Arguably this, in CEL again, is a bug. The reason CEL should be consistent is that for one all that's needed is there and spec'ed, but it would align the behavior and data representation across all our component that embed a CEL interpreter, so that both data (as protobuf) and AST could be freely exchanged. Which was actually one of the appeal of CEL when we introduced it. |
Adds support for selecting values that match
google.golang.org/protobuf/types/known/timestamppb.Timestamp
type (i.e.{ "seconds": Number, "nanos": Number }
) from the Authorization JSON. The source values are converted to their corresponding timestamp string representation in RFC3339 format.Breaking change:
Users that previously trusted on selectors/CEL expressions such as
request.time
to resolve to{ "seconds": Number, "nanos": Number }
shall now expect RFC3339 instead.Users can still dig into the details of a timestamp value in the middle of an expression or for extracting only one of the parts of the timestamp (e.g.
request.time.seconds
). However, RFC3339 will be used whenever extracting a value known to be a perfect representation of a timestamp in Google's protobuf format, for example, when building dynamic URLs and request parameters for fetching metadata from external sources, when extending properties of identity objects, and dynamic authorization response attributes (e.g. injected HTTP headers, etc) from these values.Although
google.golang.org/protobuf/types/known/timestamppb.Timestamp
declares bothseconds
andnanos
as optional. For the conversion to RFC3339 to trigger, at least one of these properties must be present in the source value, and no other property other than these two.