├── conf
├── config.json
├── logback.xml
├── integ-config.json
├── local-e2e-docker-private-config.json
├── default-config.json
├── docker-config.json
├── local-e2e-docker-public-config.json
├── local-config.json
├── validator-latest-e2e-docker-public-config.json
├── local-e2e-private-config.json
└── local-e2e-public-config.json
├── .github
├── workflows
│ ├── .version
│ ├── check-stable-dependency.yaml
│ ├── build-and-test.yaml
│ ├── vulnerability-scan-failure-notify.yaml
│ └── validate-image.yaml
└── actions
│ └── install_az_cli
│ └── action.yaml
├── js
├── .eslintignore
└── setupJest.js
├── scripts
├── aws
│ ├── pipeline
│ │ ├── EUID_VERSION
│ │ ├── UID2_VERSION
│ │ ├── aws_nitro_eif.sh
│ │ ├── amazonlinux2023.Dockerfile
│ │ └── amazonlinux.Dockerfile
│ ├── config-server
│ │ ├── requirements.txt
│ │ └── app.py
│ ├── requirements.txt
│ ├── eks-pod
│ │ ├── server_al_2023
│ │ │ ├── README.md
│ │ │ └── syslog-ng-server.conf
│ │ ├── README.md
│ │ ├── sockd_eks.conf
│ │ ├── proxies.host.yaml
│ │ └── Dockerfile
│ ├── syslog-ng
│ │ ├── client
│ │ │ └── syslog-ng-core_4.6.0-1_amd64.deb
│ │ ├── server_al_2023
│ │ │ ├── ivykis-0.43-1.amzn2023.x86_64.rpm
│ │ │ ├── libnet-1.2-2.amzn2023.0.2.x86_64.rpm
│ │ │ ├── syslog-ng-4.7.1.104.gcc5a7d9-1.amzn2023.x86_64.rpm
│ │ │ ├── syslog-ng-logrotate-4.7.1.104.gcc5a7d9-1.amzn2023.x86_64.rpm
│ │ │ └── pubkey.gpg
│ │ ├── README.md
│ │ ├── syslog-ng-client.conf
│ │ └── syslog-ng-server.conf
│ ├── logrotate
│ │ ├── logrotate
│ │ ├── logrotateDaily
│ │ └── operator-logrotate.conf
│ ├── uid2-operator-ami
│ │ ├── uid2.pkrvars.hcl
│ │ ├── euid.pkrvars.hcl
│ │ ├── plugins.pkr.hcl
│ │ ├── build.pkr.hcl
│ │ ├── source.pkr.hcl
│ │ └── vars.pkr.hcl
│ ├── sockd.conf
│ ├── proxies.host.yaml
│ ├── proxies.nitro.yaml
│ ├── uid2operator.service
│ ├── conf
│ │ ├── logback-debug.xml
│ │ ├── logback.xml
│ │ ├── euid-integ-config.json
│ │ ├── uid2-integ-config.json
│ │ ├── uid2-prod-config.json
│ │ ├── euid-prod-config.json
│ │ └── default-config.json
│ └── Dockerfile
├── gcp-oidc
│ ├── terraform
│ │ ├── outputs.tf
│ │ ├── terraform.tfvars
│ │ ├── .gitignore
│ │ └── variables.tf
│ ├── requirements.txt
│ ├── conf
│ │ ├── logback.xml
│ │ ├── integ-config.json
│ │ ├── prod-config.json
│ │ └── default-config.json
│ ├── Dockerfile
│ └── generate-deployment-artifacts.sh
├── azure-cc
│ ├── deployment
│ │ ├── gateway.parameters.json
│ │ ├── vault.parameters.json
│ │ ├── generate.py
│ │ ├── vnet.parameters.json
│ │ └── operator.parameters.json
│ ├── conf
│ │ ├── logback.xml
│ │ ├── integ-uid2-config.json
│ │ ├── prod-uid2-config.json
│ │ └── default-config.json
│ ├── Dockerfile
│ └── README.md
└── azure-aks
│ └── deployment
│ └── operator.yaml
├── .gitattributes
├── releases
└── previous_release.hash
├── src
├── main
│ ├── java
│ │ └── com
│ │ │ └── uid2
│ │ │ └── operator
│ │ │ ├── service
│ │ │ ├── IEncryptionScheme.java
│ │ │ ├── ShutdownService.java
│ │ │ ├── ITokenEncoder.java
│ │ │ ├── JsonParseUtils.java
│ │ │ ├── IUIDOperatorService.java
│ │ │ └── RoutingContextReader.java
│ │ │ ├── model
│ │ │ ├── TokenValidateResult.java
│ │ │ ├── IdentityMapResponseType.java
│ │ │ ├── VerificationResponse.java
│ │ │ ├── PublisherIdentity.java
│ │ │ ├── OperatorIdentity.java
│ │ │ ├── VersionedToken.java
│ │ │ ├── OperatorType.java
│ │ │ ├── IdentityMapV3Request.java
│ │ │ ├── IdentityType.java
│ │ │ ├── IdentityVersion.java
│ │ │ ├── RefreshToken.java
│ │ │ ├── MappedIdentity.java
│ │ │ ├── OptoutCheckPolicy.java
│ │ │ ├── MapRequest.java
│ │ │ ├── IdentityRequest.java
│ │ │ ├── CstgRequest.java
│ │ │ ├── IdentityScope.java
│ │ │ ├── UserIdentity.java
│ │ │ ├── IdentityEnvironment.java
│ │ │ ├── AdvertisingToken.java
│ │ │ ├── KeyManagerSnapshot.java
│ │ │ ├── StatsCollectorMessageItem.java
│ │ │ ├── IdentityTokens.java
│ │ │ └── RefreshResponse.java
│ │ │ ├── monitoring
│ │ │ ├── ILoggedStat.java
│ │ │ ├── IStatsCollectorQueue.java
│ │ │ ├── SiteClientVersionStat.java
│ │ │ ├── ClientVersionStatRecorder.java
│ │ │ ├── StatsCollectorHandler.java
│ │ │ └── OperatorMetrics.java
│ │ │ ├── store
│ │ │ ├── IConfigStore.java
│ │ │ ├── BootstrapConfigStore.java
│ │ │ ├── IOptOutStore.java
│ │ │ ├── RuntimeConfigStore.java
│ │ │ └── OptOutCloudStorage.java
│ │ │ ├── privacy
│ │ │ └── tcf
│ │ │ │ ├── TransparentConsentSpecialFeature.java
│ │ │ │ ├── TransparentConsentParseResult.java
│ │ │ │ ├── TransparentConsentPurpose.java
│ │ │ │ └── TransparentConsent.java
│ │ │ ├── vertx
│ │ │ ├── ClientInputValidationException.java
│ │ │ ├── Endpoints.java
│ │ │ ├── GenericFailureHandler.java
│ │ │ └── ClientVersionCapturingHandler.java
│ │ │ ├── util
│ │ │ ├── HttpMediaType.java
│ │ │ ├── PrivacyBits.java
│ │ │ ├── Tuple.java
│ │ │ ├── RoutingContextUtil.java
│ │ │ └── DomainNameCheckUtil.java
│ │ │ ├── IdentityConst.java
│ │ │ ├── reader
│ │ │ ├── RotatingCloudEncryptionKeyApiProvider.java
│ │ │ └── ApiStoreReader.java
│ │ │ └── Const.java
│ └── resources
│ │ └── com.uid2.core
│ │ └── test
│ │ ├── sites
│ │ ├── metadata.json
│ │ └── sites.json
│ │ ├── keysets
│ │ └── metadata.json
│ │ ├── services
│ │ ├── metadata.json
│ │ └── services.json
│ │ ├── clients
│ │ └── metadata.json
│ │ ├── keyset_keys
│ │ ├── metadata.json
│ │ └── keyset_keys.json
│ │ ├── service_links
│ │ ├── metadata.json
│ │ └── service_links.json
│ │ ├── client_side_keypairs
│ │ ├── metadata.json
│ │ └── client_side_keypairs.json
│ │ ├── cloud_encryption_keys
│ │ ├── metadata.json
│ │ └── cloud_encryption_keys.json
│ │ ├── runtime_config
│ │ └── metadata.json
│ │ └── salts
│ │ ├── metadataExpired.json
│ │ ├── metadata.json
│ │ ├── salts.txt.1670796729291
│ │ └── salts.txt.1745907348982
├── test
│ └── java
│ │ └── com
│ │ └── uid2
│ │ └── operator
│ │ ├── benchmark
│ │ └── BenchmarkRunner.java
│ │ ├── RotatingKeysetProviderTest.java
│ │ ├── RotatingKeysetKeyStoreTest.java
│ │ ├── RotatingSiteStoreTest.java
│ │ ├── RotatingClientSideKeypairStoreTest.java
│ │ ├── ServiceStoreTest.java
│ │ ├── ClientKeyProviderTest.java
│ │ ├── MemoryAppender.java
│ │ ├── ServiceLinkStoreTest.java
│ │ ├── service
│ │ ├── V4TokenUtilsTest.java
│ │ └── TokenUtilsTest.java
│ │ ├── ExtendedUIDOperatorVerticle.java
│ │ ├── util
│ │ └── DomainNameCheckUtilTest.java
│ │ └── EUIDOperatorVerticleTest.java
└── assembly
│ └── static.xml
├── .gitignore
├── version.json
├── .trivyignore
├── .idea
└── runConfigurations
│ ├── uid2-operator_unit_tests.xml
│ ├── uid2-operator_integrated.xml
│ └── uid2-operator_standalone.xml
├── Dockerfile.nitro.builder
├── Dockerfile
└── README.md
/conf/config.json:
--------------------------------------------------------------------------------
1 | {
2 | }
--------------------------------------------------------------------------------
/.github/workflows/.version:
--------------------------------------------------------------------------------
1 | 1
2 |
--------------------------------------------------------------------------------
/js/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/scripts/aws/pipeline/EUID_VERSION:
--------------------------------------------------------------------------------
1 | 13
2 |
--------------------------------------------------------------------------------
/scripts/aws/pipeline/UID2_VERSION:
--------------------------------------------------------------------------------
1 | 136
2 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.sh text eol=lf
3 |
--------------------------------------------------------------------------------
/releases/previous_release.hash:
--------------------------------------------------------------------------------
1 | 26411a59c5c77c04854faa9d37814f2ca0cf3df3
--------------------------------------------------------------------------------
/scripts/aws/config-server/requirements.txt:
--------------------------------------------------------------------------------
1 | Flask==2.3.2
2 | Werkzeug==3.0.6
--------------------------------------------------------------------------------
/scripts/aws/requirements.txt:
--------------------------------------------------------------------------------
1 | requests[socks]==2.32.3
2 | boto3==1.35.59
3 | urllib3==2.6.0
4 | PyYAML===6.0.2
--------------------------------------------------------------------------------
/scripts/aws/eks-pod/server_al_2023/README.md:
--------------------------------------------------------------------------------
1 | This file is copied by the build to the root of the deployment artifacts.
--------------------------------------------------------------------------------
/scripts/gcp-oidc/terraform/outputs.tf:
--------------------------------------------------------------------------------
1 | output "load_balancer_ip" {
2 | value = module.gce_lb_http.external_ip
3 | }
4 |
--------------------------------------------------------------------------------
/scripts/gcp-oidc/requirements.txt:
--------------------------------------------------------------------------------
1 | google-cloud-secret-manager>=2.16.0
2 | google-auth>=2.17.0
3 | google-api-core>=2.11.0
4 | packaging>=21.0
5 |
--------------------------------------------------------------------------------
/scripts/aws/syslog-ng/client/syslog-ng-core_4.6.0-1_amd64.deb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IABTechLab/uid2-operator/HEAD/scripts/aws/syslog-ng/client/syslog-ng-core_4.6.0-1_amd64.deb
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/service/IEncryptionScheme.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.service;
2 |
3 | public interface IEncryptionScheme {
4 | public String getScheme();
5 | }
6 |
--------------------------------------------------------------------------------
/scripts/aws/syslog-ng/server_al_2023/ivykis-0.43-1.amzn2023.x86_64.rpm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IABTechLab/uid2-operator/HEAD/scripts/aws/syslog-ng/server_al_2023/ivykis-0.43-1.amzn2023.x86_64.rpm
--------------------------------------------------------------------------------
/scripts/aws/syslog-ng/server_al_2023/libnet-1.2-2.amzn2023.0.2.x86_64.rpm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IABTechLab/uid2-operator/HEAD/scripts/aws/syslog-ng/server_al_2023/libnet-1.2-2.amzn2023.0.2.x86_64.rpm
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/sites/metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "version" : 1,
3 | "generated" : 1670883129,
4 | "sites" : {
5 | "location" : "/com.uid2.core/test/sites/sites.json"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/keysets/metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "generated": 1609459200,
4 | "keysets": {
5 | "location": "/com.uid2.core/test/keysets/keysets.json"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/services/metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "generated": 1609459200,
4 | "services": {
5 | "location": "/com.uid2.core/test/services/services.json"
6 | }
7 | }
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/clients/metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "version" : 1,
3 | "generated" : 1670883129,
4 | "client_keys" : {
5 | "location" : "/com.uid2.core/test/clients/clients.json"
6 | }
7 | }
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/TokenValidateResult.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | public enum TokenValidateResult {
4 | MATCH,
5 | MISMATCH,
6 | UNAUTHORIZED,
7 | INVALID_TOKEN,
8 | }
9 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/monitoring/ILoggedStat.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.monitoring;
2 |
3 | public interface ILoggedStat {
4 | public String GetLogPrefix();
5 | public Object GetValueToLog();
6 | }
7 |
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/keyset_keys/metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "generated": 1609459200,
4 | "keyset_keys": {
5 | "location": "/com.uid2.core/test/keyset_keys/keyset_keys.json"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/scripts/aws/logrotate/logrotate:
--------------------------------------------------------------------------------
1 | # Run the minutely jobs
2 | SHELL=/bin/bash
3 | PATH=/sbin:/bin:/usr/sbin:/usr/bin
4 | MAILTO=root
5 | * * * * * root /usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf
6 |
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/service_links/metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "generated": 1609459200,
4 | "service_links": {
5 | "location": "/com.uid2.core/test/service_links/service_links.json"
6 | }
7 | }
--------------------------------------------------------------------------------
/scripts/aws/syslog-ng/server_al_2023/syslog-ng-4.7.1.104.gcc5a7d9-1.amzn2023.x86_64.rpm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IABTechLab/uid2-operator/HEAD/scripts/aws/syslog-ng/server_al_2023/syslog-ng-4.7.1.104.gcc5a7d9-1.amzn2023.x86_64.rpm
--------------------------------------------------------------------------------
/scripts/aws/syslog-ng/server_al_2023/syslog-ng-logrotate-4.7.1.104.gcc5a7d9-1.amzn2023.x86_64.rpm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IABTechLab/uid2-operator/HEAD/scripts/aws/syslog-ng/server_al_2023/syslog-ng-logrotate-4.7.1.104.gcc5a7d9-1.amzn2023.x86_64.rpm
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/store/IConfigStore.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.store;
2 |
3 | import io.vertx.core.json.JsonObject;
4 |
5 | public interface IConfigStore {
6 | RuntimeConfig getConfig();
7 | void loadContent() throws Exception;
8 | }
9 |
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/client_side_keypairs/metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "generated": 1609459200,
4 | "client_side_keypairs": {
5 | "location": "/com.uid2.core/test/client_side_keypairs/client_side_keypairs.json"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/cloud_encryption_keys/metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "generated": 1620253519,
4 | "cloud_encryption_keys": {
5 | "location": "/com.uid2.core/test/cloud_encryption_keys/cloud_encryption_keys.json"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/test/java/com/uid2/operator/benchmark/BenchmarkRunner.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.benchmark;
2 |
3 | public class BenchmarkRunner {
4 | public static void main(String[] args) throws Exception {
5 | org.openjdk.jmh.Main.main(args);
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/.github/workflows/check-stable-dependency.yaml:
--------------------------------------------------------------------------------
1 | name: Check Stable Dependencies
2 | on: [pull_request, workflow_dispatch]
3 |
4 | jobs:
5 | check_dependency:
6 | uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-check-stable-dependency.yaml@v2
7 | secrets: inherit
--------------------------------------------------------------------------------
/scripts/aws/logrotate/logrotateDaily:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | /usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf
4 | EXITVALUE=$?
5 | if [ $EXITVALUE != 0 ]; then
6 | /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
7 | fi
8 | exit 0
9 |
--------------------------------------------------------------------------------
/.github/workflows/build-and-test.yaml:
--------------------------------------------------------------------------------
1 | name: Build and Test
2 | on: [pull_request, push, workflow_dispatch]
3 |
4 | jobs:
5 | build:
6 | uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-build-and-test.yaml@v3
7 | with:
8 | java_version: 21
9 | secrets: inherit
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target*
2 | target/
3 | target/*
4 | .idea*
5 | .idea/*
6 | .idea/
7 | dependencies/
8 | uid2-operator.iml
9 | build/**
10 | e2e-target
11 | .DS_Store
12 | */node_modules/*
13 | *.iml
14 | # Ignore generated credentials from google-github-actions/auth
15 | gha-creds-*.json
16 |
--------------------------------------------------------------------------------
/scripts/aws/eks-pod/README.md:
--------------------------------------------------------------------------------
1 | ## Building the pod docker file
2 |
3 | Both the Pod and the AMI use the same syslog-ng packages.
4 | To build the pod locally, copy the files from:
5 | uid2-operator\scripts\aws\syslog-ng\server_al_2023
6 | to
7 | uid2-operator\scripts\aws\eks\pod\server_al_2023
8 |
9 |
--------------------------------------------------------------------------------
/scripts/aws/uid2-operator-ami/uid2.pkrvars.hcl:
--------------------------------------------------------------------------------
1 | region = "us-east-1"
2 | identity_scope = "uid2"
3 | subnet_id = "subnet-03a2ae9b83ee4a1be"
4 | vpc_id = "vpc-056adf611333ebf06"
5 | ami_ou_arns = [
6 | "arn:aws:organizations::155852253738:ou/o-v1vmbc3c9h/ou-96c8-2vbyb92d"
7 | ]
8 |
--------------------------------------------------------------------------------
/scripts/aws/uid2-operator-ami/euid.pkrvars.hcl:
--------------------------------------------------------------------------------
1 | region = "eu-central-1"
2 | identity_scope = "euid"
3 | subnet_id = "subnet-0edbf47b073de1c79"
4 | vpc_id = "vpc-065000fb9082c6a90"
5 | ami_ou_arns = [
6 | "arn:aws:organizations::155852253738:ou/o-v1vmbc3c9h/ou-96c8-2vbyb92d"
7 | ]
8 |
--------------------------------------------------------------------------------
/scripts/aws/uid2-operator-ami/plugins.pkr.hcl:
--------------------------------------------------------------------------------
1 | packer {
2 | required_plugins {
3 | amazon = {
4 | version = ">= 1.0.0"
5 | source = "github.com/hashicorp/amazon"
6 | }
7 | ansible = {
8 | version = "~> 1"
9 | source = "github.com/hashicorp/ansible"
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/services/services.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "service_id": 1,
4 | "site_id": 123,
5 | "name": "testName1",
6 | "roles": ["GENERATOR"]
7 | },
8 | {
9 | "service_id": 2,
10 | "site_id": 126,
11 | "name": "testName2",
12 | "roles": ["MAPPER"]
13 | }
14 | ]
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/monitoring/IStatsCollectorQueue.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.monitoring;
2 |
3 | import com.uid2.operator.model.StatsCollectorMessageItem;
4 | import io.vertx.core.Vertx;
5 |
6 | public interface IStatsCollectorQueue {
7 | void enqueue(Vertx vertx, StatsCollectorMessageItem messageItem);
8 | }
9 |
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/service_links/service_links.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "link_id": "testId1",
4 | "service_id": 1,
5 | "site_id": 123,
6 | "name": "testName1"
7 | },
8 | {
9 | "link_id": "testId2",
10 | "service_id": 2,
11 | "site_id": 123,
12 | "name": "testName2"
13 | }
14 | ]
--------------------------------------------------------------------------------
/scripts/aws/logrotate/operator-logrotate.conf:
--------------------------------------------------------------------------------
1 | /var/log/operator.log
2 | {
3 | rotate 30
4 | daily
5 | maxsize 30M
6 | dateext dateformat -%Y-%m-%d-%s
7 | notifempty
8 | sharedscripts
9 | postrotate
10 | /usr/sbin/syslog-ng-ctl reload
11 | endscript
12 | }
13 |
--------------------------------------------------------------------------------
/scripts/aws/syslog-ng/README.md:
--------------------------------------------------------------------------------
1 | # syslog-ng Documentation
2 |
3 | The documentation for configuring syslog-ng can be found here: [syslog-ng Administration Guide](https://support.oneidentity.com/technical-documents/syslog-ng-open-source-edition/3.38/administration-guide)
4 |
5 | The source repo is here: [syslog-ng](https://github.com/syslog-ng/syslog-ng)
--------------------------------------------------------------------------------
/scripts/gcp-oidc/terraform/terraform.tfvars:
--------------------------------------------------------------------------------
1 | project_id = "uid2-test"
2 | service_account_name = "tf-test"
3 | uid_operator_image = "IMAGE_PLACEHOLDER"
4 | uid_operator_key = ""
5 | uid_operator_key_secret_name = "secret-operator-key"
6 | uid_deployment_env = "integ"
7 | debug_mode = true
8 |
--------------------------------------------------------------------------------
/version.json:
--------------------------------------------------------------------------------
1 | { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", "version": "5.62", "publicReleaseRefSpec": [ "^refs/heads/master$", "^refs/heads/v\\d+(?:\\.\\d+)?$" ], "cloudBuild": { "setVersionVariables": true, "buildNumber": { "enabled": true, "includeCommitId": { "when": "always" } } } }
2 |
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/runtime_config/metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "version" : 1,
3 | "runtime_config": {
4 | "identity_token_expires_after_seconds": 3600,
5 | "refresh_token_expires_after_seconds": 86400,
6 | "refresh_identity_token_after_seconds": 900,
7 | "sharing_token_expiry_seconds": 2592000,
8 | "identity_environment": "test"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/privacy/tcf/TransparentConsentSpecialFeature.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.privacy.tcf;
2 |
3 | public enum TransparentConsentSpecialFeature {
4 | PreciseGeolocationData (1),
5 | ActiveScanDeviceCharacteristics (2);
6 |
7 | public final int value;
8 | private TransparentConsentSpecialFeature(int value) {
9 | this.value = value;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/vertx/ClientInputValidationException.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.vertx;
2 |
3 | public class ClientInputValidationException extends RuntimeException {
4 | public ClientInputValidationException(String message) {
5 | super(message);
6 | }
7 |
8 | public ClientInputValidationException(String message, Exception e) {
9 | super(message, e);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/scripts/aws/syslog-ng/syslog-ng-client.conf:
--------------------------------------------------------------------------------
1 | @version: 4.6
2 | @include "scl.conf"
3 |
4 | options {
5 | keep_hostname(no);
6 | chain_hostnames(no);
7 | };
8 |
9 | source s_startup_file {
10 | file("/home/start.txt");
11 | };
12 |
13 | destination d_syslog_tcp {
14 | syslog("127.0.0.1" port(2011) transport("tcp"));
15 | };
16 |
17 | log {
18 | source(s_startup_file);
19 | destination(d_syslog_tcp);
20 | };
21 |
--------------------------------------------------------------------------------
/scripts/aws/sockd.conf:
--------------------------------------------------------------------------------
1 | internal: 127.0.0.1 port = 3306
2 | external: ens5
3 | user.notprivileged: ec2-user
4 | clientmethod: none
5 | socksmethod: none
6 | logoutput: stderr
7 |
8 | client pass {
9 | from: 127.0.0.1/32 to: 127.0.0.1/32
10 | log: error connect # disconnect iooperation
11 | }
12 |
13 | socks pass {
14 | from: 127.0.0.1/32 to: 0.0.0.0/0
15 | command: bind connect
16 | protocol: tcp
17 | log: error
18 | }
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/IdentityMapResponseType.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | public enum IdentityMapResponseType {
4 | OPTOUT("optout"),
5 | INVALID_IDENTIFIER("invalid identifier");
6 |
7 | private final String value;
8 |
9 | IdentityMapResponseType(String value) {
10 | this.value = value;
11 | }
12 |
13 | public String getValue() {
14 | return value;
15 | }
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/VerificationResponse.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | public class VerificationResponse {
4 | private final String verificationToken;
5 | private final int verificationCode;
6 |
7 | public VerificationResponse(String verificationToken, int verificationCode) {
8 | this.verificationToken = verificationToken;
9 | this.verificationCode = verificationCode;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/service/ShutdownService.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.service;
2 |
3 | public class ShutdownService {
4 | public void Shutdown(int status) {
5 | System.exit(status);
6 |
7 | // according to the docs, this should not be reached as System.exit does not complete either normally or abruptly.
8 | // Added for safety
9 | throw new RuntimeException("JVM Requested to shut down");
10 | }
11 | }
--------------------------------------------------------------------------------
/scripts/azure-cc/deployment/gateway.parameters.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
3 | "contentVersion": "1.0.0.0",
4 | "parameters": {
5 | "vnetName": {
6 | "value": "unified-id-network"
7 | },
8 | "gatewaySubnetName": {
9 | "value": "unified-id-subnet-gateway"
10 | },
11 | "containerGroupIPs": {
12 | "value": [
13 | ]
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/PublisherIdentity.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | public class PublisherIdentity {
4 | public final int siteId;
5 | public final int clientKeyId;
6 | public final long publisherId;
7 |
8 | public PublisherIdentity(int siteId, int clientKeyId, long publisherId) {
9 | this.siteId = siteId;
10 | this.clientKeyId = clientKeyId;
11 | this.publisherId = publisherId;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/util/HttpMediaType.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.util;
2 |
3 | public enum HttpMediaType {
4 | TEXT_PLAIN("text/plain"),
5 | APPLICATION_JSON("application/json"),
6 | APPLICATION_OCTET_STREAM("application/octet-stream");
7 |
8 | private final String type;
9 |
10 | HttpMediaType(String type) {
11 | this.type = type;
12 | }
13 |
14 | public String getType() {
15 | return type;
16 | }
17 | }
--------------------------------------------------------------------------------
/scripts/aws/uid2-operator-ami/build.pkr.hcl:
--------------------------------------------------------------------------------
1 | build {
2 | sources = ["source.amazon-ebs.linux"]
3 |
4 | provisioner "file" {
5 | source = "./artifacts"
6 | destination = "/tmp"
7 | }
8 |
9 | provisioner "ansible" {
10 | playbook_file = "./ansible/playbook.yml"
11 | extra_arguments = [ "--scp-extra-args", "'-O'" ]
12 | }
13 |
14 | post-processor "manifest" {
15 | output = "manifest.json"
16 | strip_path = true
17 | }
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/scripts/aws/pipeline/aws_nitro_eif.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -x
4 |
5 | # Build EIF
6 | dockerd &
7 | while (! docker stats --no-stream >/dev/null 2>&1); do
8 | # Docker takes a few seconds to initialize
9 | echo -n "."
10 | sleep 1
11 | done
12 | docker load -i $1.tar
13 | rm -f $1.tar
14 | nitro-cli build-enclave --docker-uri $1 --output-file $1.eif
15 | nitro-cli describe-eif --eif-path $1.eif | jq -r '.Measurements.PCR0' | xxd -r -p | base64 > pcr0.txt
16 |
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/salts/metadataExpired.json:
--------------------------------------------------------------------------------
1 | {
2 | "version" : 1,
3 | "generated" : 1670883129,
4 | "first_level" : "fOGY/aRE44peL23i+cE9MkJrzmEeNZZziNZBfq7qqk8=",
5 | "id_prefix" : "b",
6 | "id_secret" : "HF6Qz42HBbVHINxhh191dB09BCuTWyBkNtrNicO4ZCw=",
7 | "salts" : [{
8 | "effective" : 1670796729291,
9 | "expires" : 1670796729292,
10 | "location" : "/com.uid2.core/test/salts/salts.txt.1670796729291",
11 | "size" : 5
12 | }]
13 | }
14 |
--------------------------------------------------------------------------------
/scripts/aws/eks-pod/sockd_eks.conf:
--------------------------------------------------------------------------------
1 | #logoutput: stdout
2 | errorlog: stdout
3 | #debug: 2
4 | internal: 127.0.0.1 port = 3306
5 | external: eth0
6 | user.notprivileged: ec2-user
7 | clientmethod: none
8 | socksmethod: none
9 |
10 | client pass {
11 | from: 127.0.0.1/32 to: 127.0.0.1/32
12 | log: error # connect disconnect iooperation
13 | }
14 |
15 | socks pass {
16 | from: 127.0.0.1/32 to: 0.0.0.0/0
17 | command: bind connect
18 | protocol: tcp
19 | log: error
20 | }
--------------------------------------------------------------------------------
/scripts/aws/proxies.host.yaml:
--------------------------------------------------------------------------------
1 | ---
2 |
3 | socks5h-proxy:
4 | service: direct
5 | listen: vsock://-1:3305
6 | connect: tcp://127.0.0.1:3306
7 |
8 | operator-service:
9 | service: direct
10 | listen: tcp://0.0.0.0:80
11 | connect: vsock://42:8080
12 |
13 | operator-prometheus:
14 | service: direct
15 | listen: tcp://0.0.0.0:9080
16 | connect: vsock://42:9080
17 |
18 | syslogng:
19 | service: direct
20 | listen: vsock://-1:2011
21 | connect: tcp://127.0.0.1:2011
22 |
--------------------------------------------------------------------------------
/scripts/aws/proxies.nitro.yaml:
--------------------------------------------------------------------------------
1 | ---
2 |
3 | uid-operator-in:
4 | service: direct
5 | listen: vsock://-1:8080
6 | connect: tcp://127.0.0.1:8080
7 |
8 | prometheus-server:
9 | service: direct
10 | listen: vsock://-1:9080
11 | connect: tcp://127.0.0.1:9080
12 |
13 | socks5h-proxy:
14 | service: direct
15 | listen: tcp://127.0.0.1:3305
16 | connect: vsock://3:3305
17 |
18 | syslogng:
19 | service: direct
20 | listen: tcp://127.0.0.1:2011
21 | connect: vsock://3:2011
22 |
--------------------------------------------------------------------------------
/scripts/aws/eks-pod/proxies.host.yaml:
--------------------------------------------------------------------------------
1 | ---
2 |
3 | socks5h-proxy:
4 | service: direct
5 | listen: vsock://-1:3305
6 | connect: tcp://127.0.0.1:3306
7 |
8 | operator-service:
9 | service: direct
10 | listen: tcp://0.0.0.0:80
11 | connect: vsock://42:8080
12 |
13 | operator-prometheus:
14 | service: direct
15 | listen: tcp://0.0.0.0:9080
16 | connect: vsock://42:9080
17 |
18 | syslogng:
19 | service: direct
20 | listen: vsock://-1:2011
21 | connect: tcp://127.0.0.1:2011
22 |
--------------------------------------------------------------------------------
/scripts/azure-cc/deployment/vault.parameters.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
3 | "contentVersion": "1.0.0.0",
4 | "parameters": {
5 | "operatorIdentifier": {
6 | "value": "uid-operator"
7 | },
8 | "vaultName": {
9 | "value": ""
10 | },
11 | "operatorKeyName": {
12 | "value": "operator-key"
13 | },
14 | "operatorKeyValue": {
15 | "value": ""
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/.trivyignore:
--------------------------------------------------------------------------------
1 | # List any vulnerability that are to be accepted
2 | # See https://aquasecurity.github.io/trivy/v0.35/docs/vulnerability/examples/filter/
3 | # for more details
4 |
5 | # UID2-4460
6 | CVE-2024-47535 exp:2026-01-01
7 |
8 | # UID2-6097
9 | CVE-2025-59375 exp:2025-12-15
10 |
11 | # UID2-6128
12 | CVE-2025-55163 exp:2025-10-30
13 |
14 | # UID2-6340
15 | CVE-2025-64720 exp:2026-06-05
16 |
17 | # UID2-6340
18 | CVE-2025-65018 exp:2026-06-05
19 |
20 | # UID2-6385
21 | CVE-2025-66293 exp:2026-06-15
--------------------------------------------------------------------------------
/scripts/aws/uid2operator.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Starter service for UID2 Operator Enclave
3 | After=network.target nitro-enclaves-allocator.service
4 |
5 | [Service]
6 | Type=oneshot
7 | RemainAfterExit=true
8 | StandardOutput=journal
9 | StandardError=journal
10 | SyslogIdentifier=uid2operator
11 | ExecStart=/opt/uid2operator/init/bin/python /opt/uid2operator/ec2.py
12 | ExecStop=/opt/uid2operator/init/bin/python /opt/uid2operator/ec2.py -o stop
13 |
14 | [Install]
15 | WantedBy=multi-user.target
16 |
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/client_side_keypairs/client_side_keypairs.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "subscription_id": "4WvryDGbR5",
4 | "public_key": "UID2-X-L-MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEtXJdTSZAYHvoRDWiehMHoWF1BNPuqLs5w2ZHiAZ1IJc7O4/z0ojPTB0V+KYX/wxQK0hxx6kxCvHj335eI/ZQsQ==",
5 | "private_key": "UID2-Y-L-MEECAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQcEJzAlAgEBBCC5kOSRVD+qhAZqf0L4LGbmAhdy5HpIptwXE72jxhwo6w==",
6 | "site_id": 123,
7 | "contact": "test@email.com",
8 | "created": 1692034991,
9 | "disabled": false
10 | }
11 | ]
--------------------------------------------------------------------------------
/scripts/azure-cc/deployment/generate.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from hashlib import sha256
3 |
4 | def str_to_sha256(x: str) -> str:
5 | return sha256(x.encode('utf-8')).hexdigest()
6 |
7 | def print_data_sha256(data: str) -> str:
8 | print(str_to_sha256(data))
9 |
10 | def print_data_sha256_stripped(data: str) -> str:
11 | print(str_to_sha256(data.strip()))
12 |
13 | def main():
14 | with open(sys.argv[1], 'r') as file:
15 | data = file.read()
16 |
17 | print_data_sha256(data)
18 |
19 | if __name__ == '__main__':
20 | main()
21 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/uid2-operator_unit_tests.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/scripts/aws/config-server/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask
2 | import json
3 | import os
4 |
5 | app = Flask(__name__)
6 |
7 | @app.route('/getConfig', methods=['GET'])
8 | def get_config():
9 | try:
10 | with open('/etc/secret/secret-value/config', 'r') as secret_file:
11 | secret_value = secret_file.read().strip()
12 | secret_value_json = json.loads(secret_value)
13 | return json.dumps(secret_value_json)
14 | except Exception as e:
15 | return str(e), 500
16 |
17 | if __name__ == '__main__':
18 | app.run(processes=8)
19 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/service/ITokenEncoder.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.service;
2 |
3 | import com.uid2.operator.model.AdvertisingToken;
4 | import com.uid2.operator.model.IdentityTokens;
5 | import com.uid2.operator.model.RefreshToken;
6 |
7 | import java.time.Instant;
8 |
9 | public interface ITokenEncoder {
10 | IdentityTokens encode(AdvertisingToken advertisingToken, RefreshToken refreshToken, Instant refreshFrom, Instant asOf);
11 |
12 | AdvertisingToken decodeAdvertisingToken(String base64String);
13 |
14 | RefreshToken decodeRefreshToken(String base64String);
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/OperatorIdentity.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | public class OperatorIdentity {
4 | public final int siteId;
5 | public final OperatorType operatorType;
6 | public final int operatorVersion;
7 | public final int operatorKeyId;
8 |
9 | public OperatorIdentity(int siteId, OperatorType operatorType, int operatorVersion, int operatorKeyId) {
10 | this.siteId = siteId;
11 | this.operatorType = operatorType;
12 | this.operatorVersion = operatorVersion;
13 | this.operatorKeyId = operatorKeyId;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/VersionedToken.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | import java.time.Instant;
4 | import java.util.Objects;
5 | import com.uid2.shared.model.TokenVersion;
6 |
7 |
8 | public abstract class VersionedToken {
9 | public final TokenVersion version;
10 | public final Instant createdAt;
11 | public final Instant expiresAt;
12 |
13 | public VersionedToken(TokenVersion version, Instant createdAt, Instant expiresAt) {
14 | this.version = version;
15 | this.createdAt = createdAt;
16 | this.expiresAt = expiresAt;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/OperatorType.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | public enum OperatorType {
4 | Service(1),
5 | Snowflake(17),
6 | Unknown(-1);
7 |
8 | public final int value;
9 |
10 | OperatorType(int value) {
11 | this.value = value;
12 | }
13 |
14 | public static OperatorType fromValue(int value) {
15 | switch (value) {
16 | case 1:
17 | return Service;
18 | case 17:
19 | return Snowflake;
20 | default:
21 | return Unknown;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/IdentityMapV3Request.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | import com.fasterxml.jackson.annotation.*;
4 |
5 | public record IdentityMapV3Request(
6 | @JsonSetter(contentNulls = Nulls.FAIL)
7 | @JsonProperty("email") String[] email,
8 |
9 | @JsonSetter(contentNulls = Nulls.FAIL)
10 | @JsonProperty("email_hash") String[] email_hash,
11 |
12 | @JsonSetter(contentNulls = Nulls.FAIL)
13 | @JsonProperty("phone") String[] phone,
14 |
15 | @JsonSetter(contentNulls = Nulls.FAIL)
16 | @JsonProperty("phone_hash") String[] phone_hash
17 | ) {
18 | }
19 |
--------------------------------------------------------------------------------
/scripts/aws/syslog-ng/syslog-ng-server.conf:
--------------------------------------------------------------------------------
1 | @version: 4.6
2 | @include "scl.conf"
3 |
4 | options {
5 | keep_hostname(no);
6 | create_dirs(yes);
7 | ts_format(iso);
8 | time_reopen(10);
9 | chain_hostnames(yes);
10 | };
11 |
12 | source s_network {
13 | network(
14 | ip(0.0.0.0)
15 | port(2011)
16 | transport("tcp")
17 | flags(syslog-protocol)
18 | );
19 | };
20 |
21 | destination d_file {
22 | file(
23 | "/var/log/operator.log"
24 | dir-perm(0755)
25 | template-escape(no));
26 | };
27 |
28 | log {
29 | source(s_network);
30 | destination(d_file);
31 | };
32 |
--------------------------------------------------------------------------------
/src/assembly/static.xml:
--------------------------------------------------------------------------------
1 |
5 | static
6 |
7 | tar.gz
8 |
9 | false
10 |
11 |
12 | static
13 | static
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/salts/metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "version" : 1,
3 | "generated" : 1717548362,
4 | "first_level" : "fOGY/aRE44peL23i+cE9MkJrzmEeNZZziNZBfq7qqk8=",
5 | "id_prefix" : "b",
6 | "id_secret" : "HF6Qz42HBbVHINxhh191dB09BCuTWyBkNtrNicO4ZCw=",
7 | "salts" : [
8 | {
9 | "effective" : 1670796729291,
10 | "expires" : 1766125493000,
11 | "location" : "/com.uid2.core/test/salts/salts.txt.1670796729291",
12 | "size" : 5
13 | },{
14 | "effective" : 1745907348982,
15 | "expires" : 1766720293000,
16 | "location" : "/com.uid2.core/test/salts/salts.txt.1745907348982",
17 | "size" : 5
18 | }
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/conf/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 | %d{HH:mm:ss.SSS} thread=%thread level=%-5level class=%logger{36} - %msg %ex%n
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/service/JsonParseUtils.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.service;
2 |
3 | import io.vertx.core.json.JsonArray;
4 | import io.vertx.core.json.JsonObject;
5 | import io.vertx.ext.web.RoutingContext;
6 |
7 | public class JsonParseUtils {
8 | public static JsonArray parseArray(JsonObject object, String key, RoutingContext rc) {
9 | JsonArray outArray;
10 | try {
11 | outArray = object.getJsonArray(key);
12 | } catch (ClassCastException e) {
13 | ResponseUtil.LogInfoAndSend400Response(rc, String.format("%s must be an array", key));
14 | return null;
15 | }
16 | return outArray;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/scripts/azure-cc/deployment/vnet.parameters.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
3 | "contentVersion": "1.0.0.0",
4 | "parameters": {
5 | "vnetName": {
6 | "value": "unified-id-network"
7 | },
8 | "computeSubnetName": {
9 | "value": "unified-id-subnet-operators"
10 | },
11 | "gatewaySubnetName": {
12 | "value": "unified-id-subnet-gateway"
13 | },
14 | "vnetAddressPrefix": {
15 | "value": "10.0.0.0/20"
16 | },
17 | "computeSubnetPrefix": {
18 | "value": "10.0.0.0/24"
19 | },
20 | "gatewaySubnetPrefix": {
21 | "value": "10.0.1.0/28"
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/scripts/azure-cc/conf/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 | %d{HH:mm:ss.SSS} thread=%thread level=%-5level class=%logger{36} - %msg %ex%n
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/scripts/aws/conf/logback-debug.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | REDACTED - S3
8 | \S+s3\.amazonaws\.com\/\S*X-Amz-Security-Token=\S+
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/scripts/gcp-oidc/conf/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 | %d{HH:mm:ss.SSS} thread=%thread level=%-5level class=%logger{36} - %msg %ex%n
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/IdentityType.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | import com.uid2.operator.vertx.ClientInputValidationException;
4 |
5 | public enum IdentityType {
6 | Email(0),
7 | Phone(1);
8 |
9 | private final int value;
10 |
11 | IdentityType(int value) {
12 | this.value = value;
13 | }
14 |
15 | public int getValue() {
16 | return value;
17 | }
18 |
19 | public static IdentityType fromValue(int value) {
20 | return switch (value) {
21 | case 0 -> Email;
22 | case 1 -> Phone;
23 | default -> throw new ClientInputValidationException("Invalid valid for IdentityType: " + value);
24 | };
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/salts/salts.txt.1670796729291:
--------------------------------------------------------------------------------
1 | 1000000,1806364800001,vgv1BwiNRCW7F3VcNXHlZh+7oHJ4G4gCshbGcVOLnss=,1814140800000,vgv1BwiNRCW7F3VcNXHlZh+7oHJ4G4gCshbGcVOLnsS=,,,,,,
2 | 1000001,1786924800001,vgv1BwiNRCW7F3VcNXHlZh+7oHJ4G4gCshbGcVOLnst=,1812844800000,,,,,,,
3 | 1000002,1798588800001,,1806364800000,,2100002,key12345key12345key12345key12340,salt1234salt1234salt1234salt1230,2000002,key12345key12345key12345key12345,salt1234salt1234salt1234salt1234
4 | 1000003,1795996800001,,1803772800000,,2000003,key12345key12345key12345key12346,salt1234salt1234salt1234salt1235,,,
5 | 1000004,1811548800001,,1819324800000,vgv1BwiNRCW7F3VcNXHlZh+7oHJ4G4gCshbGcVOLnsw=,2000004,key12345key12345key12345key12347,salt1234salt1234salt1234salt1236,,,
6 |
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/salts/salts.txt.1745907348982:
--------------------------------------------------------------------------------
1 | 1000000,1806364800001,vgv1BwiNRCW7F3VcNXHlZh+7oHJ4G4gCshbGcVOLnss=,1814140800000,vgv1BwiNRCW7F3VcNXHlZh+7oHJ4G4gCshbGcVOLnsS=,,,,,,
2 | 1000001,1786924800001,vgv1BwiNRCW7F3VcNXHlZh+7oHJ4G4gCshbGcVOLnst=,1812844800000,,,,,,,
3 | 1000002,1798588800001,,1806364800000,,2100002,key12345key12345key12345key12340,salt1234salt1234salt1234salt1230,2000002,key12345key12345key12345key12345,salt1234salt1234salt1234salt1234
4 | 1000003,1795996800001,,1803772800000,,2000003,key12345key12345key12345key12346,salt1234salt1234salt1234salt1235,,,
5 | 1000004,1811548800001,,1819324800000,vgv1BwiNRCW7F3VcNXHlZh+7oHJ4G4gCshbGcVOLnsw=,2000004,key12345key12345key12345key12347,salt1234salt1234salt1234salt1236,,,
6 |
--------------------------------------------------------------------------------
/scripts/aws/eks-pod/server_al_2023/syslog-ng-server.conf:
--------------------------------------------------------------------------------
1 | @version: 4.6
2 | @include "scl.conf"
3 |
4 | options {
5 | keep_hostname(no);
6 | create_dirs(yes);
7 | ts_format(iso);
8 | time_reopen(10);
9 | chain_hostnames(no);
10 | };
11 |
12 | source s_local {
13 | system();
14 | internal();
15 | };
16 |
17 | source s_network {
18 | network(
19 | ip(0.0.0.0)
20 | port(2011)
21 | transport("tcp")
22 | flags(syslog-protocol)
23 | );
24 | };
25 |
26 | destination d_console {
27 | pipe(
28 | "/proc/1/fd/1"
29 | template("{\"@timestamp\":${MESSAGE}\n")
30 | );
31 | };
32 |
33 | log {
34 | source(s_local);
35 | source(s_network);
36 | destination(d_console);
37 | };
38 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/monitoring/SiteClientVersionStat.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.monitoring;
2 |
3 | import java.util.Map;
4 | import java.util.Objects;
5 |
6 | public final class SiteClientVersionStat implements ILoggedStat {
7 | private final Integer siteId;
8 | private final Map versionCounts;
9 |
10 | public SiteClientVersionStat(Integer siteId, Map versionCounts) {
11 | this.siteId = siteId;
12 | this.versionCounts = versionCounts;
13 | }
14 |
15 | @Override
16 | public String GetLogPrefix() {
17 | return "version log; siteId=%d versions=".formatted(siteId);
18 | }
19 |
20 | @Override
21 | public Object GetValueToLog() {
22 | return versionCounts;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/scripts/azure-cc/deployment/operator.parameters.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
3 | "contentVersion": "1.0.0.0",
4 | "parameters": {
5 | "operatorIdentifier": {
6 | "value": "uid-operator"
7 | },
8 | "vnetName": {
9 | "value": "unified-id-network"
10 | },
11 | "computeSubnetName": {
12 | "value": "unified-id-subnet-operators"
13 | },
14 | "vaultName": {
15 | "value": ""
16 | },
17 | "operatorKeyName": {
18 | "value": "operator-key"
19 | },
20 | "count": {
21 | "value": 2
22 | },
23 | "deploymentEnvironment": {
24 | "value": "integ"
25 | },
26 | "skipValidations": {
27 | "value": "false"
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/scripts/aws/conf/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 127.0.0.1:2011
6 |
7 |
8 | REDACTED - S3
9 | \S+s3\.amazonaws\.com\/\S*X-Amz-Security-Token=\S+
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/main/resources/com.uid2.core/test/sites/sites.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 123,
4 | "name": "MegaTest Site",
5 | "enabled": true,
6 | "domain_names" : ["localhost", "uidapi.com"],
7 | "app_names": ["com.123.Game.App.android", "123456789", "com.123.Game.App.ios", "com.uid2.devapp"]
8 | },
9 | {
10 | "id": 124,
11 | "name": "TestCorp Site",
12 | "enabled": true
13 | },
14 | {
15 | "id": 125,
16 | "name": "LoremTestIpsum Site",
17 | "enabled": true
18 | },
19 | {
20 | "id": 126,
21 | "name": "AWS Venice",
22 | "enabled": true
23 | },
24 | {
25 | "id": 127,
26 | "name": "App Name Test Site",
27 | "enabled": true,
28 | "app_names" : ["com.UID2.operator.TEST", "13456789"],
29 | "domain_names" : ["example.com", "unifiedid.com"]
30 | }
31 | ]
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/IdentityVersion.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | import com.uid2.operator.vertx.ClientInputValidationException;
4 |
5 | public enum IdentityVersion {
6 | V2(-1), // V2 raw UIDs don't encode version
7 | V3(0),
8 | V4(1);
9 |
10 | private final int value;
11 |
12 | IdentityVersion(int value) {
13 | this.value = value;
14 | }
15 |
16 | public int getValue() {
17 | return value;
18 | }
19 |
20 | public static IdentityVersion fromValue(int value) {
21 | return switch (value) {
22 | case -1 -> V2;
23 | case 0 -> V3;
24 | case 1 -> V4;
25 | default -> throw new ClientInputValidationException("Invalid valid for IdentityVersion: " + value);
26 | };
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/RefreshToken.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | import java.time.Instant;
4 | import com.uid2.shared.model.TokenVersion;
5 |
6 | public class RefreshToken extends VersionedToken {
7 | public final OperatorIdentity operatorIdentity;
8 | public final PublisherIdentity publisherIdentity;
9 | public final UserIdentity userIdentity;
10 |
11 | public RefreshToken(TokenVersion version, Instant createdAt, Instant expiresAt, OperatorIdentity operatorIdentity,
12 | PublisherIdentity publisherIdentity, UserIdentity userIdentity) {
13 | super(version, createdAt, expiresAt);
14 | this.operatorIdentity = operatorIdentity;
15 | this.publisherIdentity = publisherIdentity;
16 | this.userIdentity = userIdentity;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/test/java/com/uid2/operator/RotatingKeysetProviderTest.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator;
2 |
3 | import com.uid2.shared.cloud.EmbeddedResourceStorage;
4 |
5 | import com.uid2.shared.store.CloudPath;
6 | import com.uid2.shared.store.reader.RotatingKeysetProvider;
7 | import com.uid2.shared.store.scope.GlobalScope;
8 | import io.vertx.core.json.JsonObject;
9 | import org.junit.Test;
10 |
11 | public class RotatingKeysetProviderTest {
12 | @Test
13 | public void loadFromEmbeddedResourceStorage() throws Exception {
14 | RotatingKeysetProvider keysetProvider = new RotatingKeysetProvider(
15 | new EmbeddedResourceStorage(Main.class),
16 | new GlobalScope(new CloudPath("/com.uid2.core/test/keysets/metadata.json")));
17 |
18 | JsonObject m = keysetProvider.getMetadata();
19 | keysetProvider.loadContent(m);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/test/java/com/uid2/operator/RotatingKeysetKeyStoreTest.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator;
2 |
3 | import com.uid2.shared.cloud.EmbeddedResourceStorage;
4 |
5 | import com.uid2.shared.store.CloudPath;
6 | import com.uid2.shared.store.reader.RotatingKeysetKeyStore;
7 | import com.uid2.shared.store.scope.GlobalScope;
8 | import io.vertx.core.json.JsonObject;
9 | import org.junit.Test;
10 |
11 | public class RotatingKeysetKeyStoreTest {
12 | @Test
13 | public void loadFromEmbeddedResourceStorage() throws Exception {
14 | RotatingKeysetKeyStore keysetKeyStore = new RotatingKeysetKeyStore(
15 | new EmbeddedResourceStorage(Main.class),
16 | new GlobalScope(new CloudPath("/com.uid2.core/test/keyset_keys/metadata.json")));
17 |
18 | JsonObject m = keysetKeyStore.getMetadata();
19 | keysetKeyStore.loadContent(m);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/MappedIdentity.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | public class MappedIdentity {
4 | public static final MappedIdentity LogoutIdentity = new MappedIdentity(new byte[33], "", null, null);
5 | public final byte[] advertisingId;
6 | public final String bucketId;
7 | public final byte[] previousAdvertisingId;
8 | public final Long refreshFrom;
9 |
10 | public MappedIdentity(byte[] advertisingId, String bucketId, byte[] previousAdvertisingId, Long refreshFrom) {
11 | this.advertisingId = advertisingId;
12 | this.bucketId = bucketId;
13 | this.previousAdvertisingId = previousAdvertisingId;
14 | this.refreshFrom = refreshFrom;
15 | }
16 |
17 | public boolean isOptedOut() {
18 | return this.equals(LogoutIdentity) || this.bucketId == null || this.bucketId.isEmpty();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/OptoutCheckPolicy.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | import com.uid2.operator.vertx.ClientInputValidationException;
4 |
5 | public enum OptoutCheckPolicy {
6 | DoNotRespect(0),
7 | RespectOptOut(1);
8 |
9 | public final int policy;
10 | OptoutCheckPolicy(int policy) { this.policy = policy; }
11 |
12 | public static OptoutCheckPolicy fromValue(int value) {
13 | switch (value) {
14 | case 0: return DoNotRespect;
15 | case 1: return RespectOptOut;
16 | default: throw new ClientInputValidationException("Invalid value for OptoutCheckPolicy: " + value);
17 | }
18 | }
19 |
20 | public static OptoutCheckPolicy defaultPolicy() {
21 | return DoNotRespect;
22 | }
23 |
24 | public static OptoutCheckPolicy respectOptOut() {
25 | return RespectOptOut;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/privacy/tcf/TransparentConsentParseResult.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.privacy.tcf;
2 |
3 | public class TransparentConsentParseResult {
4 | private final boolean success;
5 | private final String failureReason;
6 | private final TransparentConsent tcString;
7 |
8 | public TransparentConsentParseResult(TransparentConsent parsedConsent) {
9 | this.tcString = parsedConsent;
10 | this.success = true;
11 | this.failureReason = "";
12 | }
13 |
14 | public TransparentConsentParseResult(String failureReason) {
15 | this.tcString = null;
16 | this.success = false;
17 | this.failureReason = failureReason;
18 | }
19 |
20 | public boolean isSuccess() { return success; }
21 | public TransparentConsent getTCString() { return tcString; }
22 | public String getFailureReason() { return failureReason; }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/store/BootstrapConfigStore.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.store;
2 |
3 | import io.vertx.core.json.JsonObject;
4 | import org.slf4j.Logger;
5 | import org.slf4j.LoggerFactory;
6 |
7 | public class BootstrapConfigStore implements IConfigStore {
8 | private static final Logger logger = LoggerFactory.getLogger(BootstrapConfigStore.class);
9 | private final RuntimeConfig config;
10 |
11 | public BootstrapConfigStore(JsonObject config) {
12 | this.config = config.mapTo(RuntimeConfig.class);
13 | logger.info("Successfully loaded bootstrap config");
14 | }
15 |
16 | @Override
17 | public RuntimeConfig getConfig() {
18 | return config;
19 | }
20 |
21 | @Override
22 | public void loadContent() throws Exception {
23 | logger.info("Remote Config FF is not enabled, bootstrap config was loaded.");
24 | return;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/MapRequest.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | import java.time.Instant;
4 |
5 | public final class MapRequest {
6 | public final UserIdentity userIdentity;
7 | public final OptoutCheckPolicy optoutCheckPolicy;
8 | public final Instant asOf;
9 | public final IdentityEnvironment identityEnvironment;
10 |
11 | public MapRequest(
12 | UserIdentity userIdentity,
13 | OptoutCheckPolicy optoutCheckPolicy,
14 | Instant asOf,
15 | IdentityEnvironment identityEnvironment) {
16 | this.userIdentity = userIdentity;
17 | this.optoutCheckPolicy = optoutCheckPolicy;
18 | this.asOf = asOf;
19 | this.identityEnvironment = identityEnvironment;
20 | }
21 |
22 | public boolean shouldCheckOptOut() {
23 | return optoutCheckPolicy.equals(OptoutCheckPolicy.RespectOptOut);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/test/java/com/uid2/operator/RotatingSiteStoreTest.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator;
2 |
3 | import com.uid2.shared.cloud.EmbeddedResourceStorage;
4 | import com.uid2.shared.store.CloudPath;
5 | import com.uid2.shared.store.reader.RotatingSiteStore;
6 | import com.uid2.shared.store.scope.GlobalScope;
7 | import io.vertx.core.json.JsonObject;
8 | import org.junit.jupiter.api.Test;
9 |
10 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
11 |
12 | public class RotatingSiteStoreTest {
13 | @Test
14 | public void loadFromEmbeddedResourceStorage() throws Exception {
15 | RotatingSiteStore siteProvider = new RotatingSiteStore(
16 | new EmbeddedResourceStorage(Main.class),
17 | new GlobalScope(new CloudPath("/com.uid2.core/test/sites/metadata.json")));
18 |
19 | JsonObject m = siteProvider.getMetadata();
20 | assertDoesNotThrow(() -> siteProvider.loadContent(m));
21 | }
22 | }
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/privacy/tcf/TransparentConsentPurpose.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.privacy.tcf;
2 |
3 | /**
4 | * Purposes Definitions
5 | * https://iabeurope.eu/iab-europe-transparency-consent-framework-policies/
6 | */
7 | public enum TransparentConsentPurpose {
8 | STORE_INFO_ON_DEVICE (1),
9 | SELECT_BASIC_ADS (2),
10 | CREATE_PERSONALIZED_ADS_PROFILE (3),
11 | SELECT_PERSONALIZED_ADS (4),
12 | CREATE_PERSONALIZED_CONTENT_PROFILE (5),
13 | SELECT_PERSONALIZED_CONTENT (6),
14 | MEASURE_AD_PERFORMANCE (7),
15 | MEASURE_CONTENT_PERFORMANCE (8),
16 | APPLY_MARKET_RESEARCH_GENERATE_INSIGHT (9),
17 | DEVELOP_AND_IMPROVE_PRODUCTS (10);
18 |
19 | public final int value;
20 | private TransparentConsentPurpose(int value) {
21 | this.value = value;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/.github/workflows/vulnerability-scan-failure-notify.yaml:
--------------------------------------------------------------------------------
1 | name: Vulnerability Scan Failure Slack Notify
2 | on:
3 | workflow_dispatch:
4 | inputs:
5 | vulnerability_severity:
6 | description: The severity to fail the workflow if such vulnerability is detected. DO NOT override it unless a Jira ticket is raised. DO NOT use 'CRITICAL' unless a Jira ticket is raised.
7 | type: choice
8 | options:
9 | - CRITICAL,HIGH
10 | - CRITICAL,HIGH,MEDIUM
11 | - CRITICAL
12 | default: 'CRITICAL,HIGH'
13 | schedule:
14 | - cron: '0 16 * * *' # 9:00 AM GMT -7
15 | - cron: '0 0 * * *' # 5:00 PM GMT -7
16 |
17 | jobs:
18 | vulnerability-scan-failure-notify:
19 | uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-vulnerability-scan-failure-notify.yaml@v3
20 | secrets:
21 | SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK }}
22 | with:
23 | scan_type : image
24 | java_version: "21"
25 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/IdentityRequest.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | public final class IdentityRequest {
4 | public final PublisherIdentity publisherIdentity;
5 | public final UserIdentity userIdentity;
6 | public final OptoutCheckPolicy optoutCheckPolicy;
7 | public final IdentityEnvironment identityEnvironment;
8 |
9 | public IdentityRequest(
10 | PublisherIdentity publisherIdentity,
11 | UserIdentity userIdentity,
12 | OptoutCheckPolicy tokenGeneratePolicy,
13 | IdentityEnvironment identityEnvironment) {
14 | this.publisherIdentity = publisherIdentity;
15 | this.userIdentity = userIdentity;
16 | this.optoutCheckPolicy = tokenGeneratePolicy;
17 | this.identityEnvironment = identityEnvironment;
18 | }
19 |
20 | public boolean shouldCheckOptOut() {
21 | return optoutCheckPolicy.equals(OptoutCheckPolicy.RespectOptOut);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/CstgRequest.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | public class CstgRequest {
6 | private String payload;
7 | private String iv;
8 | @JsonProperty("subscription_id")
9 | private String subscriptionId;
10 | @JsonProperty("public_key")
11 | private String publicKey;
12 | private long timestamp;
13 |
14 | @JsonProperty("app_name")
15 | private String appName;
16 |
17 | public String getPayload() {
18 | return payload;
19 | }
20 |
21 | public String getIv() {
22 | return iv;
23 | }
24 |
25 | public String getSubscriptionId() {
26 | return subscriptionId;
27 | }
28 |
29 | public String getPublicKey() {
30 | return publicKey;
31 | }
32 |
33 | public long getTimestamp() {
34 | return timestamp;
35 | }
36 |
37 | public String getAppName() {
38 | return appName;
39 | }
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/store/IOptOutStore.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.store;
2 |
3 | import com.uid2.operator.model.UserIdentity;
4 | import io.vertx.core.AsyncResult;
5 | import io.vertx.core.Handler;
6 |
7 | import java.time.Instant;
8 |
9 | public interface IOptOutStore {
10 |
11 | /**
12 | * Get latest Opt-out record with respect to the UID (hashed identity)
13 | * @param firstLevelHashIdentity UID
14 | * @return The timestamp of latest opt-out record. NULL if no record.
15 | */
16 | Instant getLatestEntry(UserIdentity firstLevelHashIdentity);
17 |
18 | long getOptOutTimestampByAdId(String adId);
19 |
20 | void addEntry(UserIdentity firstLevelHashIdentity,
21 | byte[] advertisingId,
22 | String uidTraceId,
23 | String uidInstanceId,
24 | String email,
25 | String phone,
26 | String clientIp,
27 | Handler> handler);
28 | }
29 |
--------------------------------------------------------------------------------
/src/test/java/com/uid2/operator/RotatingClientSideKeypairStoreTest.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator;
2 |
3 | import com.uid2.shared.cloud.EmbeddedResourceStorage;
4 | import com.uid2.shared.store.CloudPath;
5 | import com.uid2.shared.store.reader.RotatingClientSideKeypairStore;
6 | import com.uid2.shared.store.scope.GlobalScope;
7 | import io.vertx.core.json.JsonObject;
8 | import org.junit.jupiter.api.Test;
9 |
10 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
11 |
12 | public class RotatingClientSideKeypairStoreTest {
13 | @Test
14 | public void loadFromEmbeddedResourceStorage() throws Exception {
15 | RotatingClientSideKeypairStore keypairProvider = new RotatingClientSideKeypairStore(
16 | new EmbeddedResourceStorage(Main.class),
17 | new GlobalScope(new CloudPath("/com.uid2.core/test/client_side_keypairs/metadata.json")));
18 |
19 | JsonObject m = keypairProvider.getMetadata();
20 | assertDoesNotThrow(() -> keypairProvider.loadContent(m));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/scripts/gcp-oidc/terraform/.gitignore:
--------------------------------------------------------------------------------
1 | # Local .terraform directories
2 | **/.terraform/*
3 |
4 | # .tfstate files
5 | *.tfstate
6 | *.tfstate.*
7 |
8 | # Crash log files
9 | crash.log
10 | crash.*.log
11 |
12 | # Exclude all .tfvars files, which are likely to contain sensitive data, such as
13 | # password, private keys, and other secrets. These should not be part of version
14 | # control as they are data points which are potentially sensitive and subject
15 | # to change depending on the environment.
16 | *.tfvars
17 | *.tfvars.json
18 |
19 | # Ignore override files as they are usually used to override resources locally and so
20 | # are not checked in
21 | override.tf
22 | override.tf.json
23 | *_override.tf
24 | *_override.tf.json
25 |
26 | # Include override files you do wish to add to version control using negated pattern
27 | # !example_override.tf
28 |
29 | # Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
30 | # example: *tfplan*
31 |
32 | # Ignore CLI configuration files
33 | .terraformrc
34 | terraform.rc
35 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/IdentityScope.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | import com.uid2.operator.vertx.ClientInputValidationException;
4 |
5 | public enum IdentityScope {
6 | UID2(0),
7 | EUID(1);
8 |
9 | private final int value;
10 |
11 | IdentityScope(int value) {
12 | this.value = value;
13 | }
14 |
15 | public int getValue() {
16 | return value;
17 | }
18 |
19 | public static IdentityScope fromValue(int value) {
20 | return switch (value) {
21 | case 0 -> UID2;
22 | case 1 -> EUID;
23 | default -> throw new ClientInputValidationException("Invalid value for IdentityScope: " + value);
24 | };
25 | }
26 |
27 | public static IdentityScope fromString(String str) {
28 | return switch (str.toLowerCase()) {
29 | case "uid2" -> UID2;
30 | case "euid" -> EUID;
31 | default -> throw new ClientInputValidationException("Invalid string for IdentityScope: " + str);
32 | };
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/IdentityConst.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator;
2 |
3 | import com.uid2.operator.service.EncodingUtils;
4 |
5 | public class IdentityConst {
6 |
7 | public static final String OptOutTokenIdentityForEmail = "optout@unifiedid.com";
8 | public static final String OptOutTokenIdentityForPhone = "+00000000001";
9 | public static final String ValidateIdentityForEmail = "validate@example.com";
10 | public static final String ValidateIdentityForPhone = "+12345678901";
11 | public static final byte[] ValidateIdentityForEmailHash = EncodingUtils.getSha256Bytes(IdentityConst.ValidateIdentityForEmail);
12 | public static final byte[] ValidateIdentityForPhoneHash = EncodingUtils.getSha256Bytes(IdentityConst.ValidateIdentityForPhone);
13 | public static final String OptOutIdentityForEmail = "optout@example.com";
14 | public static final String OptOutIdentityForPhone = "+00000000000";
15 | public static final String RefreshOptOutIdentityForEmail = "refresh-optout@example.com";
16 | public static final String RefreshOptOutIdentityForPhone = "+00000000002";
17 |
18 |
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/scripts/aws/syslog-ng/server_al_2023/pubkey.gpg:
--------------------------------------------------------------------------------
1 | -----BEGIN PGP PUBLIC KEY BLOCK-----
2 |
3 | mQENBGYw4okBCADnaPDLp32IFXHhKE/e2kusIsiqieECEeLDcfYKT5VGYQD1yQeN
4 | prHxKm8U6dqqvmSd5ehphwrjeXY54XVWOlOT1FZpmFOLgi1XXn0syoMX/cJ2GcOV
5 | M8r4Z0CptDwp6PRvR+sLFGGENR3LueCi0RwHiw7M9jIxxuAuKH55IpWdCCshiFN5
6 | EE3AGeFbDERteyBywNZc3Q9OZXQ8y8jEp5CH8tbspQU+Qig/kGCjIWRnmkWFM6mT
7 | qdFtgWG4G6nhzvGwoD3J+IPPL02IV7Qywxl6dUBKhrLFPhorPXBSy43wlUZJY9IM
8 | kJK+EfpkSnY4v2tEfnakbHs8k1Tlw8f5exQhABEBAAG0UmN6YW5pa19zeXNsb2ct
9 | bmctYW1hem9uMjMgKE5vbmUpIDxjemFuaWsjc3lzbG9nLW5nLWFtYXpvbjIzQGNv
10 | cHIuZmVkb3JhaG9zdGVkLm9yZz6JAVgEEwEIAEIWIQSCmrP3ftEn1OdcMJPM0E5Y
11 | LFGYWQUCZjDiiQMbLwQFCQlmAYAFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AA
12 | CgkQzNBOWCxRmFm/6AgAxA1kWfcJZMLP1FdvLuadPw4QH2KYqOAIAnGb8+a08CSf
13 | Vwyhb3nFQ6h0K5sfVmrMNikmgu3cOssX/iLbjMJhBoITUkD8jpmQmO7oV6GPn1dT
14 | TIEIb1rYLtCu6/BHniyKNOPgZNmi80I+hTt5rWwOmfLlfMCGP/ob6iLs3yIAz4cE
15 | Oe5lFLMfn9IMmDJC9E5kVP9sjTUWjuW192lTTyyOdPx6m8h2dk+i//8SnYikNXEg
16 | djPNQNxf6pw0TvO8dn4qO4YNrQgfnap3s1QvVgL0tQHDINOs+t01brRMS49KhYF9
17 | y9OTIIeQw6nUaytecy5A7j5JUIaqxie0SFHqIrB35A==
18 | =IyUG
19 | -----END PGP PUBLIC KEY BLOCK-----
20 |
--------------------------------------------------------------------------------
/scripts/aws/uid2-operator-ami/source.pkr.hcl:
--------------------------------------------------------------------------------
1 | source "amazon-ebs" "linux" {
2 |
3 | # source parameters
4 | source_ami_filter {
5 | filters = {
6 | name = "al2023-ami-2023*-x86_64"
7 | root-device-type = "ebs"
8 | }
9 | most_recent = true
10 | owners = ["amazon"]
11 | }
12 |
13 | # disable ami creation for testing
14 | # skip_create_ami = true
15 |
16 | # instance parameters
17 | ami_name = local.ami_name
18 | ami_ou_arns = var.ami_ou_arns
19 | instance_type = var.instance_type
20 | region = var.region
21 | subnet_id = var.subnet_id
22 | vpc_id = var.vpc_id
23 |
24 | # connection parameters
25 | communicator = var.communicator
26 | ssh_username = var.ssh_username
27 | ssh_interface = var.ssh_interface
28 | iam_instance_profile = var.iam_instance_profile
29 |
30 | tags = {
31 | Environment = var.env
32 | Service = var.service
33 | Version = var.version
34 | Name = local.ami_name
35 | Build = "packer"
36 | BuildTime = var.timestamp
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/UserIdentity.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | import java.time.Instant;
4 | import java.util.Arrays;
5 |
6 | public class UserIdentity {
7 | public final IdentityScope identityScope;
8 | public final IdentityType identityType;
9 | public final byte[] id;
10 | public final int privacyBits;
11 | public final Instant establishedAt;
12 | public final Instant refreshedAt;
13 |
14 | public UserIdentity(IdentityScope identityScope, IdentityType identityType, byte[] id, int privacyBits,
15 | Instant establishedAt, Instant refreshedAt) {
16 | this.identityScope = identityScope;
17 | this.identityType = identityType;
18 | this.id = id;
19 | this.privacyBits = privacyBits;
20 | this.establishedAt = establishedAt;
21 | this.refreshedAt = refreshedAt;
22 | }
23 |
24 | public boolean matches(UserIdentity that) {
25 | return this.identityScope.equals(that.identityScope) &&
26 | this.identityType.equals(that.identityType) &&
27 | Arrays.equals(this.id, that.id);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/scripts/azure-cc/conf/integ-uid2-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "sites_metadata_path": "https://core.uidapi.com/sites/refresh",
3 | "clients_metadata_path": "https://core.uidapi.com/clients/refresh",
4 | "keysets_metadata_path": "https://core.uidapi.com/key/keyset/refresh",
5 | "keyset_keys_metadata_path": "https://core.uidapi.com/key/keyset-keys/refresh",
6 | "client_side_keypairs_metadata_path": "https://core.uidapi.com/client_side_keypairs/refresh",
7 | "salts_metadata_path": "https://core.uidapi.com/salt/refresh",
8 | "services_metadata_path": "https://core.uidapi.com/services/refresh",
9 | "service_links_metadata_path": "https://core.uidapi.com/service_links/refresh",
10 | "optout_metadata_path": "https://optout.uidapi.com/optout/refresh",
11 | "core_attest_url": "https://core.uidapi.com/attest",
12 | "optout_api_uri": "https://optout.uidapi.com/optout/replicate",
13 | "cloud_encryption_keys_metadata_path": "https://core.uidapi.com/cloud_encryption_keys/retrieve",
14 | "runtime_config_metadata_path": "https://core.uidapi.com/operator/config",
15 | "optout_s3_folder": "uid-optout-integ/",
16 | "uid_instance_id_prefix": "unknown",
17 | "encrypted_files": true
18 | }
19 |
--------------------------------------------------------------------------------
/scripts/aws/conf/euid-integ-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "sites_metadata_path": "https://core.integ.euid.eu/sites/refresh",
3 | "clients_metadata_path": "https://core.integ.euid.eu/clients/refresh",
4 | "keysets_metadata_path": "https://core.integ.euid.eu/key/keyset/refresh",
5 | "keyset_keys_metadata_path": "https://core.integ.euid.eu/key/keyset-keys/refresh",
6 | "client_side_keypairs_metadata_path": "https://core.integ.euid.eu/client_side_keypairs/refresh",
7 | "salts_metadata_path": "https://core.integ.euid.eu/salt/refresh",
8 | "services_metadata_path": "https://core.integ.euid.eu/services/refresh",
9 | "service_links_metadata_path": "https://core.integ.euid.eu/service_links/refresh",
10 | "optout_metadata_path": "https://optout.integ.euid.eu/optout/refresh",
11 | "core_attest_url": "https://core.integ.euid.eu/attest",
12 | "optout_api_uri": "https://optout.integ.euid.eu/optout/replicate",
13 | "cloud_encryption_keys_metadata_path": "https://core.integ.euid.eu/cloud_encryption_keys/retrieve",
14 | "runtime_config_metadata_path": "https://core.integ.euid.eu/operator/config",
15 | "optout_s3_folder": "optout/",
16 | "identity_scope": "euid",
17 | "encrypted_files": true
18 | }
--------------------------------------------------------------------------------
/scripts/gcp-oidc/conf/integ-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "sites_metadata_path": "https://core.uidapi.com/sites/refresh",
3 | "clients_metadata_path": "https://core.uidapi.com/clients/refresh",
4 | "keysets_metadata_path": "https://core.uidapi.com/key/keyset/refresh",
5 | "keyset_keys_metadata_path": "https://core.uidapi.com/key/keyset-keys/refresh",
6 | "client_side_keypairs_metadata_path": "https://core.uidapi.com/client_side_keypairs/refresh",
7 | "salts_metadata_path": "https://core.uidapi.com/salt/refresh",
8 | "services_metadata_path": "https://core.uidapi.com/services/refresh",
9 | "service_links_metadata_path": "https://core.uidapi.com/service_links/refresh",
10 | "optout_metadata_path": "https://optout.uidapi.com/optout/refresh",
11 | "core_attest_url": "https://core.uidapi.com/attest",
12 | "cloud_encryption_keys_metadata_path": "https://core.uidapi.com/cloud_encryption_keys/retrieve",
13 | "runtime_config_metadata_path": "https://core.uidapi.com/operator/config",
14 | "optout_api_uri": "https://optout.uidapi.com/optout/replicate",
15 | "uid_instance_id_prefix": "unknown",
16 | "optout_s3_folder": "uid-optout-integ/",
17 | "encrypted_files": true
18 | }
19 |
--------------------------------------------------------------------------------
/scripts/gcp-oidc/conf/prod-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "sites_metadata_path": "https://core.uidapi.com/sites/refresh",
3 | "clients_metadata_path": "https://core.uidapi.com/clients/refresh",
4 | "keysets_metadata_path": "https://core.uidapi.com/key/keyset/refresh",
5 | "keyset_keys_metadata_path": "https://core.uidapi.com/key/keyset-keys/refresh",
6 | "client_side_keypairs_metadata_path": "https://core.uidapi.com/client_side_keypairs/refresh",
7 | "salts_metadata_path": "https://core.uidapi.com/salt/refresh",
8 | "services_metadata_path": "https://core.uidapi.com/services/refresh",
9 | "service_links_metadata_path": "https://core.uidapi.com/service_links/refresh",
10 | "optout_metadata_path": "https://optout.uidapi.com/optout/refresh",
11 | "core_attest_url": "https://core.uidapi.com/attest",
12 | "cloud_encryption_keys_metadata_path": "https://core.uidapi.com/cloud_encryption_keys/retrieve",
13 | "runtime_config_metadata_path": "https://core.uidapi.com/operator/config",
14 | "optout_api_uri": "https://optout.uidapi.com/optout/replicate",
15 | "optout_s3_folder": "optout-v2/",
16 | "identity_token_expires_after_seconds": 259200,
17 | "uid_instance_id_prefix": "unknown",
18 | "encrypted_files": true
19 | }
20 |
--------------------------------------------------------------------------------
/scripts/azure-cc/conf/prod-uid2-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "sites_metadata_path": "https://core.uidapi.com/sites/refresh",
3 | "clients_metadata_path": "https://core.uidapi.com/clients/refresh",
4 | "keysets_metadata_path": "https://core.uidapi.com/key/keyset/refresh",
5 | "keyset_keys_metadata_path": "https://core.uidapi.com/key/keyset-keys/refresh",
6 | "client_side_keypairs_metadata_path": "https://core.uidapi.com/client_side_keypairs/refresh",
7 | "salts_metadata_path": "https://core.uidapi.com/salt/refresh",
8 | "services_metadata_path": "https://core.uidapi.com/services/refresh",
9 | "service_links_metadata_path": "https://core.uidapi.com/service_links/refresh",
10 | "optout_metadata_path": "https://optout.uidapi.com/optout/refresh",
11 | "core_attest_url": "https://core.uidapi.com/attest",
12 | "cloud_encryption_keys_metadata_path": "https://core.uidapi.com/cloud_encryption_keys/retrieve",
13 | "runtime_config_metadata_path": "https://core.uidapi.com/operator/config",
14 | "optout_api_uri": "https://optout.uidapi.com/optout/replicate",
15 | "optout_s3_folder": "optout-v2/",
16 | "identity_token_expires_after_seconds": 259200,
17 | "uid_instance_id_prefix": "unknown",
18 | "encrypted_files": true
19 | }
20 |
--------------------------------------------------------------------------------
/scripts/aws/conf/uid2-integ-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "core_attest_url": "https://core-integ.uidapi.com/attest",
3 | "optout_api_uri": "https://optout-integ.uidapi.com/optout/replicate",
4 | "sites_metadata_path": "https://core-integ.uidapi.com/sites/refresh",
5 | "clients_metadata_path": "https://core-integ.uidapi.com/clients/refresh",
6 | "client_side_keypairs_metadata_path": "https://core-integ.uidapi.com/client_side_keypairs/refresh",
7 | "keysets_metadata_path": "https://core-integ.uidapi.com/key/keyset/refresh",
8 | "keyset_keys_metadata_path": "https://core-integ.uidapi.com/key/keyset-keys/refresh",
9 | "salts_metadata_path": "https://core-integ.uidapi.com/salt/refresh",
10 | "services_metadata_path": "https://core-integ.uidapi.com/services/refresh",
11 | "service_links_metadata_path": "https://core-integ.uidapi.com/service_links/refresh",
12 | "optout_metadata_path": "https://optout-integ.uidapi.com/optout/refresh",
13 | "cloud_encryption_keys_metadata_path": "https://core-integ.uidapi.com/cloud_encryption_keys/retrieve",
14 | "runtime_config_metadata_path": "https://core-integ.uidapi.com/operator/config",
15 | "optout_s3_folder": "uid-optout-integ/",
16 | "identity_scope": "uid2",
17 | "encrypted_files": true
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/model/IdentityEnvironment.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.model;
2 |
3 | import com.fasterxml.jackson.annotation.JsonCreator;
4 | import com.uid2.operator.vertx.ClientInputValidationException;
5 |
6 | public enum IdentityEnvironment {
7 | TEST(0),
8 | INTEG(1),
9 | PROD(2);
10 |
11 | private final int value;
12 |
13 | IdentityEnvironment(int value) {
14 | this.value = value;
15 | }
16 |
17 | public int getValue() {
18 | return value;
19 | }
20 |
21 | public static IdentityEnvironment fromValue(int value) {
22 | return switch (value) {
23 | case 0 -> TEST;
24 | case 1 -> INTEG;
25 | case 2 -> PROD;
26 | default -> throw new ClientInputValidationException("Invalid valid for IdentityEnvironment: " + value);
27 | };
28 | }
29 |
30 | @JsonCreator
31 | public static IdentityEnvironment fromString(String value) {
32 | return switch (value.toLowerCase()) {
33 | case "test" -> TEST;
34 | case "integ" -> INTEG;
35 | case "prod" -> PROD;
36 | default -> throw new ClientInputValidationException("Invalid valid for IdentityEnvironment: " + value);
37 | };
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/uid2/operator/reader/RotatingCloudEncryptionKeyApiProvider.java:
--------------------------------------------------------------------------------
1 | package com.uid2.operator.reader;
2 |
3 | import com.uid2.shared.cloud.DownloadCloudStorage;
4 | import com.uid2.shared.model.CloudEncryptionKey;
5 | import com.uid2.shared.store.parser.CloudEncryptionKeyParser;
6 | import com.uid2.shared.store.reader.RotatingCloudEncryptionKeyProvider;
7 | import com.uid2.shared.store.scope.StoreScope;
8 | import io.vertx.core.json.JsonObject;
9 |
10 | import java.time.Instant;
11 | import java.util.*;
12 |
13 | public class RotatingCloudEncryptionKeyApiProvider extends RotatingCloudEncryptionKeyProvider {
14 | public RotatingCloudEncryptionKeyApiProvider(DownloadCloudStorage fileStreamProvider, StoreScope scope) {
15 | super(new ApiStoreReader<>(fileStreamProvider, scope, new CloudEncryptionKeyParser(), "cloud_encryption_keys"));
16 | }
17 |
18 | public RotatingCloudEncryptionKeyApiProvider(ApiStoreReader