Skip to content

Commit

Permalink
fix tests and cve
Browse files Browse the repository at this point in the history
  • Loading branch information
ErmiasG committed Mar 7, 2024
1 parent fad2305 commit cc786ef
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 20 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/hopsworks-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
java-version: '8'
distribution: 'adopt'
cache: 'maven'

cache-dependency-path: 'pom.xml'
- name: Set up .m2 settings.xml
run: mkdir -p ~/.m2 && echo "<settings><servers><server><id>nvd</id><password>${{ secrets.NVD_API_KEY }}</password></server></servers></settings>" > ~/.m2/settings.xml
- name: Run vulnerability checker
run: mvn clean install -Powasp-dependency-check,spot-bugs -DskipTests
14 changes: 8 additions & 6 deletions hopsworks-IT/src/test/ruby/spec/haas_user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@
end

it "should allow starting new executions" do
start_execution(@project[:id], @job[:name])
# Job is does not have an executable
# 400 Job application file does not exist: hdfs:///Projects/@project/Resources/dummy_job.py
start_execution(@project[:id], @job[:name], expected_status: 400)
end

it "should allow stopping executions" do
Expand All @@ -80,7 +82,7 @@
it "should get all alerts" do
get_project_alerts(@project)
expect_status_details(200)
expect(json_body[:count]).to eq(4)
expect(json_body[:count]).to eq(6)
end

it "should create alert" do
Expand All @@ -96,7 +98,7 @@
expect_status_details(204)

get_project_alerts(@project)
expect(json_body[:count]).to eq(4)
expect(json_body[:count]).to eq(6)
end

it "should get job alerts" do
Expand Down Expand Up @@ -175,7 +177,7 @@
end

it "should allow starting new executions" do
start_execution(@project[:id], @job[:name])
start_execution(@project[:id], @job[:name], expected_status: 400)
end

it "should allow stopping executions" do
Expand All @@ -185,7 +187,7 @@
it "should get all alerts" do
get_project_alerts(@project)
expect_status_details(200)
expect(json_body[:count]).to eq(4)
expect(json_body[:count]).to eq(6)
end

it "should create alert" do
Expand All @@ -201,7 +203,7 @@
expect_status_details(204)

get_project_alerts(@project)
expect(json_body[:count]).to eq(4)
expect(json_body[:count]).to eq(6)
end

it "should get job alerts" do
Expand Down
3 changes: 2 additions & 1 deletion hopsworks-IT/src/test/ruby/spec/helpers/jupyter_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def update_jupyter(project, settings, expected_status: 200)
expect_status_details(expected_status)
end

def create_notebook(jupyter_port, path="")
def create_notebook(jupyter_port, path: "Jupyter")
# Permission denied: Untitled.ipynb if no path is provided
notebook_name = SecureRandom.alphanumeric(10) + ".ipynb"
payload = {
'name' => notebook_name,
Expand Down
4 changes: 2 additions & 2 deletions hopsworks-IT/src/test/ruby/spec/jupyter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

kernel_id = ""
auth_token(token) do
temp_name = create_notebook(port, jupyter_home)
temp_name = create_notebook(port, path: jupyter_home)
update_notebook(port, get_code_content, temp_name)
_, kernel_id = create_notebook_session(port, temp_name, temp_name)
end
Expand Down Expand Up @@ -148,7 +148,7 @@
config.headers["Authorization"] = "token #{token}"
end

temp_name = create_notebook(port, jupyter_home)
temp_name = create_notebook(port, path: jupyter_home)
notebook_json = read_notebook("#{ENV['PROJECT_DIR']}/hopsworks-IT/src/test/ruby/spec/auxiliary/#{notebook_name}")

update_notebook(port, notebook_json, temp_name)
Expand Down
8 changes: 5 additions & 3 deletions hopsworks-IT/src/test/ruby/spec/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,11 @@
get_secrets_name
items = json_body[:items]
found = false
items.each do |item|
if item[:name].eql? secret_name
found = true
unless items.nil? || items.empty?
items.each do |item|
if item[:name].eql? secret_name
found = true
end
end
end

Expand Down
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,10 @@
<groupId>com.predic8</groupId>
<artifactId>soa-model-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.bitbucket.b_c</groupId>
<artifactId>jose4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -1099,9 +1103,10 @@
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>6.2.2</version>
<version>9.0.9</version>
<inherited>false</inherited>
<configuration>
<nvdApiServerId>nvd</nvdApiServerId>
<suppressionFiles>
<suppressionFile>project-suppression.xml</suppressionFile>
</suppressionFiles>
Expand Down
12 changes: 6 additions & 6 deletions project-suppression.xml
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,18 @@
<cve>CVE-2022-1471</cve>
</suppress>
<!-- No fix in Payara 5.2022.5 which is the final release of Payara 5 Community. -->
<suppress>
<notes><![CDATA[file name: payara-embedded-web-5.2022.5.jar (shaded: com.hazelcast:hazelcast:4.2.4)]]></notes>
<packageUrl regex="true">^pkg:maven/com\.hazelcast/hazelcast@.*$</packageUrl>
<cve>CVE-2022-0265</cve>
<cve>CVE-2022-36437</cve>
</suppress>
<suppress>
<notes><![CDATA[file name: payara-embedded-web-5.2022.5.jar]]></notes>
<cve>CVE-2023-28462</cve>
<cve>CVE-2016-4055</cve>
<cve>CVE-2023-33265</cve>
</suppress>
<suppress>
<notes><![CDATA[file name: payara-embedded-web-5.2022.5.jar (shaded: com.hazelcast:hazelcast:4.2.5)]]></notes>
<packageUrl regex="true">^pkg:maven/com\.hazelcast/hazelcast@.*$</packageUrl>
<cve>CVE-2023-45859</cve>
<cve>CVE-2022-36437</cve>
</suppress>
<!-- Not used -->
<suppress>
<notes><![CDATA[file name: hive-storage-api-2.6.1.2.jar]]></notes>
Expand Down

0 comments on commit cc786ef

Please sign in to comment.