Skip to content

fix(authserver): PostgreSQL and H2 timestamps without time zone are stored in the JVM's zone #354

Backlog

Description

@dfcoffin

Found in the round-2 review of #350 (#345). Pre-existing; to be fixed before deployment.

Problem

On PostgreSQL (and on H2), the AS's time columns are TIMESTAMP without a time zone, for example oauth2_registered_client.locked_until and Spring Authorization Server's oauth2_authorization issued/expires times. A java.sql.Timestamp is written and read in the JVM's default time zone. If the JVM does not run in UTC, the stored value is local time without its offset:

MySQL's TIMESTAMP columns hold an instant, and the AS's MySQL URLs set serverTimezone=UTC; check whether MySQL is affected at all.

Fix

Pick one and apply it to every deployment profile:

  • run the AS JVM in UTC (-Duser.timezone=UTC or TZ=UTC in the images) and the PostgreSQL sessions in UTC, and say so in DEPLOYMENT_GUIDE.md; or
  • change the PostgreSQL time columns to timestamptz in a new migration.

Add a test that writes and reads locked_until with the JVM in a zone that has daylight-saving time.

Activity

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