Skip to content
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

Add Roughtime client pseudo-Node #845

Merged
merged 5 commits into from
Apr 16, 2020
Merged

Add Roughtime client pseudo-Node #845

merged 5 commits into from
Apr 16, 2020

Conversation

daviddrysdale
Copy link
Contributor

@daviddrysdale daviddrysdale commented Apr 15, 2020

Checklist

  • Pull request affects core Oak functionality (e.g. runtime, SDK, ABI)
    • I have written tests that cover the code changes.
    • I have checked that these tests are run by Cloudbuild
    • I have updated documentation accordingly.
    • I have raised an issue to
      cover any TODOs and/or unfinished work.
  • Pull request includes prototype/experimental work that is under
    construction.

@daviddrysdale daviddrysdale marked this pull request as ready for review April 15, 2020 13:54
@daviddrysdale
Copy link
Contributor Author

I needed a break from fighting Bazel and Cargo, so I digressed this morning…

Copy link
Collaborator

@conradgrobler conradgrobler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

docs/concepts.md Outdated
Applications to retrieve an approximate wall clock time using the
[Roughtime protocol](https://roughtime.googlesource.com/roughtime). Note that
retrieving the current time is relatively slow, and so is best done
infrequently.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet needed, but mentioning it just to keep track of the point somewhere: once the policy system is fully in place, it should be noted in the documentation that the Roughtime pseudo node is a publice node (timing/frequencies of requests can be used to leak data). Nodes should probably only call this at start-up time before they are tainted by secret data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a note for now.

: servers_(servers.size() > 0 ? servers : roughtime::kDefaultServers),
min_overlapping_intervals_(min_overlapping_intervals > 0
? min_overlapping_intervals
: roughtime::kDefaultMinOverlappingIntervals),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming the default instead of an invalid value might be unexpected. If there are fewer servers than the minimum number of overlaps it will fail later without it being clear to the users it was because of a default value. Perhaps default to 1 or return an error status immediately?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went for defaulting overlap to min(default, servers.size()); I've also added an extra test of a deliberately misconfigured pseudo-Node.

// on 1 January 1970). Leap seconds are linearly smeared over a 24-hour
// period. That is, the smear extends from UTC noon to noon over 86,401 or
// 86,399 SI seconds, and all the smeared seconds are the same length.
uint64 rough_time = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would call this time_usec or similar, make it super clear what the unit is. Even better, perhaps use the dedicated well-known type? https://developers.google.com/protocol-buffers/docs/reference/csharp/class/google/protobuf/well-known-types/timestamp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added _usec suffix, but skipped Timestamp (partly to keep the information flowing as close to what Roughtime emits as possible, partly to avoid fiddling with a new dep).

string name = 1;
string host = 2;
uint32 port = 3;
bytes public_key_base64 = 4;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems odd for this field to be both bytes and base64 encoded. I would expect either bytes and binary, or string and base64?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot – I was going to make this have the raw key but changed my mind and forgot to change the type back.

Tweak a few other things along the way:
 - put internal constants and methods into an unnamed namespace
 - convert port to be of type uint32_t
 - consistently capitalize Roughtime
 - make defaults externally visible in the oak::roughtime namespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants