Skip to content

limit ARI windows to microseconds #483

Closed

Description

@jvanasco

Here is a sample ARI payload from pebble that I generated while testing ARI functions

{'payload': {'suggestedWindow': {'start': '2025-02-11T21:19:27.333333334Z', 'end': '2025-02-13T21:19:27.333333334Z'}}, 'headers': {'Cache-Control': 'public, max-age=0, no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Link': 'https://127.0.0.1:14000/dir;rel="index"', 'Retry-After': '21600', 'Date': 'Wed, 12 Feb 2025 21:17:17 GMT', 'Content-Length': '127'}, 'status_code': 200}

Note the time resolution is in nanoseconds:

2025-02-11T21:19:27.333333334Z

While go natively handles precision in nanoseconds, other languages do not -- including Python:

2025-02-11T21:19:27.333333334Z # go precision
2025-02-11T21:19:27.333334Z # Python precision

On Python, one needs to manipulate the timestamp as a string to remove the extra precision before using datetime.datetime.strptime

I'm not sure how this didn't pop up before on my tests. Maybe dropping the lifetime of the certs to something arbitrarily short surfaced this. The only mention I've found is here: https://community.letsencrypt.org/t/thoughts-from-starting-to-play-with-ari/200276/20

IMHO, it would be nice if pebble/boulder/rfc limited the precision to microseconds as Go is an outlier in terms of supporting nanosecond precision.

Activity

  1. jvanasco commented on Feb 12, 2025

    @jvanasco
    ContributorAuthor

    Cross referencing to letsencrypt/boulder#7779 ; wherein Boulder drops down precision due to .NET limitations.

  2. mcpherrinm commented on Feb 12, 2025

    @mcpherrinm
    Contributor

    I don't think I've seen this feedback in IETF, so it would be good to try to get this addressed at spec-level

  3. mcpherrinm commented on Feb 13, 2025

    @mcpherrinm
    Contributor

    But either way, I think it’s reasonable to target something easy to support for clients in Pebble, but not match Boulder exactly so we don’t freeze on too specific a value unless it’s standardized as such

  4. jvanasco commented on Feb 13, 2025

    @jvanasco
    ContributorAuthor

    Perhaps pebble could also use different timezones: i.e. Z, UTC, -00:00 are all equivalent

  5. felixfontein commented on Feb 13, 2025

    @felixfontein
    Contributor

    @jvanasco according to https://www.rfc-editor.org/rfc/rfc3339#section-5.6 Z and -00:00 are valid, but UTC is not (see time-offset).

    It would be great if Pebble would have more variety in its answers (use nanoseconds, microseconds, milliseconds, use Z, or +00:00 or -00:00 or even other time offsets, maybe even random ones?) to ensure that clients support all kind of timestamp formats that are allowed according to RFC 3339. It's annoying if you adjust your parser to what Pebble sends and then your parser goes belly up with the first timestamp it gets from a real CA.

    BTW, while looking at RFC 3339, it says time-secfrac = "." 1*DIGIT, which I guess means that you can only have one fractional digit. Which is interesting, since https://www.rfc-editor.org/rfc/rfc3339#section-5.8 shows an example with two fractional digits.

    (If anyone is interested in code to reduce the precision to something Python accepts: https://github.com/ansible-collections/community.crypto/blob/a42e541326796aae2b5ff02504af925df14546e5/plugins/module_utils/acme/backends.py#L51-L67)

  6. jvanasco commented on Feb 13, 2025

    @jvanasco
    ContributorAuthor

    @jvanasco according to https://www.rfc-editor.org/rfc/rfc3339#section-5.6 Z and -00:00 are valid, but UTC is not (see time-offset).

    Nice catch! Thanks. That makes things easier for me, because the tests for my parser were failing on "EDT"/"EST" on some python versions -- though UTC and GMT work.

    The code I settled on uses some string manipulation instead of regex; instead of trying different formats, I also just use strings to determine what the strptime likely is. I will likely redo based on your code.

    I did open an issue against Pebble (ietf-wg-acme/acme-ari#93). I do think the precision should be dropped.

    The rfc5280 states, regarding the notAfter/notBefore validity periods:

    https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.5.1

    UTCTime specifies the year
    through the two low-order digits and time is specified to the
    precision of one minute or one second.

    and

    GeneralizedTime values MUST NOT include fractional seconds.

    Dropping fractional seconds would make the window in-line with the x509 constraints itself.

  7. aarongable commented on Feb 13, 2025

    @aarongable
    Contributor

    I don't think citing RFC 5280 is particularly relevant here, since those timestamps are encoded as strings within certificates themselves. A more relevant comparison would be RFC 8555, which unfortunately appears to have nothing to say about the precision with which the various ACME timestamps (e.g. authz expiry, new-order notBefore/notAfter) should be represented.

    I'll file a PR to have Pebble truncate these to hundredths of a second, which python should be able to parse, and which will exercise fractional-second-parsing codepaths, and will be different from what Boulder does, but won't be a useless amount of precision.

    Or maybe microseconds, to be a bit less surprising.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions