Code Monkey home page Code Monkey logo

cwa-verification-portal's Introduction

Corona-Warn-App Verification Portal

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 verification portal for the Corona-Warn-App.

Status

ci quality gate coverage bugs

About this component

In the world of the Corona Warn App the Verification Portal allows hotline employees to generate teleTANs which are used by users of the mobile app to upload their diagnostic keys. 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.

In other words: For all People who are willing to join the tracing process and have a positive test result, there will be a service hotline one can call to get a temporary Transaction Authentication Number (TAN) to join the process. The agents at the service hotline will ask the caller some questions to verify his status and then provide one with a TAN. This serves as an interim solution until all laboratories have enabled the QR-code process and as a second option for users who did not choose to receive the test result through the app.

This component provides a simple user interface for the service agents to generate the temporary TeleTAN. For security reasons it cooperates with an Identity and Access Management (IAM) component using OpenID Connect standard protocols with additional 2-Factor-Authentication (2FA) based on one-time passwords (OTP). As mentioned above, the IAM component is hosted in another project of the corona-warn-app org.

Development

This component can be built locally 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-verification-portal-0.0.1-SNAPSHOT.jar  

The verificationportal will start up and run locally on your machine available on port 8081. Please keep in mind, that you need another component [cwa-verification-iam] the get this running in a sensable manner.

Docker based build

We recommend that you first check the prerequisites to ensure that

is installed on your machine.

On the command line do the following:

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

or simply

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

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

Code of Conduct

This project has adopted the Contributor Covenant in version 2.0 as our code of conduct. Please see the details in our CODE_OF_CONDUCT.md. All contributors must abide by the code of conduct.

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
Verification Portal 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-2022 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-verification-portal's People

Contributors

alstiefel avatar ascheibal avatar bjoernkw avatar bugbuster1701 avatar cfritzsche avatar christianfirmenich avatar ckuelker avatar daniel-eder avatar dfischer-tech avatar ein-tim avatar f11h avatar hmontazeri avatar jhagestedt avatar jonico avatar lbenthins avatar mlaue-tech-zz avatar mschulte-tsi avatar ra-jo-cosee avatar tence avatar tkowark avatar weissms68 avatar zoellner 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  avatar

Watchers

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

cwa-verification-portal's Issues

Please provide a way to setup keycloak environment for testing

The verification portal seems to depend on keycloak as an authentication provider. It would be helpful for development if there was an easy way to start up a preconfigured local keycloak instance.
Could you maybe provide a docker compose file to start up a dockerized keycloak instance? Or at least document the necessary configuration steps for setting up keycloak. Thank you!

Add increase test coverage

Current Implementation

Current version does not contain any running unit/integration Test.

Suggested Enhancement

Write unit + integration tests.

Expected Benefits

Verify correct behavior of functionality.

Security Risk : teleTan-Creation needs to be logged with hotline agent name

Describe the bug

Security risks from inside an organisation are often underestimated. Let's see how this may be a problem for the Corona app.

Quote from https://www.chip.de/news/Corona-App-steht-kurz-vor-dem-Start-Scheitert-das-Warn-Tool-an-einem-einfachen-Problem_182639402.html
_

Knapp 1.000 Anrufe soll die Hotline pro Tag bewältigen können. Nach Spiegel-Informationen sollen bereits Probeläufe gezeigt haben, dass das System funktioniert. Das Call-Center betreibt ein externen Dienstleister. Ob dieser in Deutschland sitzt, ist unklar.

_

A hotline agent currently is a trusted person who may create teleTans. Problem : is it correct to trust him if one even doesn't know if he works in Germany, Croatia, India or even a prison in the US?

Currently a hotline agent can create teleTans without the knowledge of a supervisor. It is not even possible to trace who created which teleTan.

Expected behaviour

It is easy to create teleTans that could be misused. Don't ask for a misuse scenario - as long as it is possible there will be an invalid use.

Possible Fix

Log teleTan creation with hotline agent id and date/time.

See also CWA_Documentation issue #129

teleTAN without positive test?

The README.MD says:

In other words: For all People who are willing to join the tracing process, but have not been tested by one of the participating laboratories, there will be a service hotline one can call to get a temporary Transaction Authentication Number (TAN) to join the process. The agents at the service hotline will ask the caller some questions to verify his status and then provide one with a TAN.

To me that sounds as if teleTANs can be generated by hotline users without a positive test to aid the tracing process.

While I welcome this feature, I am confused as it was declared out of scope so far in cwa-documentation.

If this is part of the first release, great! Will the teleTAN without test be of a separate kind as other teleTANs? If yes, that process is missing in the solution architecture document. If not, how would a second-degree contact be able to differentiate between a real exposure notification and a notification for contact tracing with confirmed test?

If this paragraph does not talk about teleTANs before positive test or second-degree contact tracing, what else does it mean?

[BSI][20200609] Cross-Site-Request Forgery

Rating: High

Description:
The application is vulnerable to Cross-Site Request Forgery (CSRF/XSRF)
attacks.

A CSRF attack leverages the fact that in many cases browser requests
automatically include any credentials associated with the requested site, such
as the session cookies. This leaves no way for the application to distinguish
between forged and legitimate requests. Attacks typically target requests that
change the state of victim's data on the server (e.g. change password and
email address functionalities). The attack can be performed by sending a URL
to a victim. Visiting this URL will then execute an action on behalf of the
user.

In this case, a CSRF attack can be used to generate TeleTANs on behalf of a
logged in user. The nature of a CSRF attack does not allow the attacker to
retrieve the generated TANs. However, as the generation of TeleTANs is not
rate limited, an attacker can force a user, using a CSRF attack, to create a
large number of TeleTANs. This results in a strongly decreased search space
for the available TeleTANs. In a second step, this circumstance simplifies
brute-force attacks on a valid TeleTAN. The more TeleTANs are created, the
higher the probability to brute-force a correct one.

A recent change in the code adapted the requests verbs for the TeleTAN
retrieval from GET to POST requests, with the POST requests implementing CSRF
protection. However, this change was only applied on the client-side, not on
the server side. The server still accepts GET requests for generating a
TeleTAN. Therefore, this issue can be solved by disabling the GET verb on
these requests (see

@RequestMapping(value = ROUTE_TELETAN, method = {RequestMethod.GET, RequestMethod.POST})
).

Proof of Concept:
The following request-response pair shows that the TeleTAN can be obtained via a GET request:

GET /cwa/teletan HTTP/1.1
Host: verification-portal-0cebc62a.coronawarn.app
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://verification-server/cwa/start
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
Connection: close
Cookie: JSESSIONID=[REDACTED]; OAuth_Token_Request_State=[REDACTED]
Upgrade-Insecure-Requests: 1

HTTP/1.1 200
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-Frame-Options: DENY
Content-Type: text/html;charset=UTF-8
Content-Language: en-US
Date: Mon, 08 Jun 2020 18:15:03 GMT
Connection: close
Content-Length: 1948

[...]

Die neue TeleTAN lautet
EQ4VYE85M3

An attacker can craft, for example, a form that triggers this request on behalf of a user as follows:

<html>
  <body>
    <form action="https://verification-server/cwa/teletan">
      <input type="submit" value="Submit request" />
    </form>
  </body>
</html>

Session validation in env with several Pods does not work

Problem description:

When a user logs in (via the cwa-verification-iam), the cwa-verification-portal creates a session which is stored:

  • in the cwa-verification-portal's session store (this is handles by Spring Boot)
  • and in the user's browser as a cookie (SESSION).

For the further HTTP requests (e.g., generate TeleTan), the cwa-verification-portal verifies the created session, which is sent along with the requests. The cwa-verification-portal does not redirects the user to the cwa-verification-iam for authentication and authorization, unless the session has expired or is invalid.

The above described scenario works well, when only one instance (Pod) of the cwa-verification-portal is active in the OpenShift environment. As soon as more Pods become active, a session created by one Pod can end up in a different Pod. This causes the cwa-verification-portal redirecting the user to the cwa-verification-iam for authentication, since the session is invalid for that Pod. This can trigger an endless loop. Moreover, when loading resources such as images or CSS stylesheets, the redirection to the cwa-verification-iam violates Content-Security-Policy default-src 'self', causing the browser not loading the requested resources.

Possible Solution:

There are several approaches (e.g., sticky sessions, stateless application, session container) that can be implemented. The following links provides some insights to solve this problem:

https://www.haproxy.com/blog/load-balancing-affinity-persistence-sticky-sessions-what-you-need-to-know/

https://developers.redhat.com/blog/2018/05/04/externalized-http-session-in-openshift-3-9/

https://golb.hplar.ch/2019/05/stateless.html

[BSI][20200609] No Password Change Functionality

Rating: Low

Description:
The Verification Portal does not offer the possibility for a user to change
their password. This limits the user to the password they initially chose. In
case a user's password leaks in any way, the affected user will not be able to
change the password.

Integrate Gesundheitsamt Köln

Feature description

Additional to the Hotline the Gesundheitsamt Köln shall be enabled to access the Verification Portal to be able to generate teleTANs

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.