Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4d822ef
Test Synopsys GHA with Black Duck and prcomment
Apr 5, 2023
8255add
Test Synopsys GHA with Black Duck and prcomment. Attempt-2
Apr 5, 2023
38da8e8
Commit for Synopsys GHA pull request test
Apr 5, 2023
cc50010
Enabled prcomment and auto fix for testing
koshmack Apr 6, 2023
36ffe8b
Modified printed string for test
Apr 6, 2023
e4ef9d7
Update synopsys-blackduck.yml
koshmack Apr 6, 2023
68d9c82
Update synopsys-blackduck.yml
koshmack Apr 10, 2023
d64fe76
Update synopsys-blackduck.yml
koshmack Apr 10, 2023
6049c4d
Update synopsys-blackduck.yml
koshmack Apr 12, 2023
87853f3
Change to capital for token to see if it works
koshmack Apr 12, 2023
e0637ef
Switch to self-hosted bc BD PR comment requires it
koshmack Apr 12, 2023
63167a3
Synopsys GHA PR comment test
Apr 13, 2023
4695574
Merge branch 'master' into demo-dev
koshmack Apr 13, 2023
6ac5340
Trying PR comment with rapid scan
Apr 13, 2023
8af0c75
Merge branch 'demo-dev' of https://github.com/koshmack/java-sec-code …
Apr 13, 2023
bce69ba
Try BD full scan
Apr 13, 2023
4c4232c
Try BD full scan 2
Apr 13, 2023
3f560c8
Try BD full scan 3
Apr 13, 2023
ddf53f9
Switch to Rapid Full Scan
Apr 14, 2023
d4324e7
Switch to Rapid Full Scan attempt 2
Apr 14, 2023
8d0fed5
Switch to Rapid Full Scan attempt 2
Apr 14, 2023
534dae6
Set default to Scan failure sverities
Apr 14, 2023
0642e10
Add more java code to see if vulns are detected
Apr 14, 2023
c72cb70
Switch to Rapid scan
koshmack Apr 15, 2023
bd5f62a
Switch to full scan
koshmack Apr 15, 2023
30c331d
Workaround Black Duck full scan SCM related check
koshmack Apr 15, 2023
0f31213
Test with SCM-Connected BD project
koshmack Apr 15, 2023
32ec4df
Set --blackduck.trust.cert to true
koshmack Apr 16, 2023
c4f462d
Wait until receiving results to test PR comment
koshmack Apr 17, 2023
ed9d345
Switch to rapid scan
koshmack Apr 17, 2023
6250dee
Test with Rapid Scan to get Policy Violations
koshmack Apr 21, 2023
0af6449
Added Polaris but without PR automation
Apr 21, 2023
df97b0d
Fixed typo in Polaris params
Apr 21, 2023
a352193
CI test with CNC
Apr 25, 2023
61ab314
a few changes following a sample template
Apr 26, 2023
8b6b37b
Added actions java to resolve dependency issues
Apr 26, 2023
c284a08
Added actions java to resolve dependency issues attempt-2
Apr 26, 2023
67bf198
Added actions java and appont java 11
Apr 26, 2023
1ec0f92
Added a step to resolve dependency to gzip
Apr 26, 2023
5a31dec
Rever the change for atp-get gzip bc unncessesary
Apr 26, 2023
fa1955e
Polaris test
Apr 28, 2023
cbdd57a
Enabled BD scan with no project and version
koshmack May 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/workflows/synopsys-ast.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Synopsys Security Testing for Black Duck

on:
push:
branches: [ master ]

pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Java JDK
uses: actions/setup-java@v3
with:
java-version: 11
distribution: microsoft
cache: maven
- name: Synopsys Action Black Duck
uses: synopsys-sig/synopsys-action@v1.2.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

blackduck_apiToken: ${{ secrets.BLACKDUCK_API_TOKEN }}
blackduck_url: ${{ secrets.BLACKDUCK_URL }}
blackduck_scan_full: false
blackduck_automation_fixpr: false
blackduck_automation_prcomment: true
# Optional parameter, but usually specified - the location of the Synopsys Bridge software
# The Synopsys Bridge software distribution is platform specific - this must match the host OS
# of your runner. For example in this case, we are using the latest version for Linux.
#bridge_download_url: ${{ env.LINUX_BRIDGE_URL }}
env:
# DETECT_PROJECT_NAME: ${{ vars.BLACKDUCK_PROJECT }}
# DETECT_PROJECT_VERSION_NAME: demo-dev
BLACKDUCK_TRUST_CERT: true
#DETECT_BLACKDUCK_RAPID_COMPARE_MODE: BOM_COMPARE_STRICT
- name: Synopsys Action Polaris
uses: synopsys-sig/synopsys-action@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

polaris_serverUrl: ${{ secrets.POLARIS_SERVER_URL }}
polaris_accessToken: ${{ secrets.POLARIS_ACCESS_TOKEN }}
polaris_application_name: ${{ vars.POLARIS_APPLICATION_NAME }}
polaris_project_name: ${{ vars.POLARIS_PROJECT_NAME }}
polaris_assessment_types: ${{ vars.POLARIS_ASSESSMENT_TYPES }}
# Waiting for automation
#polaris_automation_fixpr: false
#polaris_automation_prcomment: true
# Optional parameter, but usually specified - the location of the Synopsys Bridge software
# The Synopsys Bridge software distribution is platform specific - this must match the host OS
# of your runner. For example in this case, we are using the latest version for Linux.
#bridge_download_url: ${{ env.LINUX_BRIDGE_URL }}
#- name: Synopsys Action Coverity
# uses: synopsys-sig/synopsys-action@v1.1.0
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}

# coverity_url: ${{ secrets.COVERITY_URL }}
# coverity_user: ${{ secrets.COVERITY_USER }}
# coverity_passphrase: ${{ secrets.COVERITY_PASSPHRASE }}
# coverity_project_name: ${{ vars.COVERITY_PROJECT_NAME }}
# coverity_stream_name: ${{ github.event.repository.name }}-${{ github.base_ref }}
# Optionally you may specify the ID number of a saved view to apply as a "break the build" policy.
# If any defects are found within this view when applied to the project, the build will be failed
# with an exit code.
#coverity_policy_view: 100001
# Below fields are optional
#coverity_repository_name: ${{ secrets.COVERITY_REPOSITORY_NAME }}
#coverity_branch_name: ${{ secrets.COVERITY_BRANCH_NAME }}
41 changes: 0 additions & 41 deletions .github/workflows/synopsys-blackduck.yml

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Target Project for Synopsys Github Actions Test

# Java Sec Code


Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/joychou/RMI/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void main(String args[]) {
LocateRegistry.createRegistry(1099);
Registry registry = LocateRegistry.getRegistry();
registry.bind("Hello", stub);
System.out.println("绑定1099端口成功");
System.out.println("绑定1099端口成功. It is probably saying successful creation of registory.");
} catch (Exception e) {
System.err.println("Server exception: " + e.toString());
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
public class ForwardNullExample {
public static Object callA() {
// This causes a FORWARD_NULL defect report
return testA(null);
}

public static Object callB() {
// No defect report
return testA(new Object());
}

public static String testA(Object o) {
return o.toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
public class HelloWorld {
public static void main(String[] args) {
//String secret = "It's a secret to everybody.";
//try { javax.crypto.spec.SecretKeySpec keyspec = new javax.crypto.spec.SecretKeySpec(secret.getBytes("UTF-8"), "AES"); }
//catch (Exception e) { System.out.println("Something went wrong."); }
System.out.println("Hello World!");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
public class NullReturnsExample {
static int count = 0;

public static Object returnA() {
return null;
}
public static Object returnB() {
return new Object();
}
public static void testA() {
// This demonstrates a very straightforward null-return bug
returnA().toString();
}
public static void testB() {
// no bug here
returnB().toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
public class ReverseNullExample {
public static Object callA(Object o) {
return "hi";
}
public static Object callB(Object o) {
return o.toString();
}

public static String testA(Object o) {
// callB dereferences o, making the later check a bug
// if this were callA, no bug would be reported here.
System.out.println(callB(o));
if( o == null ) {
System.out.println("It's null");
}
return "done";
}
}