abcxyz / jvs

Apache License 2.0
8 stars 0 forks source link

Potential bug in keyhosting unit test #323

Open yolocs opened 11 months ago

yolocs commented 11 months ago

TL;DR

See error log

-test.shuffle 1691087712673395865
{"severity":"INFO","timestamp":"2023-08-03T18:35:12.679477149Z","caller":"jvscrypto/rotation_handler.go:285","message":"primary does not exist, should promote the newest key to primary regardless of propagation delay.","version":"name:\"newEnabledKey\"  state:ENABLED  create_time:{seconds:8640000}"}
{"severity":"INFO","timestamp":"2023-08-03T18:35:12.68174308Z","caller":"jvscrypto/rotation_handler.go:250","message":"version created before cutoff date, should disable.","version":"name:\"oldEnabledKey\"  state:ENABLED  create_time:{seconds:4320000}","cutoff":"1970-04-01T00:00:00Z"}
{"severity":"INFO","timestamp":"2023-08-03T18:35:12.681923582Z","caller":"jvscrypto/rotation_handler.go:238","message":"version created before cutoff date, should destroy.","version":"name:\"oldDisabledKey\"  state:DISABLED  create_time:{seconds:86400}","cutoff":"1970-03-12T00:00:00Z"}
{"severity":"INFO","timestamp":"2023-08-03T18:35:12.682035484Z","caller":"jvscrypto/rotation_handler.go:2[27](https://github.com/abcxyz/jvs/actions/runs/5754435631/job/15599708244#step:5:28)","message":"no action needed for key version in current state.","version":"name:\"oldDestroyedKey\"  state:DESTROYED  create_time:{seconds:86400}","state":"DESTROYED"}
{"severity":"INFO","timestamp":"2023-08-03T18:35:12.683451203Z","caller":"jvscrypto/rotation_handler.go:[29](https://github.com/abcxyz/jvs/actions/runs/5754435631/job/15599708244#step:5:30)1","message":"version created before cutoff date, should promote to primary.","version":"name:\"newEnabledKey\"  state:ENABLED  create_time:{seconds:8553600}","cutoff":"1970-04-10T12:00:00Z"}
{"severity":"INFO","timestamp":"2023-08-03T18:35:12.684453717Z","caller":"jvscrypto/rotation_handler.go:250","message":"version created before cutoff date, should disable.","version":"name:\"oldEnabledKey2\"  state:ENABLED  create_time:{seconds:4233600}","cutoff":"1970-04-01T00:00:00Z"}
{"severity":"INFO","timestamp":"2023-08-03T18:35:12.684581519Z","caller":"jvscrypto/rotation_handler.go:291","message":"version created before cutoff date, should promote to primary.","version":"name:\"newEnabledKey\"  state:ENABLED  create_time:{seconds:8553600}","cutoff":"1970-04-10T12:00:00Z"}
{"severity":"INFO","timestamp":"2023-08-03T18:35:12.685985938Z","caller":"jvscrypto/rotation_handler.go:291","message":"version created before cutoff date, should promote to primary.","version":"name:\"newEnabledKey\"  state:ENABLED  create_time:{seconds:8553600}","cutoff":"1970-04-10T12:00:00Z"}
{"severity":"INFO","timestamp":"2023-08-03T18:35:12.687011952Z","caller":"jvscrypto/rotation_handler.go:269","message":"version created before cutoff date, should rotate.","version":"name:\"oldEnabledKey\"  state:ENABLED  create_time:{seconds:4[32](https://github.com/abcxyz/jvs/actions/runs/5754435631/job/15599708244#step:5:33)0000}","cutoff":"1970-04-01T01:00:00Z"}
{"severity":"INFO","timestamp":"2023-08-03T18:[35](https://github.com/abcxyz/jvs/actions/runs/5754435631/job/15599708244#step:5:36):12.687519559Z","caller":"jvscrypto/rotation_handler.go:250","message":"version created before cutoff date, should disable.","version":"name:\"oldEnabledKey\"  state:ENABLED  create_time:{seconds:4320000}","cutoff":"1970-04-01T00:00:00Z"}
{"severity":"INFO","timestamp":"2023-08-03T18:35:12.688444072Z","caller":"jvscrypto/rotation_handler.go:183","message":"no primary or new keys found, creating a new key and immediately promoting to primary."}
--- FAIL: TestGenerateJWKString (0.00s)
    --- FAIL: TestGenerateJWKString/happy-path (0.01s)
        key_hosting_test.go:1[40](https://github.com/abcxyz/jvs/actions/runs/5754435631/job/15599708244#step:5:41): Got diff (-want, +got):   strings.Join({
                `{"keys":[{"crv":"P-256","kid":"projects/[PROJECT]/locations/[LOC`,
                "ATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVers",
                `ions/[VERSION]-0","kty":"EC","x":"`,
            -   "wUu74eE1cWVRP3YNWmpXPSq7MjML3RSZWFGoRddzHA",
            +   "AMFLu-HhNXFlUT92DVpqVz0quzIzC90UmVhRqEXXcxw",
                `","y":"Pta0Tm_zRC580dHa3hTHRrU6gvSRGd0HCvO5qWI416c"}]}`,
              }, "")
    --- FAIL: TestGenerateJWKString/multi-key (0.01s)
        key_hosting_test.go:140: Got diff (-want, +got):   strings.Join({
                `{"keys":[{"crv":"P-256","kid":"projects/[PROJECT]/locations/[LOC`,
                "ATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVers",
                `ions/[VERSION]-0","kty":"EC","x":"`,
            -   `wUu74eE1cWVRP3YNWmpXPSq7MjML3RSZWFGoRddzHA","y":"Pta0Tm_zRC580dH`,
            -   `a3hTHRrU6gvSRGd0HCvO5qWI[41](https://github.com/abcxyz/jvs/actions/runs/5754435631/job/15599708244#step:5:42)6c"},{"crv":"P-256","kid":"projects/[P`,
            -   "ROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRY",
            -   `PTO_KEY]/cryptoKeyVersions/[VERSION]-1","kty":"EC","x":"wUu74eE1`,
            -   "cWVRP3YNWmpXPSq7MjML3RSZWFGoRddzHA",
            +   `AMFLu-HhNXFlUT92DVpqVz0quzIzC90UmVhRqEXXcxw","y":"Pta0Tm_zRC580d`,
            +   `Ha3hTHRrU6gvSRGd0HCvO5qWI416c"},{"crv":"P-256","kid":"projects/[`,
            +   "PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CR",
            +   `YPTO_KEY]/cryptoKeyVersions/[VERSION]-1","kty":"EC","x":"AMFLu-H`,
            +   "hNXFlUT92DVpqVz0quzIzC90UmVhRqEXXcxw",
                `","y":"Pta0Tm_zRC580dHa3hTHRrU6gvSRGd0HCvO5qWI416c"}]}`,
              }, "")

Expected behavior

No response

Observed behavior

No response

Environment Details

NA

Additional information

No response