├── .gitignore
├── .mvn
└── wrapper
│ ├── maven-wrapper.jar
│ └── maven-wrapper.properties
├── exposure-notification
└── src
│ ├── test
│ ├── resources
│ │ ├── application-test.yml
│ │ ├── sample_diagnosis_key_file.zip
│ │ └── application-nodb.yml
│ └── java
│ │ └── fi
│ │ └── thl
│ │ └── covid19
│ │ └── exposurenotification
│ │ ├── batch
│ │ ├── ExportIntervalsTest.java
│ │ ├── BatchIdTest.java
│ │ ├── SigningTest.java
│ │ └── BatchFileServiceIT.java
│ │ ├── configuration
│ │ └── ConfigurationDaoIT.java
│ │ ├── efgs
│ │ ├── CallbackControllerEnabledTest.java
│ │ ├── CallbackControllerDisabledTest.java
│ │ └── DsosMapperUtilTest.java
│ │ ├── error
│ │ └── TestController.java
│ │ └── diagnosiskey
│ │ ├── TransmissionRiskBucketsTest.java
│ │ └── IntervalNumberTest.java
│ └── main
│ ├── resources
│ ├── db
│ │ └── migration
│ │ │ ├── V03.05__add_symptoms_exists.sql
│ │ │ ├── V03.03__add_visited_countries_to_configuration.sql
│ │ │ ├── V02.02__alter_statistics_table.sql
│ │ │ ├── V02.01__create_statistics_tables.sql
│ │ │ ├── V04.02__diagnosis_key_v2.sql
│ │ │ ├── V01.02__token_verification.sql
│ │ │ ├── V03.04__alter_inbound_operation.sql
│ │ │ ├── V04.03__end_of_life_configuration.sql
│ │ │ ├── R__0_diagnosis_key_interval_index.sql
│ │ │ ├── V01.01__diagnosis_key.sql
│ │ │ ├── V02.03__alter_configuration_table.sql
│ │ │ ├── V03.02__alter_diagnosis_key.sql
│ │ │ ├── V01.03__exposure_configuration.sql
│ │ │ ├── R__2_create_efgs_indexes.sql
│ │ │ ├── V03.01__create_efgs_operation_tables.sql
│ │ │ ├── V04.01__exposure_configuration_v2.sql
│ │ │ ├── R__1_default_exposure_configuration.sql
│ │ │ └── R__3_default_v2_exposure_configuration.sql
│ ├── logback-dev.xml
│ ├── logback.xml
│ ├── application-dev.yml
│ └── application.yml
│ ├── java
│ └── fi
│ │ └── thl
│ │ └── covid19
│ │ └── exposurenotification
│ │ ├── tokenverification
│ │ ├── PublishTokenVerificationService.java
│ │ ├── PublishTokenVerification.java
│ │ └── PublishTokenVerificationServiceRest.java
│ │ ├── error
│ │ ├── InputValidationException.java
│ │ ├── TokenValidationException.java
│ │ ├── BatchNotFoundException.java
│ │ ├── RestTemplateErrorHandler.java
│ │ ├── ApiError.java
│ │ ├── CorrelationIdInterceptor.java
│ │ └── DbSchemaCheckHealthIndicator.java
│ │ ├── efgs
│ │ ├── util
│ │ │ ├── CommonConst.java
│ │ │ └── DummyKeyGeneratorUtil.java
│ │ ├── signing
│ │ │ ├── FederationGatewaySigning.java
│ │ │ ├── SigningUtil.java
│ │ │ └── FederationGatewaySigningImpl.java
│ │ ├── entity
│ │ │ ├── Callback.java
│ │ │ ├── UploadResponseEntity.java
│ │ │ ├── DownloadData.java
│ │ │ ├── OutboundOperation.java
│ │ │ ├── InboundOperation.java
│ │ │ └── AuditEntry.java
│ │ ├── IntegrationErrorMeterConfiguration.java
│ │ ├── CallbackController.java
│ │ └── scheduled
│ │ │ └── FederationGatewaySyncProcessor.java
│ │ ├── diagnosiskey
│ │ ├── v1
│ │ │ ├── CurrentBatch.java
│ │ │ ├── BatchList.java
│ │ │ ├── Status.java
│ │ │ ├── DiagnosisPublishRequest.java
│ │ │ └── TemporaryExposureKeyRequest.java
│ │ ├── TransmissionRiskBuckets.java
│ │ └── IntervalNumber.java
│ │ ├── configuration
│ │ ├── v2
│ │ │ ├── EndOfLifeStatistic.java
│ │ │ ├── AppConfiguration.java
│ │ │ ├── ExposureConfigurationV2Controller.java
│ │ │ └── ExposureConfigurationV2.java
│ │ ├── ConfigurationService.java
│ │ └── v1
│ │ │ ├── AppConfiguration.java
│ │ │ └── ExposureConfigurationController.java
│ │ ├── WebMvcConfiguration.java
│ │ ├── batch
│ │ ├── SignatureConfig.java
│ │ ├── BatchFile.java
│ │ ├── BatchMetadata.java
│ │ ├── BatchIntervals.java
│ │ ├── Signing.java
│ │ └── BatchId.java
│ │ ├── ExposureNotificationApplication.java
│ │ ├── FederationGatewayRestClientProperties.java
│ │ ├── MaintenanceService.java
│ │ └── FederationGatewayRestClientConfiguration.java
│ └── proto
│ ├── exposure-sig.proto
│ ├── exposure-efgs.proto
│ └── exposure-bin.proto
├── documentation
├── generated_images
│ ├── efgs_inbound.png
│ ├── efgs_outbound.png
│ └── publish_diagnosis_keys.png
└── plantuml
│ ├── generate_plantuml.sh
│ ├── efgs_outbound.pu
│ ├── efgs_inbound.pu
│ └── publish_diagnosis_keys.pu
├── .github
├── docker-slack
│ ├── Dockerfile
│ ├── action.yml
│ └── entrypoint.sh
├── docker-notify-email
│ ├── Dockerfile
│ ├── action.yml
│ └── entrypoint.sh
├── ISSUE_TEMPLATE
│ ├── bug-or-problem-report.md
│ ├── security_issue.md
│ └── feature_request.md
└── workflows
│ ├── dependency-scan.yml
│ ├── release-dependency-scan.yml
│ ├── maven.yml
│ └── codeql-analysis.yml
├── publish-token
└── src
│ ├── main
│ ├── resources
│ │ ├── db
│ │ │ └── migration
│ │ │ │ ├── V02.02__add_symptoms_exists.sql
│ │ │ │ ├── R__0_publish_token_origin_index.sql
│ │ │ │ ├── V02.01__create_statistics_tables.sql
│ │ │ │ └── V01.01__publish_token.sql
│ │ ├── application-nodb.yml
│ │ ├── logback-dev.xml
│ │ ├── application-dev.yml
│ │ ├── logback.xml
│ │ └── application.yml
│ └── java
│ │ └── fi
│ │ └── thl
│ │ └── covid19
│ │ └── publishtoken
│ │ ├── error
│ │ ├── InputValidationException.java
│ │ ├── SmsGatewayException.java
│ │ ├── InputValidationValidateOnlyException.java
│ │ ├── ApiError.java
│ │ ├── CorrelationIdInterceptor.java
│ │ └── DbSchemaCheckHealthIndicator.java
│ │ ├── generation
│ │ └── v1
│ │ │ ├── PublishTokenList.java
│ │ │ ├── PublishToken.java
│ │ │ ├── PublishTokenGenerationRequest.java
│ │ │ └── PublishTokenGenerationController.java
│ │ ├── sms
│ │ ├── SmsPayload.java
│ │ ├── SmsConfig.java
│ │ └── SmsService.java
│ │ ├── verification
│ │ └── v1
│ │ │ ├── PublishTokenVerification.java
│ │ │ └── PublishTokenVerificationController.java
│ │ ├── PublishTokenApplication.java
│ │ ├── WebMvcConfiguration.java
│ │ ├── ApplicationConfiguration.java
│ │ ├── MaintenanceService.java
│ │ ├── Validation.java
│ │ └── PublishTokenService.java
│ └── test
│ └── java
│ └── fi
│ └── thl
│ └── covid19
│ └── publishtoken
│ ├── error
│ └── TestController.java
│ ├── PublishTokenDaoIT.java
│ └── SMSServiceTestIT.java
├── CHANGELOG.md
├── AUTHORS.md
├── pom.xml
├── pull_request_template.md
├── SECURITY.md
├── make_release.sh
├── owasp_suppressions.xml
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !**/src/main/**
3 | !**/src/test/**
4 | *.iml
5 | .idea
6 | .DS_Store
7 |
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/THLfi/koronavilkku-backend/HEAD/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/exposure-notification/src/test/resources/application-test.yml:
--------------------------------------------------------------------------------
1 | covid19:
2 | diagnosis:
3 | data-cache:
4 | enabled: false
5 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/resources/db/migration/V03.05__add_symptoms_exists.sql:
--------------------------------------------------------------------------------
1 | alter table en.diagnosis_key add symptoms_exist boolean;
2 |
--------------------------------------------------------------------------------
/documentation/generated_images/efgs_inbound.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/THLfi/koronavilkku-backend/HEAD/documentation/generated_images/efgs_inbound.png
--------------------------------------------------------------------------------
/documentation/generated_images/efgs_outbound.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/THLfi/koronavilkku-backend/HEAD/documentation/generated_images/efgs_outbound.png
--------------------------------------------------------------------------------
/documentation/generated_images/publish_diagnosis_keys.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/THLfi/koronavilkku-backend/HEAD/documentation/generated_images/publish_diagnosis_keys.png
--------------------------------------------------------------------------------
/.github/docker-slack/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu:20.04
2 |
3 | RUN apt update && apt install -y curl jq
4 |
5 | COPY entrypoint.sh /entrypoint.sh
6 | ENTRYPOINT ["/entrypoint.sh"]
7 |
--------------------------------------------------------------------------------
/.github/docker-notify-email/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu:20.04
2 |
3 | RUN apt update && apt install -y curl jq
4 |
5 | COPY entrypoint.sh /entrypoint.sh
6 | ENTRYPOINT ["/entrypoint.sh"]
7 |
--------------------------------------------------------------------------------
/exposure-notification/src/test/resources/sample_diagnosis_key_file.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/THLfi/koronavilkku-backend/HEAD/exposure-notification/src/test/resources/sample_diagnosis_key_file.zip
--------------------------------------------------------------------------------
/publish-token/src/main/resources/db/migration/V02.02__add_symptoms_exists.sql:
--------------------------------------------------------------------------------
1 | alter table pt.publish_token add symptoms_exist boolean;
2 | alter table pt.stats_token_create add symptoms_exist boolean;
3 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/resources/db/migration/V03.03__add_visited_countries_to_configuration.sql:
--------------------------------------------------------------------------------
1 | alter table en.exposure_configuration add participating_countries varchar(2)[] not null default '{}';
2 |
--------------------------------------------------------------------------------
/publish-token/src/main/resources/application-nodb.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | autoconfigure:
3 | exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
4 | flyway:
5 | enabled: false
6 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/resources/db/migration/V02.02__alter_statistics_table.sql:
--------------------------------------------------------------------------------
1 | alter table en.stats_report_keys add total_key_count bigint;
2 | alter table en.stats_report_keys add exported_key_count bigint;
3 |
--------------------------------------------------------------------------------
/exposure-notification/src/test/resources/application-nodb.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | autoconfigure:
3 | exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
4 | flyway:
5 | enabled: false
6 |
--------------------------------------------------------------------------------
/publish-token/src/main/resources/db/migration/R__0_publish_token_origin_index.sql:
--------------------------------------------------------------------------------
1 | drop index if exists pt.publish_token_origin;
2 | create index publish_token_origin on pt.publish_token(origin_service, origin_user);
3 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/resources/db/migration/V02.01__create_statistics_tables.sql:
--------------------------------------------------------------------------------
1 | create table en.stats_report_keys (
2 | id bigint primary key generated always as identity,
3 | reported_at timestamptz not null
4 | );
5 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/resources/db/migration/V04.02__diagnosis_key_v2.sql:
--------------------------------------------------------------------------------
1 | alter table en.diagnosis_key add submission_interval_v2 int not null default 0;
2 | alter table en.diagnosis_key alter column submission_interval_v2 drop default;
3 |
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
3 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/resources/db/migration/V01.02__token_verification.sql:
--------------------------------------------------------------------------------
1 | create table en.token_verification (
2 | verification_id int primary key,
3 | request_checksum varchar(32),
4 | verification_time timestamptz not null default now()
5 | );
6 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/resources/db/migration/V03.04__alter_inbound_operation.sql:
--------------------------------------------------------------------------------
1 | alter table en.efgs_inbound_operation add keys_count_success int not null default 0;
2 | alter table en.efgs_inbound_operation add keys_count_not_valid int not null default 0;
3 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/resources/db/migration/V04.03__end_of_life_configuration.sql:
--------------------------------------------------------------------------------
1 | alter table en.exposure_configuration_v2 add end_of_life_reached boolean not null default 'false';
2 | alter table en.exposure_configuration_v2 add end_of_life_statistics jsonb not null default '[]';
3 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 | All notable changes to this project will be documented in this file.
3 |
4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6 |
7 | ## Unreleased
8 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/resources/db/migration/R__0_diagnosis_key_interval_index.sql:
--------------------------------------------------------------------------------
1 | drop index if exists en.diagnosis_key_interval;
2 | create index diagnosis_key_interval on en.diagnosis_key(submission_interval);
3 | create index diagnosis_key_interval_v2 on en.diagnosis_key(submission_interval_v2);
4 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/java/fi/thl/covid19/exposurenotification/tokenverification/PublishTokenVerificationService.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.exposurenotification.tokenverification;
2 |
3 | public interface PublishTokenVerificationService {
4 | PublishTokenVerification getVerification(String token);
5 | }
6 |
--------------------------------------------------------------------------------
/publish-token/src/main/java/fi/thl/covid19/publishtoken/error/InputValidationException.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.publishtoken.error;
2 |
3 | public class InputValidationException extends RuntimeException {
4 |
5 | public InputValidationException(String message) {
6 | super(message);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/publish-token/src/main/java/fi/thl/covid19/publishtoken/error/SmsGatewayException.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.publishtoken.error;
2 |
3 | public class SmsGatewayException extends RuntimeException {
4 | public SmsGatewayException() {
5 | super("SMS gateway error. Please try again later.");
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/java/fi/thl/covid19/exposurenotification/error/InputValidationException.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.exposurenotification.error;
2 |
3 | public class InputValidationException extends RuntimeException {
4 | public InputValidationException(String message) {
5 | super(message);
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/resources/db/migration/V01.01__diagnosis_key.sql:
--------------------------------------------------------------------------------
1 | create table en.diagnosis_key (
2 | key_data varchar(30) primary key,
3 | rolling_period int not null,
4 | rolling_start_interval_number int not null,
5 | transmission_risk_level int not null,
6 | submission_interval int not null
7 | );
8 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/java/fi/thl/covid19/exposurenotification/error/TokenValidationException.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.exposurenotification.error;
2 |
3 | public class TokenValidationException extends RuntimeException {
4 | public TokenValidationException() {
5 | super("Publish token not accepted");
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/.github/docker-slack/action.yml:
--------------------------------------------------------------------------------
1 | name: 'thl-slack-notification'
2 | description: 'Simple slack notification action'
3 | inputs:
4 | text:
5 | description: 'Text content to send'
6 | required: true
7 | status:
8 | description: 'Status as text'
9 | required: true
10 | runs:
11 | using: 'docker'
12 | image: 'Dockerfile'
13 |
--------------------------------------------------------------------------------
/publish-token/src/main/java/fi/thl/covid19/publishtoken/error/InputValidationValidateOnlyException.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.publishtoken.error;
2 |
3 | @Deprecated
4 | public class InputValidationValidateOnlyException extends RuntimeException {
5 | public InputValidationValidateOnlyException(String msg) {
6 | super(msg);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/documentation/plantuml/generate_plantuml.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # This script generates images from plantuml diagram definitions.
5 | #
6 |
7 | cd "$(dirname "$0")" || exit
8 |
9 | for pu_file in ./*.pu
10 | do
11 | echo "Generating image from $pu_file"
12 | java -Djava.awt.headless=true -jar /opt/plantuml.jar -o ../generated_images $pu_file
13 | done
14 |
--------------------------------------------------------------------------------
/publish-token/src/main/resources/db/migration/V02.01__create_statistics_tables.sql:
--------------------------------------------------------------------------------
1 | create table pt.stats_token_create (
2 | id bigint primary key generated always as identity,
3 | created_at timestamptz not null
4 | );
5 |
6 | create table pt.stats_sms_send (
7 | id bigint primary key generated always as identity,
8 | sent_at timestamptz not null
9 | );
10 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/java/fi/thl/covid19/exposurenotification/efgs/util/CommonConst.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.exposurenotification.efgs.util;
2 |
3 | public class CommonConst {
4 | public enum EfgsOperationState {STARTED, FINISHED, ERROR}
5 |
6 | public static final long STALLED_MIN_AGE_IN_MINUTES = 10;
7 | public static final int MAX_RETRY_COUNT = 3;
8 | }
9 |
--------------------------------------------------------------------------------
/publish-token/src/main/resources/logback-dev.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.github/docker-notify-email/action.yml:
--------------------------------------------------------------------------------
1 | name: 'thl-email-notification'
2 | description: 'Simple email notification action'
3 | inputs:
4 | status:
5 | description: 'Status as text'
6 | required: true
7 | text:
8 | description: 'Custom text which will be appended to email template'
9 | required: false
10 | default: ''
11 | runs:
12 | using: 'docker'
13 | image: 'Dockerfile'
14 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/resources/logback-dev.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/java/fi/thl/covid19/exposurenotification/diagnosiskey/v1/CurrentBatch.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.exposurenotification.diagnosiskey.v1;
2 |
3 | import fi.thl.covid19.exposurenotification.batch.BatchId;
4 |
5 | public class CurrentBatch {
6 | public final String current;
7 |
8 | public CurrentBatch(BatchId id) {
9 | this.current = id.toString();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/publish-token/src/main/resources/db/migration/V01.01__publish_token.sql:
--------------------------------------------------------------------------------
1 | create table pt.publish_token (
2 | id int primary key generated always as identity,
3 | token varchar(20) not null unique,
4 | created_at timestamptz not null,
5 | valid_through timestamptz not null,
6 | symptoms_onset date not null,
7 | origin_service varchar(100) not null,
8 | origin_user varchar(50) not null
9 | );
10 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/java/fi/thl/covid19/exposurenotification/error/BatchNotFoundException.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.exposurenotification.error;
2 |
3 | import fi.thl.covid19.exposurenotification.batch.BatchId;
4 |
5 | public class BatchNotFoundException extends RuntimeException {
6 | public BatchNotFoundException(BatchId batchId) {
7 | super("Batch not available: id=" + batchId);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/java/fi/thl/covid19/exposurenotification/efgs/signing/FederationGatewaySigning.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.exposurenotification.efgs.signing;
2 |
3 | import fi.thl.covid19.proto.EfgsProto;
4 |
5 | import java.security.cert.X509Certificate;
6 |
7 | public interface FederationGatewaySigning {
8 |
9 | String sign(final EfgsProto.DiagnosisKeyBatch data);
10 | X509Certificate getTrustAnchor();
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/java/fi/thl/covid19/exposurenotification/error/RestTemplateErrorHandler.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.exposurenotification.error;
2 |
3 | import org.springframework.stereotype.Component;
4 | import org.springframework.web.client.DefaultResponseErrorHandler;
5 |
6 | @Component
7 | public class RestTemplateErrorHandler extends DefaultResponseErrorHandler {
8 | public RestTemplateErrorHandler() {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/publish-token/src/main/java/fi/thl/covid19/publishtoken/generation/v1/PublishTokenList.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.publishtoken.generation.v1;
2 |
3 | import java.util.List;
4 |
5 | import static java.util.Objects.requireNonNull;
6 |
7 | public class PublishTokenList {
8 | public final List publishTokens;
9 |
10 | public PublishTokenList(List publishTokens) {
11 | this.publishTokens = requireNonNull(publishTokens);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug-or-problem-report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug or problem report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug or problem**
11 | A clear and concise description of what the bug or problem is.
12 |
13 | **Expected behavior**
14 | A clear and concise description of what you expected to happen.
15 |
16 | **Additional context**
17 | Add any other context about the problem here.
18 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/resources/db/migration/V02.03__alter_configuration_table.sql:
--------------------------------------------------------------------------------
1 | alter table en.exposure_configuration add duration_at_attenuation_weights decimal(3,2) array[3] not null default '{ 1.0, 0.5, 0.0 }';
2 | alter table en.exposure_configuration alter column duration_at_attenuation_weights drop default;
3 | alter table en.exposure_configuration add exposure_risk_duration int not null default 15;
4 | alter table en.exposure_configuration alter column exposure_risk_duration drop default;
5 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/java/fi/thl/covid19/exposurenotification/efgs/entity/Callback.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.exposurenotification.efgs.entity;
2 |
3 | import static java.util.Objects.requireNonNull;
4 |
5 | public class Callback {
6 |
7 | public final String callbackId;
8 | public final String url;
9 |
10 | public Callback(String callbackId, String url) {
11 | this.callbackId = requireNonNull(callbackId);
12 | this.url = requireNonNull(url);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/documentation/plantuml/efgs_outbound.pu:
--------------------------------------------------------------------------------
1 | @startuml
2 |
3 | state OUTBOUND {
4 | [*] --> RECEIVED
5 | RECEIVED : Stored in db
6 | RECEIVED : No operation created yet
7 | RECEIVED --> STARTED
8 | STARTED --> FINISHED
9 | STARTED --> ERROR
10 | STARTED : Efgs sync timestamp updated in db
11 | ERROR --> FINISHED
12 | ERROR --> ERROR
13 | ERROR : Retry until max retries reached
14 | FINISHED : Number of keys sent stored to db
15 | FINISHED --> [*]
16 | ERROR --> [*]
17 | }
18 | @enduml
19 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/resources/db/migration/V03.02__alter_diagnosis_key.sql:
--------------------------------------------------------------------------------
1 | alter table en.diagnosis_key add origin varchar(2) not null default 'FI';
2 | alter table en.diagnosis_key add visited_countries varchar(2)[] not null default '{}';
3 | alter table en.diagnosis_key add days_since_onset_of_symptoms int;
4 | alter table en.diagnosis_key add consent_to_share boolean not null default 'false';
5 | alter table en.diagnosis_key add efgs_sync timestamptz;
6 | alter table en.diagnosis_key add retry_count int not null default 0;
7 |
8 |
--------------------------------------------------------------------------------
/publish-token/src/main/resources/application-dev.yml:
--------------------------------------------------------------------------------
1 | logging:
2 | config: src/main/resources/logback-dev.xml
3 |
4 | server:
5 | port: ${PT_SERVER_PORT:8081}
6 |
7 | management:
8 | server:
9 | port: ${PT_MANAGEMENT_SERVER_PORT:9081}
10 |
11 | spring:
12 | datasource:
13 | url: "${PT_DATABASE_URL:jdbc:postgresql://localhost:5433/exposure-notification}"
14 | username: "${PT_DATABASE_USERNAME:devserver}"
15 | password: "${PT_DATABASE_PASSWORD:devserver-password}"
16 | flyway:
17 | clean-on-validation-error: true
18 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/security_issue.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Security issue
3 | about: Report a security issue
4 | title: ''
5 | labels: security
6 | assignees: ''
7 |
8 | ---
9 |
10 | ## Reporting a Vulnerability
11 |
12 | Please **DO NOT** file a public issue, instead send your report privately to
13 | koronavilkku-security@solita.fi
14 |
15 | Security reports are greatly appreciated and we will publicly thank you for it,
16 | although we keep your name confidential if you request it.
17 |
18 | Reported vulnerabilities will be analyzed swiftly.
19 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/resources/db/migration/V01.03__exposure_configuration.sql:
--------------------------------------------------------------------------------
1 | create table en.exposure_configuration (
2 | version int primary key generated always as identity,
3 | minimum_risk_score int not null,
4 | attenuation_scores int array[8] not null,
5 | days_since_last_exposure_scores int array[8] not null,
6 | duration_scores int array[8] not null,
7 | transmission_risk_scores int array[8] not null,
8 | duration_at_attenuation_thresholds int array[2] not null,
9 | change_time timestamptz not null default now()
10 | );
11 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/resources/db/migration/R__2_create_efgs_indexes.sql:
--------------------------------------------------------------------------------
1 | drop index if exists en.diagnosis_key_efgs_sync;
2 | create index diagnosis_key_efgs_sync on en.diagnosis_key(efgs_sync, retry_count, consent_to_share);
3 |
4 | drop index if exists en.inbound_operation_updated_at_state;
5 | create index inbound_operation_updated_at_state on en.efgs_inbound_operation(updated_at, state);
6 |
7 | drop index if exists en.outbound_operation_updated_at_state;
8 | create index outbound_operation_updated_at_state on en.efgs_outbound_operation(updated_at, state);
9 |
--------------------------------------------------------------------------------
/publish-token/src/main/java/fi/thl/covid19/publishtoken/sms/SmsPayload.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.publishtoken.sms;
2 |
3 | import java.io.Serializable;
4 | import java.util.Set;
5 |
6 | public class SmsPayload implements Serializable {
7 |
8 | public final String sender;
9 | public final String text;
10 | public final Set destination;
11 |
12 | public SmsPayload(String sender, String text, Set destination) {
13 | this.sender = sender;
14 | this.text = text;
15 | this.destination = destination;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/publish-token/src/main/java/fi/thl/covid19/publishtoken/error/ApiError.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.publishtoken.error;
2 |
3 |
4 | import java.util.Optional;
5 |
6 | import static java.util.Objects.requireNonNull;
7 |
8 | public class ApiError {
9 |
10 | public final String errorId;
11 | public final int code;
12 | public final Optional message;
13 |
14 | public ApiError(String errorId, int code, Optional message) {
15 | this.errorId = requireNonNull(errorId);
16 | this.code = code;
17 | this.message = requireNonNull(message);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/java/fi/thl/covid19/exposurenotification/configuration/v2/EndOfLifeStatistic.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.exposurenotification.configuration.v2;
2 |
3 | import com.fasterxml.jackson.annotation.JsonCreator;
4 |
5 | import java.util.Map;
6 |
7 | public class EndOfLifeStatistic {
8 |
9 | public final Map value;
10 | public final Map label;
11 |
12 | @JsonCreator
13 | public EndOfLifeStatistic(Map value, Map label) {
14 | this.value = value;
15 | this.label = label;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/java/fi/thl/covid19/exposurenotification/error/ApiError.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.exposurenotification.error;
2 |
3 |
4 | import java.util.Optional;
5 |
6 | import static java.util.Objects.requireNonNull;
7 |
8 | public class ApiError {
9 |
10 | public final String errorId;
11 | public final int code;
12 | public final Optional message;
13 |
14 | public ApiError(String errorId, int code, Optional message) {
15 | this.errorId = requireNonNull(errorId);
16 | this.code = code;
17 | this.message = requireNonNull(message);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/.github/docker-slack/entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/dash
2 |
3 | set -e
4 |
5 | JOB_STATUS=$(echo "$INPUT_STATUS" | tr '[:lower:]' '[:upper:]')
6 | WORKFLOW_RUN_PATH="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
7 |
8 | PAYLOAD=$(jq -n \
9 | --arg text "*$GITHUB_REPOSITORY: $INPUT_TEXT $JOB_STATUS*." \
10 | --arg wr_path "$WORKFLOW_RUN_PATH" \
11 | '{blocks:[{type:"section",text:{type:"mrkdwn",text: $text}},{type: "divider"},{type:"actions",elements:[{type:"button",text:{type:"plain_text",text:"View run",emoji:true},url:$wr_path}]}]}')
12 |
13 | sh -c "curl -X POST -H 'Content-type: application/json' --data '$PAYLOAD' $SLACK_WEBHOOK_URL"
14 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/java/fi/thl/covid19/exposurenotification/diagnosiskey/v1/BatchList.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.exposurenotification.diagnosiskey.v1;
2 |
3 | import fi.thl.covid19.exposurenotification.batch.BatchId;
4 |
5 | import java.util.List;
6 | import java.util.stream.Collectors;
7 |
8 | import static java.util.Objects.requireNonNull;
9 |
10 | public class BatchList {
11 | public final List batches;
12 |
13 | public BatchList(List batches) {
14 | this.batches = requireNonNull(batches).stream()
15 | .map(BatchId::toString)
16 | .collect(Collectors.toList());
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/exposure-notification/src/main/java/fi/thl/covid19/exposurenotification/efgs/entity/UploadResponseEntity.java:
--------------------------------------------------------------------------------
1 | package fi.thl.covid19.exposurenotification.efgs.entity;
2 |
3 | import org.springframework.http.HttpStatus;
4 |
5 | import java.util.List;
6 | import java.util.Map;
7 | import java.util.Optional;
8 |
9 | public class UploadResponseEntity {
10 |
11 | public final HttpStatus httpStatus;
12 | public final Optional