Giter VIP home page Giter VIP logo

cwa-testresult-server's Introduction

Corona-Warn-App Testresult Server

DevelopmentDocumentationSupportContributeContributorsRepositoriesLicensing

The goal of this project is to develop the official Corona-Warn-App for Germany based on the exposure notification API from Apple and Google. The apps (for both iOS and Android) use Bluetooth technology to exchange anonymous encrypted data with other mobile phones (on which the app is also installed) in the vicinity of an app user's phone. The data is stored locally on each user's device, preventing authorities or other parties from accessing or controlling the data. This repository contains the testresult server for the Corona-Warn-App.

Status

ci quality gate coverage bugs

About this component

In the world of the Corona Warn App the Test Result Server receives the results from laboratories and delivers these results to the app via the verification-server. The parts of the verification component cooperate in the following manner:

  • The Verification Server of the Corona Warn App (repository: cwa-verification-server) helps validating whether upload requests from the mobile App are valid or not.
  • The Verification Portal of the Corona Warn App (repository: cwa-verification-portal) allows hotline employees to generate teleTANs which are used by users of the mobile App to upload their diagnostic keys.
  • The Verification Identity and Access of the Corona Warn App (repository: cwa-verification-iam) ensures that only authorized health personnel get access to the Verification Portal.
  • The Test Result Server of the Corona Warn App (repository: cwa-testresult-server) receives the results from laboratories and delivers these results to the app via the verification-server.

So, this component receives the test results of COVID-19 Tests from connected laboratories. The information submitted by the laboratories contains an UUID and the result.

Development

This component can be locally build in order to test the functionality of the interfaces and verify the concepts it is build upon.
There are two ways to build:

  • Maven build - to run this component as spring application on your local machine
  • Docker build - to run it as docker container build from the provided docker build file

Prerequisites

Open JDK 11
Maven
(optional): Docker

Build

Whether you cloned or downloaded the 'zipped' sources you will either find the sources in the chosen checkout-directory or get a zip file with the source code, which you can expand to a folder of your choice.

In either case open a terminal pointing to the directory you put the sources in. The local build process is described afterwards depending on the way you choose.

Maven based build

For actively take part on the development this is the way you should choose.
Please check, whether following prerequisites are fulfilled

is installed on your machine.
You can then open a terminal pointing to the root directory of the verification server and do the following:

mvn package
java -jar target/cwa-testresult-server-*.jar  

The verification server will start up and run locally on your machine available on port 8080.

Docker based build

We recommend that you first check the prerequisites to ensure that

is installed on you machine

On the commandline do the following:

docker build -f|--file <path to dockerfile>  -t <imagename>  <path-to-testresultserver-root>
docker run -p 127.0.0.1:8080:8080/tcp -it <imagename>

or simply

docker build --pull --rm -f "Dockerfile" -t cwa-testresultserver "."
docker run -p 127.0.0.1:8080:8080/tcp -it cwa-testresultserver

if you are in the root of the checked out repository.
The docker image will then run on your local machine on port 8080 assuming you configured docker for shared network mode.

API Documentation

Along with the application there comes an OpenApi Doc based swagger documentation which you can access in your web browser, when the test result server applications runs:

<base-url>/api/swagger

Which results in the following URL on your local machine: http://localhost:8080/api/swagger

Working Language

We are building this application for Germany. We want to be as open and transparent as possible, also to interested parties in the global developer community who do not speak German. Later on this application might also serve as a template for other projects outside of Germany. For these reasons, we decided to apply English as the primary project language.

Consequently, all content will be made available primarily in English. We also ask all interested people to use English as language to create issues, in their code (comments, documentation etc.) and when you send requests to us. The application itself, documentation and all end-user facing content will - of course - be made available in German (and probably other languages as well). We also try to make some developer documentation available in German, but please understand that focussing on the Lingua Franca of the global developer community makes the development of this application as efficient as possible.

Documentation

The full documentation for the Corona-Warn-App can be found in the cwa-documentation repository. The documentation repository contains technical documents, architecture information, and white papers related to this implementation.

Support and Feedback

The following channels are available for discussions, feedback, and support requests:

Type Channel
General Discussion
Concept Feedback
Test Result Server Issue
Other Requests

How to Contribute

Contribution and feedback is encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our Contribution Guidelines. By participating in this project, you agree to abide by its Code of Conduct at all times.

Contributors

The German government has asked SAP AG and Deutsche Telekom AG to develop the Corona-Warn-App for Germany as open source software. Deutsche Telekom is providing the network and mobile technology and will operate and run the backend for the app in a safe, scalable and stable manner. SAP is responsible for the app development, its framework and the underlying platform. Therefore, development teams of SAP and Deutsche Telekom are contributing to this project. At the same time our commitment to open source means that we are enabling -in fact encouraging- all interested parties to contribute and become part of its developer community.

Repositories

A list of all public repositories from the Corona-Warn-App can be found here.

Licensing

Copyright (c) 2020-2023 Deutsche Telekom AG.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the LICENSE for the specific language governing permissions and limitations under the License.

cwa-testresult-server's People

Contributors

alstiefel avatar ascheibal avatar ccfenner avatar ckuelker avatar daniel-eder avatar dependabot[bot] avatar ein-tim avatar f11h avatar felurx avatar jhageste-tsi avatar jhagestedt avatar kreincke avatar mlaue-tech-zz avatar morphyum avatar mschulte-tsi avatar tence avatar tkowark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cwa-testresult-server's Issues

[BSI][0.3.1-alpha] Copy-paste error

Rating: Informational

Description:
It seems like some of the definitions have been copy pasted from other code with some names/comments not correctly beeing adapted to the new environment.

Proof of Concept:

Example:
The entitiy definition of
cwa-testresult-server-0.3.1/src/main/java/app/coronawarn/testresult/TestResultEntity.java
was copied from
cwa-verification-server/src/main/java/app/coronawarn/verification/domain/VerificationTan.java
and TestResultEntity still has the comment: This class represents the TAN - entity.

[BSI][20200527] Usernames/passwords in config/code

Rating: High

Description:

Multiple code and config files include hardcoded credentials.

Proof of Concept:

The following code and config files hold potentially sensitive data (examples are given):

cwa-testresult-server-master/TestResultsService/appsettings.Development.json:

	"LabTestResultsDB": "Server=tcp:80.158.39.182,1433;Initial Catalog=LabResultsDB;Persist Security Info=False;User ID=rdsuser01;Password=[redacted]

cwa-testresult-server-master/TestResultsDB/TestResultsDBContext.cs:25

	//optionsBuilder.UseSqlServer("Server=tcp:labresultsdbsrv.database.windows.net,1433;Initial Catalog=LabResultsDB;Persist Security Info=False;User ID=dbadmin;Password=[redacted];MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;");


cwa-testresult-server-master/TestResultsService/Properties/launchSettings.json:22/32

	"ConnectionStrings__LabTestResultsDB": "Server=tcp:80.158.39.182,1433;Initial Catalog=LabResultsDB;Persist Security Info=False;User ID=rdsuser01;Password=[redacted]

keine Übermittlung des PCR Testergebnis - bei mehreren Tests

Describe the bug

keine Übermittlung des PCR Testergebnis obwohl Testergebnisse vorliegen.
Der "Übermittlungs / Schnittstellen"-Fehler liegt bei mindestens zwei PCR-Tests (Ehepaar) vor.

Expected behaviour

Da das Testergebnis vom Labor nachweislich hochgeladen wurde, muss die Corona-Warn-App das Testergebnis übermitteln und anzeigen. Sonst macht diese Funktion keinen Sinn.

Steps to reproduce the issue

  1. QR Code des PCR-Test erfolgreich eingescannt
  2. Geburtsdatum zur Verifizierung eingegeben
  3. PCR-Test wurde erfolgreich in der App hinterlegt.
  4. Das Labor www.labor-froreich.de hat am selben Tag den Test fertiggestellt und das Ergebnis hochgeladen.
  5. Selbst drei Tage später zeigt die App das Ergebnis nicht an, und behautet das kein Testergebnis vorliegt.

Technical details

ID 68258DD18B56C6D92384 des Fehleranalyseprotokoll
CWA Log 2021-11-15 20_41_49.281.zip

Add time stamp to test result

Current Implementation

Test representation as hash (Hashed GUID) and test result are send from the quicktest backend when the test result is confirmed.

Suggested Enhancement

Pass a timestamp from the Quicktest backend when the test result is confirmed. This timestamp can be considered as confirmation time of the test. The test reuslt shall get an additional attribute timestamp, which is the time of generating the QRCode in the quick-test front end (timestamp value in QRCode) at test registration and will be updated with the time of confirmation at the time the test result is given.

Interface

The existing REST payload shall be enhanced by a key "sc": number containing the time of confirmation in UNIX epoch format. This timestamp shall be mapped to the entity resultDate

Expected Benefits

As Antigen Tests give prove for certain activities (shop visits etc) and are valid for a given period of time, the exact time of the proof is crucial.

Android CwaWebSecurityException - Server Maintenance on 2021-06-18?

Dear server devs,

from time to time in the past year some CWA Android users experience a Web Security Exception, which looks like the certificate chain of the backend servers looks invalid for the client. See: corona-warn-app/cwa-app-android#968
While for many users this is only a temporary problem that recovers itself automatically after a while, other users were reporting, that in result some Android OS versions deactivate the root certificate T-Telesec Global Root Class 2 permanently, which makes it necessary to manually re-activate that certificate, what can be quite tricky for non-tech savvy users.
I was suspecting, that server maintenance could cause the problem, when after the maintenance the server is re-initialising and for a (probably very short) time the certificate chain (root/intermediate/server) is still not (fully) available to be delivered to the client. (1 second downtime could affect > 100 Android users, given equal distribution of client requests over the day)

I would be happy if you could confirm whether there was any maintenance going on on
Friday, 2021-06-18, between 18:50 CEST and 19:45 CEST ? That could help to find out where the issue originates.

Any idea from your side what could causethe problems described in corona-warn-app/cwa-app-android#968 would be highly appreciated.

Thank you in advance, kind regards,
v.

Add LabId Parameter to TR Up- and Download

Current Implementation

When uploading a TR the origin is not saved.

Suggested Enhancement

Add the parameter "labId" to uploaded TR to save the ID of the laboratory.
Also add this information when TR is downloaded by verification-server.

Expected Benefits

The labId is needed to create DCC.

[BSI][20200527] Certificate Checks are disabled

Rating: Medium

Description:
The client certificate check in the testresult API is currently disabled (code commented out and always returns 'true').

Proof of Concept:

From cwa-testresult-server-master/TestResultsService/ApiClientCertificateValidationService.cs:
public class ApiClientCertificateValidationService
{
public bool ValidateCertificate(X509Certificate2 clientCertificate)
{
//var cert = new X509Certificate2(Path.Combine("sts_dev_cert.pfx"), "1234");
//if (clientCertificate.Thumbprint == cert.Thumbprint)
//{
// return true;
//}

        return true;
    }
}

What does "Error 500" mean?

Your Question

After registering a PCR test in the app and waiting for some hours, a Twitter user is now seeing this:
FDvjs5vXIAAUsVz

What does Error 500 mean? Will the user still receive their test result via the CWA?

[BSI][20200527] Potential Missing Authentication

Rating: High

Description:

Authorization is disabled for all 'api/v1/app/' endpoints. This might be on purpose but has to be double checked.

Proof of Concept:

This code excerpt from /cwa-testresult-server-master/TestResultsService/Controllers/AppApiController.cs shows, that the '[Authorize' tag is commented out:

[Route("api/v1/app")]
[ApiController]
[Produces("application/json")]
[ApiExplorerSettings(GroupName = "app")]
//[Authorize]

Hash of GUID should not be case sensitive

When using the hexadecimal hash of a GUID as a key, the TestResultServer should always use upper case or always use lower case. To avoid duplicate entries for the same GUID, and to avoid false negative lookups. I would suggest enforcing it here, and possibly in addition normalizing the case closer to where the request enters the TestResultServer so callers do not need to care.

Reducing database access with saving entities

Current Implementation

See the current implementation insertOrUpdate. If no TestResultEntity is beeing found in the database, the orElseGet(...) gets triggered and a new TestResultEntity is beeing saved.
After following the execution inside this function the just created entity is beeing saved again. Keep in mind that database access is expensive.

Mentioned in #57.

Suggested Enhancement

Check if TestResultEntity was beeing created and after that skip or exit function. Another approach is to check if two objects of TestResultEntity are equal. If so, do not save to database and skip or exit function.

Expected Benefits

Improved performance (even if it small) with less database access and quicker response time for the client.

feat: accessing vault directly instead of OpenShift secrets

Feature description

The secrets shall be read directly from the vault

Problem and motivation

Credentials and certificates are stored in vault and are exported to Openshift secrets periodicly. The use of secrets shall be prevented in favor to direcly read the properties from a vault.

[BSI][20200603]Missing certificate checks

Rating: high

The testresult insertion point does not seem to be authenticated.
According to the docu there should be JWT-Token based auth.
We couldn't find an implementation of it yet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.