Skip to content

Fix missing properties in JSON output #137

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import de.rub.nds.scanner.core.probe.result.ObjectResult;
import de.rub.nds.scanner.core.probe.result.SetResult;
import de.rub.nds.scanner.core.probe.result.StringResult;
import de.rub.nds.scanner.core.probe.result.TestResult;
import de.rub.nds.scanner.core.probe.result.TestResults;
import de.rub.nds.scanner.core.report.rating.ScoreReport;
import de.rub.nds.tlsattacker.core.constants.NamedGroup;
Expand Down Expand Up @@ -357,4 +358,16 @@ public synchronized String getIpv6Address() {
StringResult stringResult = getStringResult(QuicAnalyzedProperty.IPV6_ADDRESS);
return stringResult == null ? null : stringResult.getValue();
}

public synchronized TestResult getSupportsOcspStapling() {
return getResult(TlsAnalyzedProperty.SUPPORTS_OCSP_STAPLING);
}

public synchronized TestResult getIssuesTls13SessionTicketsAfterHandshake() {
return getResult(TlsAnalyzedProperty.ISSUES_TLS13_SESSION_TICKETS_AFTER_HANDSHAKE);
}

public synchronized TestResult getIssuesTls13SessionTicketsWithApplicationData() {
return getResult(TlsAnalyzedProperty.ISSUES_TLS13_SESSION_TICKETS_WITH_APPLICATION_DATA);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,27 @@ void testSerializeFullReport() {
ServerReportSerializer.serialize(new ByteArrayOutputStream(), report);
// This should not throw an exception
}

@Test
void testSerializeOcspAndSessionTicketProperties() {
ServerReport report = new ServerReport();
report.putResult(TlsAnalyzedProperty.SUPPORTS_OCSP_STAPLING, TestResults.TRUE);
report.putResult(
TlsAnalyzedProperty.ISSUES_TLS13_SESSION_TICKETS_AFTER_HANDSHAKE, TestResults.TRUE);
report.putResult(
TlsAnalyzedProperty.ISSUES_TLS13_SESSION_TICKETS_WITH_APPLICATION_DATA,
TestResults.FALSE);

ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ServerReportSerializer.serialize(outputStream, report);

String jsonOutput = outputStream.toString();
// Verify that the properties are included in the JSON output
assert jsonOutput.contains("SUPPORTS_OCSP_STAPLING")
: "JSON doesn't contain SUPPORTS_OCSP_STAPLING";
assert jsonOutput.contains("ISSUES_TLS13_SESSION_TICKETS_AFTER_HANDSHAKE")
: "JSON doesn't contain ISSUES_TLS13_SESSION_TICKETS_AFTER_HANDSHAKE";
assert jsonOutput.contains("ISSUES_TLS13_SESSION_TICKETS_WITH_APPLICATION_DATA")
: "JSON doesn't contain ISSUES_TLS13_SESSION_TICKETS_WITH_APPLICATION_DATA";
}
}