Skip to content

Commit

Permalink
Merge pull request #376 from Yubico/fido-mds-unknown-fields
Browse files Browse the repository at this point in the history
Fix FidoMetadataDownloader failure on unknown properties
  • Loading branch information
emlun authored Sep 3, 2024
2 parents fed0930 + 63bc71b commit 67634f8
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 18 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This name is shown in the status badge in the README
name: integration-test

on:
push:
branches:
- main
- 'release-*'
schedule:
# Run once a week to check compatibility with new FIDO MDS blob contents
- cron: '0 0 * * 1'

jobs:
test:
name: JDK ${{ matrix.java }} ${{ matrix.distribution }}

runs-on: ubuntu-latest
strategy:
matrix:
java: [17]
distribution: [temurin]

outputs:
report-java: 17
report-dist: temurin

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: ${{ matrix.distribution }}

- name: Run integration tests
run: ./gradlew integrationTest

- name: Archive HTML test report
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: test-reports-java${{ matrix.java }}-${{ matrix.distribution }}-html
path: "*/build/reports/**"

- name: Archive JUnit test report
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: test-reports-java${{ matrix.java }}-${{ matrix.distribution }}-xml
path: "*/build/test-results/**/*.xml"
10 changes: 10 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
== Version 2.5.3 (unreleased) ==

`webauthn-server-attestation`:

Fixes:

* `FidoMetadataDownloader` no longer rejects FIDO MDS metadata BLOBs with
unknown properties.


== Version 2.5.2 ==

Fixes:
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ repositories {
}

dependencies {
implementation("info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.9.11")
implementation("info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.15.0")
implementation("io.franzbecker:gradle-lombok:5.0.0")

// Spotless dropped Java 8 support in version 2.33.0
if (JavaVersion.current().isJava11Compatible) {
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.19.0")
implementation("io.github.cosmicsilence:gradle-scalafix:0.1.14")
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0")
implementation("io.github.cosmicsilence:gradle-scalafix:0.2.2")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ spotless {
scalafix {
configFile.set(project.rootProject.file("scalafix.conf"))

// Work around dependency resolution issues in April 2022
semanticdb.autoConfigure.set(true)
semanticdb.version.set("4.5.5")
if (project.name != "yubico-util-scala") {
// yubico-util-scala is the only subproject with Scala sources in the "main" source set
ignoreSourceSets.add("main")
}
}

project.dependencies.scalafix("com.github.liancheng:organize-imports_2.13:0.6.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

pitest {
pitestVersion.set("1.9.5")
pitestVersion.set("1.15.0")
timestampedReports.set(false)

outputFormats.set(listOf("XML", "HTML"))
Expand Down
12 changes: 6 additions & 6 deletions test-platform/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ dependencies {
api("junit:junit:4.13.2")
api("org.bouncycastle:bcpkix-jdk18on:[1.62,2)")
api("org.bouncycastle:bcprov-jdk18on:[1.62,2)")
api("org.mockito:mockito-core:4.7.0")
api("org.scalacheck:scalacheck_2.13:1.16.0")
api("org.scalatest:scalatest_2.13:3.2.13")
api("org.scalatestplus:junit-4-13_2.13:3.2.13.0")
api("org.scalatestplus:scalacheck-1-16_2.13:3.2.13.0")
api("org.slf4j:slf4j-nop:2.0.3")
api("org.mockito:mockito-core:4.11.0")
api("org.scalacheck:scalacheck_2.13:1.18.0")
api("org.scalatest:scalatest_2.13:3.2.18")
api("org.scalatestplus:junit-4-13_2.13:3.2.18.0")
api("org.scalatestplus:scalacheck-1-16_2.13:3.2.14.0")
api("org.slf4j:slf4j-nop:2.0.13")
api("uk.org.lidalia:slf4j-test:1.2.0")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
package com.yubico.fido.metadata;

import com.fasterxml.jackson.core.Base64Variants;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yubico.fido.metadata.FidoMetadataDownloaderException.Reason;
import com.yubico.internal.util.BinaryUtil;
Expand Down Expand Up @@ -1172,9 +1171,7 @@ private static ParseResult parseBlob(ByteArray jwt) throws IOException, Base64Ur
final ByteArray jwtSignature = ByteArray.fromBase64Url(s.next());

final ObjectMapper headerJsonMapper =
com.yubico.internal.util.JacksonCodecs.json()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
.setBase64Variant(Base64Variants.MIME_NO_LINEFEEDS);
JacksonCodecs.json().setBase64Variant(Base64Variants.MIME_NO_LINEFEEDS);

return new ParseResult(
new MetadataBLOB(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@

class JacksonCodecs {

static ObjectMapper jsonWithDefaultEnums() {
static ObjectMapper json() {
return com.yubico.internal.util.JacksonCodecs.json()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}

static ObjectMapper jsonWithDefaultEnums() {
return json()
.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE, true);
}
}

1 comment on commit 67634f8

@github-actions
Copy link

Choose a reason for hiding this comment

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

Mutation test results

Package Coverage Stats Prev Prev
Overall 80 % 🔻 1283 🔻 / 1584 🔻 81 % 1378 / 1681
com.yubico.fido.metadata 68 % 🔹 222 🔹 / 324 🔺 68 % 222 / 323
com.yubico.internal.util 47 % 🟢 57 🔹 / 120 🔻 46 % 57 / 123
com.yubico.webauthn 86 % 🔻 570 🔻 / 656 🔻 88 % 656 / 742
com.yubico.webauthn.attestation 92 % 🔹 13 🔹 / 14 🔹 92 % 13 / 14
com.yubico.webauthn.data 93 % 🔹 396 🔻 / 423 🔻 93 % 405 / 432
com.yubico.webauthn.extension.appid 100 % 🏆 13 🔹 / 13 🔹 100 % 13 / 13
com.yubico.webauthn.extension.uvm 50 % 🔹 12 🔹 / 24 🔹 50 % 12 / 24
com.yubico.webauthn.meta 0 % 🔹 0 🔹 / 10 🔹 0 % 0 / 10

Previous run: 240b8d9 - Diff

Detailed reports: workflow run #277

Please sign in to comment.