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

Fix FidoMetadataDownloader failure on unknown properties #376

Merged
merged 13 commits into from
Sep 3, 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
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);
}
}
Loading