Java local bucketing changes - #15
Conversation
split current java sdk into common and cloud folders
…t behaviour going forward
add DVCClient class to be used for local bucketing
| @@ -1 +1,3 @@ | |||
| rootProject.name = "java-server-sdk-example-app" No newline at end of file | |||
| rootProject.name = "java-server-sdk-example-app" | |||
There was a problem hiding this comment.
Critical Vulnerability:
pkg:maven/org.springframework.boot/spring-boot-starter-web@2.7.0
1 Critical, 0 Severe, 0 Moderate, 0 Unknown vulnerabilities have been found across 1 dependencies
Components
pkg:maven/org.springframework/spring-web@5.3.20
CRITICAL Vulnerabilities (1)
Deserialization of Untrusted Data
Pivotal Spring Framework through 5.3.16 suffers from a potential remote code execution (RCE) issue if used for Java deserialization of untrusted data. Depending on how the library is implemented within a product, this issue may or not occur, and authentication may be required. NOTE: the vendor's position is that untrusted data is not an intended use case. The product's behavior will not be changed because some users rely on deserialization of trusted data.
CVSS Score: 9.8
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CWE: CWE-502
ℹ️ Learn about @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
| Command | Usage |
|---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
| @@ -1 +1,3 @@ | |||
| rootProject.name = "java-server-sdk-example-app" No newline at end of file | |||
| rootProject.name = "java-server-sdk-example-app" | |||
There was a problem hiding this comment.
Severe Vulnerability:
pkg:maven/org.springframework.boot/spring-boot-starter-thymeleaf@2.7.0
0 Critical, 5 Severe, 0 Moderate, 0 Unknown vulnerabilities have been found across 1 dependencies
Components
pkg:maven/org.unbescape/unbescape@1.1.6.RELEASE
SEVERE Vulnerabilities (5)
sonatype-2014-0026
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
CVSS Score: 6.5
CVSS Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N
CWE: CWE-79
CVE-2019-11358
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
jQuery before 3.4.0, as used in Drupal, Backdrop CMS, and other products, mishandles jQuery.extend(true, {}, ...) because of Object.prototype pollution. If an unsanitized source object contained an enumerable proto property, it could extend the native Object.prototype.
CVSS Score: 6.1
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
CWE: CWE-1321
CVE-2020-11023
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
In jQuery versions greater than or equal to 1.0.3 and before 3.5.0, passing HTML containing <option> elements from untrusted sources - even after sanitizing it - to one of jQuery's DOM manipulation methods (i.e. .html(), .append(), and others) may execute untrusted code. This problem is patched in jQuery 3.5.0.
CVSS Score: 6.1
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
CWE: CWE-79
sonatype-2020-0187
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
CVSS Score: 6.1
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
CWE: CWE-79
CVE-2021-23413
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
This affects the package jszip before 3.7.0. Crafting a new zip file with filenames set to Object prototype values (e.g proto, toString, etc) results in a returned object with a modified prototype instance.
CVSS Score: 5.3
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
CWE: CWE-1321
ℹ️ Learn about @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
| Command | Usage |
|---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
| @@ -1 +1,3 @@ | |||
| rootProject.name = "java-server-sdk-example-app" No newline at end of file | |||
| rootProject.name = "java-server-sdk-example-app" | |||
There was a problem hiding this comment.
Severe Vulnerability:
pkg:maven/org.springframework.boot/spring-boot-starter-thymeleaf@2.7.0
0 Critical, 4 Severe, 0 Moderate, 0 Unknown vulnerabilities have been found across 1 dependencies
Components
pkg:maven/org.thymeleaf.extras/thymeleaf-extras-java8time@3.0.4.RELEASE
SEVERE Vulnerabilities (4)
CVE-2019-11358
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
jQuery before 3.4.0, as used in Drupal, Backdrop CMS, and other products, mishandles jQuery.extend(true, {}, ...) because of Object.prototype pollution. If an unsanitized source object contained an enumerable proto property, it could extend the native Object.prototype.
CVSS Score: 6.1
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
CWE: CWE-1321
CVE-2020-11023
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
In jQuery versions greater than or equal to 1.0.3 and before 3.5.0, passing HTML containing <option> elements from untrusted sources - even after sanitizing it - to one of jQuery's DOM manipulation methods (i.e. .html(), .append(), and others) may execute untrusted code. This problem is patched in jQuery 3.5.0.
CVSS Score: 6.1
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
CWE: CWE-79
sonatype-2020-0187
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
CVSS Score: 6.1
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
CWE: CWE-79
CVE-2021-23413
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
This affects the package jszip before 3.7.0. Crafting a new zip file with filenames set to Object prototype values (e.g proto, toString, etc) results in a returned object with a modified prototype instance.
CVSS Score: 5.3
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
CWE: CWE-1321
ℹ️ Learn about @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
| Command | Usage |
|---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
| @@ -1 +1,3 @@ | |||
| rootProject.name = "java-server-sdk-example-app" No newline at end of file | |||
| rootProject.name = "java-server-sdk-example-app" | |||
There was a problem hiding this comment.
Severe Vulnerability:
pkg:maven/org.springframework.boot/spring-boot-starter-thymeleaf@2.7.0
0 Critical, 5 Severe, 0 Moderate, 0 Unknown vulnerabilities have been found across 1 dependencies
Components
pkg:maven/org.attoparser/attoparser@2.0.5.RELEASE
SEVERE Vulnerabilities (5)
sonatype-2014-0026
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
CVSS Score: 6.5
CVSS Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N
CWE: CWE-79
CVE-2019-11358
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
jQuery before 3.4.0, as used in Drupal, Backdrop CMS, and other products, mishandles jQuery.extend(true, {}, ...) because of Object.prototype pollution. If an unsanitized source object contained an enumerable proto property, it could extend the native Object.prototype.
CVSS Score: 6.1
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
CWE: CWE-1321
CVE-2020-11023
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
In jQuery versions greater than or equal to 1.0.3 and before 3.5.0, passing HTML containing <option> elements from untrusted sources - even after sanitizing it - to one of jQuery's DOM manipulation methods (i.e. .html(), .append(), and others) may execute untrusted code. This problem is patched in jQuery 3.5.0.
CVSS Score: 6.1
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
CWE: CWE-79
sonatype-2020-0187
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
CVSS Score: 6.1
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
CWE: CWE-79
CVE-2021-23413
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
This affects the package jszip before 3.7.0. Crafting a new zip file with filenames set to Object prototype values (e.g proto, toString, etc) results in a returned object with a modified prototype instance.
CVSS Score: 5.3
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
CWE: CWE-1321
ℹ️ Learn about @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
| Command | Usage |
|---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
fix javadoc errors and unit test failures
…ult values for cloud bucketing. simplify DVC API Client to support both Cloud and Local bucketing requests
… polling interval. add Etag checking to config requests. update DVCClient (local) to not initialize unused DVC API Client
…aults to 10s timeout per request
…ment Manager to handle a 304 - Not Modified response from project config cdn.
Introduce Environment Config Manager
| // Run `./gradlew build` in the root directory (`cd .. && ./gradlew build`) to build the local version of the SDK | ||
| implementation project(':java-server-sdk') | ||
|
|
||
| testImplementation 'org.springframework.boot:spring-boot-starter-test' |
There was a problem hiding this comment.
Critical Vulnerability:
pkg:maven/org.springframework.boot/spring-boot-starter@2.7.0
1 Critical, 1 Severe, 0 Moderate, 0 Unknown vulnerabilities have been found across 1 dependencies
Components
pkg:maven/org.yaml/snakeyaml@1.30
CRITICAL Vulnerabilities (1)
Uncontrolled Resource Consumption
The package org.yaml:snakeyaml from 0 and before 1.31 are vulnerable to Denial of Service (DoS) due missing to nested depth limitation for collections.
CVSS Score: 7.5
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
CWE: CWE-400
SEVERE Vulnerabilities (1)
Stack-based Buffer Overflow
Using snakeYAML to parse untrusted YAML files may be vulnerable to Denial of Service attacks (DOS). If the parser is running on user supplied input, an attacker may supply content that causes the parser to crash by stack-overflow.
CVSS Score: 6.5
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
CWE: CWE-121
ℹ️ Learn about @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
| Command | Usage |
|---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
Add LocalBucketing with DVCLocalClient.variable function working
Add allFeatures and allVariables methods to local client
Store config in local bucketing from config manager
…mmon interface (currently empty)
…rfaces for DVCOptions and DVCApi
…cloud split DVCOptions into Cloud and Bucketing Options that implement a common interface
Dvc 4209 event queue local bucketing methods
Dvc 4209 on payload failure
DVC-4412: implement EventQueueManager and track
DVC-4450: add event queue options and pass to initEventQueue
DVC-4466 Add Error Handling to Java Local Bucketing SDK
DVC-4350 add local track to example app
| DVCCloudClient dvcCloud; | ||
| DVCLocalClient dvcLocal; |
There was a problem hiding this comment.
should we have separate example apps for Local / Cloud?
There was a problem hiding this comment.
We think the example app is simple enough that it can be kept together! I did add a custom track event button though
| userString = OBJECT_MAPPER.writeValueAsString(user); | ||
|
|
||
| bucketedUserConfig = localBucketing.generateBucketedConfig(serverKey, userString); |
There was a problem hiding this comment.
if this is a common action, might make sense to move this logic to the generateBucketedConfig method.
| */ | ||
| public <T> Variable<T> variable(User user, String key, T defaultValue) { | ||
| validateUser(user); | ||
| localBucketing.setPlatformData(user.getPlatformData().toString()); |
There was a problem hiding this comment.
again this should be done in a constructor somewhere.
…onstructor, parse user logic moved to generateBucketedConfig, and cleanup example app
…ersion of DVC Bucketing WASM file before gradle assemble task is called
| } | ||
| @Builder.Default | ||
| @JsonProperty("sdkVersion") | ||
| private String sdkVersion = "1.1.0"; |
There was a problem hiding this comment.
Anyway to pull this from the Gradle or something so we don't have to manually update this all the time?
There was a problem hiding this comment.
Getting the sdkVersion from the build.gradle file now
There was a problem hiding this comment.
looks like its still manually defined here? any way to have this populate the version during build time? or dynamically at run-time?
There was a problem hiding this comment.
There was a problem hiding this comment.
I've followed this: https://stackoverflow.com/questions/37642837/gradle-make-build-version-available-to-java
So we're getting the sdkVersion this way: User.class.getPackage().getImplementationVersion()
| private void publishEvents(String serverKey, FlushPayload flushPayload) throws InterruptedException { | ||
| Thread publishEventsThread = new Thread(new Runnable() { | ||
| @Override | ||
| public void run() { |
There was a problem hiding this comment.
Does this callback on a different thread? or the same as the calling thread? just worried about threading calling WASM.
There was a problem hiding this comment.
Hm, not sure if I got what you're asking completely but I think when we do publishEventsThread.start() it creates a new thread which then does run() on that newly created thread
https://www.geeksforgeeks.org/difference-between-thread-start-and-thread-run-in-java/
There was a problem hiding this comment.
@kaushalkapasi do we have any thread locking around the calls to WASM?
There was a problem hiding this comment.
no, we currently don't... this is the only area where we are use threads to interact with WASM for the onPayloadSuccess / onPayloadFailure callbacks
There was a problem hiding this comment.
Ok it should be ok... but this is potentially risky, we should probably only call WASM from the same thread.
No description provided.