Skip to content

Commit

Permalink
Merge 7.0 (#940)
Browse files Browse the repository at this point in the history
* fix: adds test for user pagination from old version (#893)

* adding dev-v7.0.15 tag to this commit to ensure building

* fix: core config validation (#894)

* fix: core config validation

* fix: core config validation

* fix: PR comments

* fix: PR comments

* fix: test

* fix: startup test

* fix: using ConfigMapper

* fix: test

* fix: config mapper

* fix: core config

* adding dev-v7.0.16 tag to this commit to ensure building

* fix: null handling in config mapper (#897)

* fix: core config validation

* fix: core config validation

* fix: PR comments

* fix: PR comments

* fix: test

* fix: startup test

* fix: using ConfigMapper

* fix: test

* fix: config mapper

* fix: core config

* fix: null handling

* fix: test defaults

* adding dev-v7.0.16 tag to this commit to ensure building

* Add t4-app in release checklist (#899)

* Update README.md

* Add Dockerfile for ubuntu 22.04 (#904)

* fix: error logs should be printed to StdErr (#918)

* fix: Load only cud (#917)

* fix: update config and validateAndNormalize

* fix: impl

* fix: PR comments

* fix: cleanup

* fix: cleanup

* fix: pr comments

* fix: pr comments

* fix: tests

* fix: changelog

* fix: 400 error

* fix: cuds from db

* fix: connection pool issue (#919)

* adding dev-v7.0.17 tag to this commit to ensure building

* fix: Test fix (#921)

* fix: test

* fix: tests

* adding dev-v7.0.17 tag to this commit to ensure building

* fix: CICD tests (#925)

* fix: tests

* fix: adding retry

* fix: kill

* fix: typo

* fix: cicd

* fix: cicd

* adding dev-v7.0.17 tag to this commit to ensure building

* fix: Vulnerability fix (#928)

* fix: updated dependencies

* fix: updated dependencies

* chore: version and changelog

* fix: update impl deps

* fix: telemetry data

* fix: changelog

* fix: cleanup

* fix: active user storage

* fix: active users storage test

* fix: changelog

* fix: versions

* adding dev-v7.0.18 tag to this commit to ensure building

* fix: Cicd tests fix (#932)

* fix: CICD fix

* fix: test fix

* fix: test for mongo

* adding dev-v7.0.18 tag to this commit to ensure building

* fix: dependencies (#933)

* fix: dependency fix

* fix: dep fix

* adding dev-v7.0.18 tag to this commit to ensure building

* fix: dependencies (#934)

* adding dev-v7.0.18 tag to this commit to ensure building

* fix: 31 days of mau (#936)

* fix: MAU computation (#937)

* fix: mau

* fix: typo

* adding dev-v7.0.18 tag to this commit to ensure building

* fix: mau related tests (#938)

* adding dev-v7.0.18 tag to this commit to ensure building

* fix: Tests (#939)

* fix: mau related tests

* fix: test

* adding dev-v7.0.18 tag to this commit to ensure building

---------

Co-authored-by: rishabhpoddar <[email protected]>
Co-authored-by: Ankit Tiwari <[email protected]>
  • Loading branch information
3 people committed Feb 27, 2024
1 parent 7164a2b commit e1fcd0c
Show file tree
Hide file tree
Showing 40 changed files with 1,294 additions and 202 deletions.
57 changes: 57 additions & 0 deletions .circleci/Dockerfile-ubuntu22
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
FROM ubuntu:22.04

RUN apt-get update && apt-get upgrade -y

RUN apt-get install build-essential -y

RUN echo "mysql-server mysql-server/root_password password root" | debconf-set-selections

RUN echo "mysql-server mysql-server/root_password_again password root" | debconf-set-selections

RUN apt install mysql-server -y

RUN usermod -d /var/lib/mysql/ mysql

RUN [ -d /var/run/mysqld ] || mkdir -p /var/run/mysqld

ADD ./runMySQL.sh /runMySQL.sh

RUN chmod +x /runMySQL.sh

RUN apt-get install -y git-core

RUN apt-get install -y wget

# Install OpenJDK 12
RUN wget https://download.java.net/java/GA/jdk12.0.2/e482c34c86bd4bf8b56c0b35558996b9/10/GPL/openjdk-12.0.2_linux-x64_bin.tar.gz

RUN mkdir /usr/java

RUN mv openjdk-12.0.2_linux-x64_bin.tar.gz /usr/java

RUN cd /usr/java && tar -xzvf openjdk-12.0.2_linux-x64_bin.tar.gz

RUN echo 'JAVA_HOME=/usr/java/jdk-12.0.2' >> /etc/profile
RUN echo 'PATH=$PATH:$HOME/bin:$JAVA_HOME/bin' >> /etc/profile

RUN apt-get install jq -y

RUN apt-get install curl -y

RUN apt-get install unzip -y

# Install OpenJDK 15.0.1
RUN wget https://download.java.net/java/GA/jdk15.0.1/51f4f36ad4ef43e39d0dfdbaf6549e32/9/GPL/openjdk-15.0.1_linux-x64_bin.tar.gz

RUN mv openjdk-15.0.1_linux-x64_bin.tar.gz /usr/java

RUN cd /usr/java && tar -xzvf openjdk-15.0.1_linux-x64_bin.tar.gz

RUN echo 'JAVA_HOME=/usr/java/jdk-15.0.1' >> /etc/profile
RUN echo 'PATH=$PATH:$HOME/bin:$JAVA_HOME/bin' >> /etc/profile
RUN echo 'export JAVA_HOME' >> /etc/profile
RUN echo 'export JRE_HOME' >> /etc/profile
RUN echo 'export PATH' >> /etc/profile

RUN update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk-12.0.2/bin/java" 1
RUN update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk-12.0.2/bin/javac" 1
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ labels:
- [ ] SuperTokens Jackson SAML example update
- [ ] Supabase docs
- [ ] Capacitor template app: https://github.com/RobSchilderr/capacitor-supertokens-nextjs-turborepo
- [ ] T4 App: https://github.com/timothymiller/t4-app

### 📚 Documentation (test site)

Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,26 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

- TODO - copy once postgres / mysql changelog is done

## [7.0.18] - 2024-02-19

- Fixes vulnerabilities in dependencies
- Updates telemetry payload
- Fixes Active User tracking to use the right storage

## [7.0.17] - 2024-02-06

- Fixes issue where error logs were printed to StdOut instead of StdErr.
- Adds new config `supertokens_saas_load_only_cud` that makes the core instance load a particular CUD only, irrespective of the CUDs present in the db.
- Fixes connection pool handling when connection pool size changes for a tenant.

## [7.0.16] - 2023-12-04

- Returns 400, instead of 500, for badly typed core config while creating CUD, App or Tenant

## [7.0.15] - 2023-11-28

- Adds test for user pagination from old version

## [7.0.14] - 2023-11-21

- Updates test user query speed
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ Melvyn Hills</b></sub></a></td>
Melvyn Hills</b></sub></a></td>
<td align="center"><a href="https://github.com/constantoine"><img src="https://avatars.githubusercontent.com/u/13930958?v=4" width="100px;" alt=""/><br /><sub><b>Cléo Rebert</b></sub></a></td>
<td align="center"><a href="https://github.com/daniil-borovoy"><img src="https://avatars.githubusercontent.com/u/74528634?v=4" width="100px;" alt=""/><br /><sub><b>Daniil Borovoy</b></sub></a></td>
<td align="center"><a href="https://github.com/kriskw1999"><img src="https://avatars.githubusercontent.com/u/71312948?v=4" width="100px;" alt=""/><br /><sub><b>Krzysztof Witkowski</b></sub></a></td>
</tr>
</table>

Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ dependencies {
implementation group: 'com.google.code.gson', name: 'gson', version: '2.3.1'

// https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.14.0'
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.16.1'

// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.14.0'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.16.1'

// https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.4.14'

// https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-core
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: '10.1.1'
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: '10.1.18'

// https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'

// https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc
implementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.30.1'
implementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.45.1.0'

// https://mvnrepository.com/artifact/org.mindrot/jbcrypt
implementation group: 'org.mindrot', name: 'jbcrypt', version: '0.4'
Expand Down
4 changes: 2 additions & 2 deletions cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ dependencies {
implementation group: 'com.google.code.gson', name: 'gson', version: '2.3.1'

// https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.10.0'
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.16.1'

// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.0'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.16.1'

// https://mvnrepository.com/artifact/de.mkammerer/argon2-jvm
implementation group: 'de.mkammerer', name: 'argon2-jvm', version: '2.11'
Expand Down
30 changes: 15 additions & 15 deletions cli/implementationDependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@
"src": "https://repo1.maven.org/maven2/com/google/code/gson/gson/2.3.1/gson-2.3.1-sources.jar"
},
{
"jar": "https://repo1.maven.org/maven2/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.10.0/jackson-dataformat-yaml-2.10.0.jar",
"name": "Jackson Dataformat 2.10.0",
"src": "https://repo1.maven.org/maven2/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.10.0/jackson-dataformat-yaml-2.10.0-sources.jar"
"jar": "https://repo1.maven.org/maven2/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.16.1/jackson-dataformat-yaml-2.16.1.jar",
"name": "Jackson Dataformat 2.16.1",
"src": "https://repo1.maven.org/maven2/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.16.1/jackson-dataformat-yaml-2.16.1-sources.jar"
},
{
"jar": "https://repo1.maven.org/maven2/org/yaml/snakeyaml/1.24/snakeyaml-1.24.jar",
"name": "SnakeYAML 1.24",
"src": "https://repo1.maven.org/maven2/org/yaml/snakeyaml/1.24/snakeyaml-1.24-sources.jar"
"jar": "https://repo1.maven.org/maven2/org/yaml/snakeyaml/2.2/snakeyaml-2.2.jar",
"name": "SnakeYAML 2.2",
"src": "https://repo1.maven.org/maven2/org/yaml/snakeyaml/2.2/snakeyaml-2.2-sources.jar"
},
{
"jar": "https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.10.0/jackson-core-2.10.0.jar",
"name": "Jackson core 2.10.0",
"src": "https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.10.0/jackson-core-2.10.0-sources.jar"
"jar": "https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.16.1/jackson-core-2.16.1.jar",
"name": "Jackson core 2.16.1",
"src": "https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.16.1/jackson-core-2.16.1-sources.jar"
},
{
"jar": "https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.10.0/jackson-databind-2.10.0.jar",
"name": "Jackson databind 2.10.0",
"src": "https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.10.0/jackson-databind-2.10.0-sources.jar"
"jar": "https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.16.1/jackson-databind-2.16.1.jar",
"name": "Jackson databind 2.16.1",
"src": "https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.16.1/jackson-databind-2.16.1-sources.jar"
},
{
"jar": "https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.10.0/jackson-annotations-2.10.0.jar",
"name": "Jackson annotation 2.10.0",
"src": "https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.10.0/jackson-annotations-2.10.0-sources.jar"
"jar": "https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.16.1/jackson-annotations-2.16.1.jar",
"name": "Jackson annotation 2.16.1",
"src": "https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.16.1/jackson-annotations-2.16.1-sources.jar"
},
{
"jar": "https://repo1.maven.org/maven2/de/mkammerer/argon2-jvm/2.11/argon2-jvm-2.11.jar",
Expand Down
Binary file modified cli/jar/cli.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,8 @@ core_config_version: 0
# when CDI version is not specified in the request. When set to null, the core will assume the latest version of the
# CDI.
# supertokens_max_cdi_version:


# (OPTIONAL | Default: null) string value. If specified, the supertokens service will only load the specified CUD even
# if there are more CUDs in the database and block all other CUDs from being used from this instance.
# supertokens_saas_load_only_cud:
4 changes: 4 additions & 0 deletions devConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,7 @@ disable_telemetry: true
# when CDI version is not specified in the request. When set to null, the core will assume the latest version of the
# CDI.
# supertokens_max_cdi_version:

# (OPTIONAL | Default: null) string value. If specified, the supertokens service will only load the specified CUD even
# if there are more CUDs in the database and block all other CUDs from being used from this instance.
# supertokens_saas_load_only_cud:
Binary file modified downloader/jar/downloader.jar
Binary file not shown.
8 changes: 4 additions & 4 deletions ee/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ dependencies {
testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.1.0'

// https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-core
testImplementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: '10.1.1'
testImplementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: '10.1.18'

// https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.4.14'

// https://mvnrepository.com/artifact/com.google.code.gson/gson
testImplementation group: 'com.google.code.gson', name: 'gson', version: '2.3.1'

testImplementation 'com.tngtech.archunit:archunit-junit4:0.22.0'

// https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml
testImplementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.14.0'
testImplementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.16.1'

// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
testImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.14.0'
testImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.16.1'

testImplementation group: 'org.jetbrains', name: 'annotations', version: '13.0'
}
Expand Down
Binary file modified ee/jar/ee.jar
Binary file not shown.
32 changes: 17 additions & 15 deletions ee/src/main/java/io/supertokens/ee/EEFeatureFlag.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,18 @@ private JsonObject getMFAStats() throws StorageQueryException, TenantOrAppNotFou
Storage[] storages = StorageLayer.getStoragesForApp(main, this.appIdentifier);

int totalUserCountWithMoreThanOneLoginMethod = 0;
int[] maus = new int[30];
int[] maus = new int[31];

long now = System.currentTimeMillis();
long today = now - (now % (24 * 60 * 60 * 1000L));

for (Storage storage : storages) {
totalUserCountWithMoreThanOneLoginMethod += ((AuthRecipeStorage)storage).getUsersCountWithMoreThanOneLoginMethodOrTOTPEnabled(this.appIdentifier);

for (int i = 0; i < 30; i++) {
long timestamp = today - (i * 24 * 60 * 60 * 1000L);
maus[i] += ((ActiveUsersStorage)storage).countUsersThatHaveMoreThanOneLoginMethodOrTOTPEnabledAndActiveSince(appIdentifier, timestamp);
for (int i = 1; i <= 31; i++) {
long timestamp = now - (i * 24 * 60 * 60 * 1000L);

// `maus[i-1]` since i starts from 1
maus[i-1] += ((ActiveUsersStorage)storage).countUsersThatHaveMoreThanOneLoginMethodOrTOTPEnabledAndActiveSince(appIdentifier, timestamp);
}
}

Expand Down Expand Up @@ -283,25 +284,26 @@ private JsonObject getAccountLinkingStats() throws StorageQueryException {
if (!usesAccountLinking) {
result.addProperty("totalUserCountWithMoreThanOneLoginMethod", 0);
JsonArray mauArray = new JsonArray();
for (int i = 0; i < 30; i++) {
for (int i = 0; i < 31; i++) {
mauArray.add(new JsonPrimitive(0));
}
result.add("mauWithMoreThanOneLoginMethod", mauArray);
return result;
}

int totalUserCountWithMoreThanOneLoginMethod = 0;
int[] maus = new int[30];
int[] maus = new int[31];

long now = System.currentTimeMillis();
long today = now - (now % (24 * 60 * 60 * 1000L));

for (Storage storage : storages) {
totalUserCountWithMoreThanOneLoginMethod += ((AuthRecipeStorage)storage).getUsersCountWithMoreThanOneLoginMethod(this.appIdentifier);

for (int i = 0; i < 30; i++) {
long timestamp = today - (i * 24 * 60 * 60 * 1000L);
maus[i] += ((ActiveUsersStorage)storage).countUsersThatHaveMoreThanOneLoginMethodAndActiveSince(appIdentifier, timestamp);
for (int i = 1; i <= 31; i++) {
long timestamp = now - (i * 24 * 60 * 60 * 1000L);

// `maus[i-1]` because i starts from 1
maus[i-1] += ((ActiveUsersStorage)storage).countUsersThatHaveMoreThanOneLoginMethodAndActiveSince(appIdentifier, timestamp);
}
}

Expand All @@ -312,10 +314,10 @@ private JsonObject getAccountLinkingStats() throws StorageQueryException {

private JsonArray getMAUs() throws StorageQueryException, TenantOrAppNotFoundException {
JsonArray mauArr = new JsonArray();
for (int i = 0; i < 30; i++) {
long now = System.currentTimeMillis();
long today = now - (now % (24 * 60 * 60 * 1000L));
long timestamp = today - (i * 24 * 60 * 60 * 1000L);
long now = System.currentTimeMillis();

for (int i = 1; i <= 31; i++) {
long timestamp = now - (i * 24 * 60 * 60 * 1000L);
ActiveUsersStorage activeUsersStorage = (ActiveUsersStorage) StorageLayer.getStorage(
this.appIdentifier.getAsPublicTenantIdentifier(), main);
int mau = activeUsersStorage.countUsersActiveSince(this.appIdentifier, timestamp);
Expand Down
2 changes: 1 addition & 1 deletion ee/src/test/java/io/supertokens/ee/test/EETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ protected URLConnection openConnection(URL u) {
JsonObject paidFeatureUsageStats = j.getAsJsonObject("paidFeatureUsageStats");
JsonArray mauArr = paidFeatureUsageStats.get("maus").getAsJsonArray();
assertEquals(paidFeatureUsageStats.entrySet().size(), 1);
assertEquals(mauArr.size(), 30);
assertEquals(mauArr.size(), 31);
assertEquals(mauArr.get(0).getAsInt(), 0);
assertEquals(mauArr.get(29).getAsInt(), 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void testRetrievingFeatureFlagInfoWhenNoLicenseKeyIsSet() throws Exceptio
if (StorageLayer.getStorage(process.getProcess()).getType() == STORAGE_TYPE.SQL) {
JsonArray mauArr = usageStats.get("maus").getAsJsonArray();
assertEquals(1, usageStats.entrySet().size());
assertEquals(30, mauArr.size());
assertEquals(31, mauArr.size());
assertEquals(0, mauArr.get(0).getAsInt());
assertEquals(0, mauArr.get(29).getAsInt());
} else {
Expand Down Expand Up @@ -92,7 +92,7 @@ public void testRetrievingFeatureFlagInfoWhenLicenseKeyIsSet() throws Exception
if (StorageLayer.getStorage(process.getProcess()).getType() == STORAGE_TYPE.SQL) {
JsonArray mauArr = usageStats.get("maus").getAsJsonArray();
assertEquals(1, usageStats.entrySet().size());
assertEquals(30, mauArr.size());
assertEquals(31, mauArr.size());
assertEquals(0, mauArr.get(0).getAsInt());
assertEquals(0, mauArr.get(29).getAsInt());
} else {
Expand Down
Loading

0 comments on commit e1fcd0c

Please sign in to comment.