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

Disable unreliable check between current times of different systems #17

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>de.adorsys</groupId>
<artifactId>sd-jwt</artifactId>
<packaging>jar</packaging>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>Library for the production, verification and consumption of SD-JWT documents</description>
<url>https://github.com/adorsys/sd-jwt</url>
Expand Down
9 changes: 3 additions & 6 deletions src/main/java/de/adorsys/sdjwt/SdJws.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,9 @@ public void verifySignature(JWSVerifier verifier) throws JOSEException {
}

public void verifyIssuedAtClaim() throws SdJwtVerificationException {
long now = Instant.now().getEpochSecond();
long iat = SdJwtUtils.readTimeClaim(payload, "iat");

if (now < iat) {
throw new SdJwtVerificationException("jwt issued in the future");
}
// The purpose of this method was to check if `iat` is not in the future.
// However, this cannot be achieved at high resolution between times provided
// by different systems. So we removed our unreliable implementation.
}

public void verifyExpClaim() throws SdJwtVerificationException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,21 +203,6 @@ public void testShouldFail_IfKbSdHashInvalid() {
);
}

@Test
public void testShouldFail_IfKbIssuedInFuture() {
long now = Instant.now().getEpochSecond();

var kbPayload = exampleS20KbPayload();
kbPayload.set("iat", mapper.valueToTree(now + 1000));

testShouldFailGenericS20(
kbPayload,
defaultKeyBindingJwtVerificationOpts().build(),
"Key binding JWT: Invalid `iat` claim",
"jwt issued in the future"
);
}

@Test
public void testShouldFail_IfKbTooOld() {
long issuerSignedJwtIat = 1683000000; // same value in test vector
Expand Down