Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit b219be1

Browse files
committed
feat: Initial release
0 parents  commit b219be1

26 files changed

+1172
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
on:
2+
push:
3+
branches:
4+
- '**'
5+
6+
env:
7+
DIST_DIR: ${{ github.workspace }}/build/dist
8+
9+
name: Build development release
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check-out source code
15+
uses: actions/checkout@v2
16+
17+
- name: Define development release info
18+
if: startsWith(github.ref, 'refs/heads/')
19+
run: |
20+
branch="${GITHUB_REF#refs/heads/}"
21+
tag="dev_${branch//[^a-zA-Z0-9_.-]/.}" # Replace all special characters by a dot
22+
echo DO_BUILD=true >> $GITHUB_ENV # We always want to do a build if we're building a branch
23+
echo BRANCH=${branch} >> $GITHUB_ENV
24+
echo RELEASE_TAG=${tag} >> $GITHUB_ENV
25+
26+
if git ls-remote --exit-code origin refs/tags/${tag} >/dev/null 2>&1; then
27+
echo "Found tag ${tag}, development release will be published"
28+
echo DO_RELEASE=true >> $GITHUB_ENV
29+
else
30+
echo "Tag ${tag} does not exist, no development release will be published"
31+
fi
32+
33+
- name: Build development release
34+
if: env.DO_BUILD
35+
run: ./gradlew dist distThirdParty
36+
37+
- name: Publish build artifacts
38+
if: env.DO_BUILD
39+
uses: actions/upload-artifact@v2
40+
with:
41+
name: build_artifacts
42+
path: ${{ env.DIST_DIR }}
43+
44+
- name: Update development release tag
45+
uses: richardsimko/update-tag@v1
46+
if: env.DO_RELEASE
47+
with:
48+
tag_name: ${{ env.RELEASE_TAG }}
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Create pre-release
53+
if: env.DO_RELEASE
54+
run: |
55+
files=$(find "${{ env.DIST_DIR }}" -type f -printf "%p ")
56+
gh release delete ${{ env.RELEASE_TAG }} -y || true
57+
gh release create ${{ env.RELEASE_TAG }} -p -t "Development Release - ${{ env.BRANCH }} branch" -n 'See `Assets` section below for latest build artifacts' ${files}
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
61+
62+
63+
64+
65+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
env:
7+
DIST_DIR: ${{ github.workspace }}/build/dist
8+
9+
name: Build production release
10+
jobs:
11+
build-and-release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check-out source code
15+
uses: actions/checkout@v2
16+
17+
- name: Generate and process release PR
18+
id: release_please
19+
uses: GoogleCloudPlatform/release-please-action@v2
20+
with:
21+
release-type: simple
22+
package-name: ${{ github.event.repository.name }}
23+
24+
- name: Define production release info
25+
if: steps.release_please.outputs.release_created
26+
run: |
27+
tag=${{steps.release_please.outputs.tag_name}}
28+
version=${{steps.release_please.outputs.version}}
29+
major=${{steps.release_please.outputs.major}}
30+
minor=${{steps.release_please.outputs.minor}}
31+
patch=${{steps.release_please.outputs.patch}}
32+
echo DO_RELEASE=true >> $GITHUB_ENV
33+
echo RELEASE_TAG=${tag} >> $GITHUB_ENV
34+
echo RELEASE_VERSION=${version} >> $GITHUB_ENV
35+
36+
- name: Build production release
37+
if: env.DO_RELEASE
38+
run: ./gradlew dist distThirdParty -Pversion=${{env.RELEASE_VERSION}}
39+
40+
- name: Upload assets to release
41+
if: env.DO_RELEASE
42+
run: |
43+
tag=${{ steps.release_please.outputs.tag_name }}
44+
files=$(find "${{ env.DIST_DIR }}" -type f -printf "%p ")
45+
gh release upload "${tag}" $files --clobber
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.gradle/
2+
.shelf/
3+
build/
4+
out/
5+
dist/
6+
*.iml
7+
*.iws
8+
*.ipr
9+
*~
10+
rebel.xml
11+
.idea/
12+
/fortifyRepository
13+
.settings/
14+
bin/
15+
lombok.config
16+
.classpath
17+
.project
18+
*.fpr

LICENSE.TXT

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
The MIT License (MIT)
2+
(c) Copyright 2020 Micro Focus or one of its affiliates, a Micro Focus company
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a
5+
copy of this software and associated documentation files (the
6+
"Software"), to deal in the Software without restriction, including without
7+
limitation the rights to use, copy, modify, merge, publish, distribute,
8+
sublicense, and/or sell copies of the Software, and to permit persons to
9+
whom the Software is furnished to do so, subject to the following
10+
conditions:
11+
12+
The above copyright notice and this permission notice shall be included
13+
in all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
16+
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
17+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
18+
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23+
IN THE SOFTWARE.

README.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
<x-tag-head>
2+
<x-tag-meta http-equiv="X-UA-Compatible" content="IE=edge"/>
3+
4+
<x-tag-script language="JavaScript"><!--
5+
<X-INCLUDE url="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.0.0/build/highlight.min.js"/>
6+
--></x-tag-script>
7+
8+
<x-tag-script language="JavaScript"><!--
9+
<X-INCLUDE url="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" />
10+
--></x-tag-script>
11+
12+
<x-tag-script language="JavaScript"><!--
13+
<X-INCLUDE url="${gradleHelpersLocation}/spa_readme.js" />
14+
--></x-tag-script>
15+
16+
<x-tag-style><!--
17+
<X-INCLUDE url="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.0.0/build/styles/github.min.css" />
18+
--></x-tag-style>
19+
20+
<x-tag-style><!--
21+
<X-INCLUDE url="${gradleHelpersLocation}/spa_readme.css" />
22+
--></x-tag-style>
23+
</x-tag-head>
24+
25+
# Fortify SSC Parser Plugin for Local PHP Security Checker
26+
27+
## Introduction
28+
29+
This Fortify SSC parser plugin allows for importing scan results from [Local PHP Security Checker](https://github.com/fabpot/local-php-security-checker).
30+
31+
### Related Links
32+
33+
* **Downloads**: https://github.com/fortify-ps/fortify-ssc-parser-php-security-checker/releases
34+
* _Development releases may be unstable or non-functional. The `*-thirdparty.zip` file is for informational purposes only and does not need to be downloaded._
35+
* **Sample input files**: [sampleData](sampleData)
36+
* **GitHub**: https://github.com/fortify-ps/fortify-ssc-parser-php-security-checker
37+
* **Automated builds**: https://github.com/fortify-ps/fortify-ssc-parser-php-security-checker/actions
38+
* **Local PHP Security Checker repository**: https://github.com/fabpot/local-php-security-checker
39+
40+
41+
## Plugin Installation
42+
43+
These sections describe how to install, upgrade and uninstall the plugin.
44+
45+
### Install & Upgrade
46+
47+
* Obtain the plugin binary jar file
48+
* Either download from Bintray (see [Related Links](#related-links))
49+
* Or by building yourself (see [Developers](#developers))
50+
* If you already have another version of the plugin installed, first uninstall the previously
51+
installed version of the plugin by following the steps under [Uninstall](#uninstall) below
52+
* In Fortify Software Security Center:
53+
* Navigate to Administration->Plugins->Parsers
54+
* Click the `NEW` button
55+
* Accept the warning
56+
* Upload the plugin jar file
57+
* Enable the plugin by clicking the `ENABLE` button
58+
59+
### Uninstall
60+
61+
* In Fortify Software Security Center:
62+
* Navigate to Administration->Plugins->Parsers
63+
* Select the parser plugin that you want to uninstall
64+
* Click the `DISABLE` button
65+
* Click the `REMOVE` button
66+
67+
68+
## Obtain results
69+
70+
Please see the Local PHP Security Checker documentation for details on checking applications and
71+
generating reports. Note that the SSC parser plugin requires the uploaded reports to be in JSON
72+
format.
73+
74+
## Upload results
75+
76+
SSC web interface (manual upload):
77+
78+
* Navigate to the Artifacts tab of your application version
79+
* Click the `UPLOAD` button
80+
* Click the `ADD FILES` button, and select the JSON file to upload
81+
* Enable the `3rd party results` check box
82+
* Select the `PHP_SECCHECK` type
83+
84+
SSC clients (FortifyClient, Maven plugin, ...):
85+
86+
* Generate a scan.info file containing a single line as follows:
87+
`engineType=PHP_SECCHECK`
88+
* Generate a zip file containing the following:
89+
* The scan.info file generated in the previous step
90+
* The JSON file containing scan results
91+
* Upload the zip file generated in the previous step to SSC
92+
* Using any SSC client, for example FortifyClient
93+
* Similar to how you would upload an FPR file
94+
95+
96+
97+
## Developers
98+
99+
The following sections provide information that may be useful for developers of this utility.
100+
101+
### IDE's
102+
103+
This project uses Lombok. In order to have your IDE compile this project without errors,
104+
you may need to add Lombok support to your IDE. Please see https://projectlombok.org/setup/overview
105+
for more information.
106+
107+
### Gradle Wrapper
108+
109+
It is strongly recommended to build this project using the included Gradle Wrapper
110+
scripts; using other Gradle versions may result in build errors and other issues.
111+
112+
The Gradle build uses various helper scripts from https://github.com/fortify-ps/gradle-helpers;
113+
please refer to the documentation and comments in included scripts for more information.
114+
115+
### Common Commands
116+
117+
All commands listed below use Linux/bash notation; adjust accordingly if you
118+
are running on a different platform. All commands are to be executed from
119+
the main project directory.
120+
121+
* `./gradlew tasks --all`: List all available tasks
122+
* Build: (plugin binary will be stored in `build/libs`)
123+
* `./gradlew clean build`: Clean and build the project
124+
* `./gradlew build`: Build the project without cleaning
125+
* `./gradlew dist distThirdParty`: Build distribution zip and third-party information bundle
126+
* `./fortify-scan.sh`: Run a Fortify scan; requires Fortify SCA to be installed
127+
128+
### Automated Builds
129+
130+
This project uses GitHub Actions workflows to perform automated builds for both development and production releases. All pushes to the main branch qualify for building a production release. Commits on the main branch should use [Conventional Commit Messages](https://www.conventionalcommits.org/en/v1.0.0/); it is recommended to also use conventional commit messages on any other branches.
131+
132+
User-facing commits (features or fixes) on the main branch will trigger the [release-please-action](https://github.com/google-github-actions/release-please-action) to automatically create a pull request for publishing a release version. This pull request contains an automatically generated CHANGELOG.md together with a version.txt based on the conventional commit messages on the main branch. Merging such a pull request will automatically publish the production binaries and Docker images to the locations described in the [Related Links](#related-links) section.
133+
134+
Every push to a branch in the GitHub repository will also automatically trigger a development release to be built. By default, development releases are only published as build job artifacts. However, if a tag named `dev_<branch-name>` exists, then development releases are also published to the locations described in the [Related Links](#related-links) section. The `dev_<branch-name>` tag will be automatically updated to the commit that triggered the build.
135+
136+
137+
## License
138+
<x-insert text="<!--"/>
139+
140+
See [LICENSE.TXT](LICENSE.TXT)
141+
142+
<x-insert text="-->"/>
143+
144+
<x-include url="file:LICENSE.TXT"/>
145+

build.gradle

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
plugins {
2+
id "io.freefair.lombok" version "5.3.0"
3+
id 'com.github.jk1.dependency-license-report' version '1.16'
4+
id "org.kordamp.gradle.markdown" version "2.2.0"
5+
}
6+
7+
group 'com.fortify.ssc.parser.symphony-security-checker'
8+
ext.getVersion = {
9+
def result = project.findProperty('version');
10+
return !result || result=='unspecified' ? new Date().format('0.yyyyMMdd.HHmmss') : result;
11+
}
12+
version = ext.getVersion();
13+
ext.sscParserPluginVersion = project.version
14+
15+
ext {
16+
gradleHelpersLocation = "https://raw.githubusercontent.com/fortify-ps/gradle-helpers/1.5"
17+
}
18+
19+
apply from: "${gradleHelpersLocation}/repo-helper.gradle"
20+
apply from: "${gradleHelpersLocation}/junit-helper.gradle"
21+
apply from: "${gradleHelpersLocation}/fortify-helper.gradle"
22+
apply from: "${gradleHelpersLocation}/ssc-parser-plugin-helper.gradle"
23+
apply from: "${gradleHelpersLocation}/thirdparty-helper.gradle"
24+
apply from: "${gradleHelpersLocation}/readme2html.gradle"
25+
26+
apply plugin: 'java'
27+
sourceCompatibility = 1.8
28+
29+
sourceSets {
30+
test {
31+
resources {
32+
srcDir "sampleData"
33+
}
34+
}
35+
}
36+
37+
configurations.all {
38+
// Don't cache modules that may change (i.e. snapshots)
39+
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
40+
}
41+
42+
dependencies {
43+
implementationExport(group: 'com.fortify.ssc.parser.util', name: 'fortify-ssc-parser-util-json', version:'1.4', changing: false) { transitive = true }
44+
}
45+
46+
task dist(type: Zip) {
47+
dependsOn 'build', 'readme2html'
48+
archiveFileName = "${rootProject.name}-${project.version}.zip"
49+
destinationDirectory = file("$buildDir/dist")
50+
from("${buildDir}/${libsDirName}") {
51+
include "${rootProject.name}-${project.version}.jar"
52+
}
53+
from "${buildDir}/html"
54+
from("${projectDir}") {
55+
include "sampleData/**/*"
56+
include "LICENSE.TXT"
57+
}
58+
}

fortify-scan.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
# Set scan options
4+
# Modular scan doesn't work properly yet, so for now we just add the fortify-ssc-parser-util build model
5+
# Note that either approach requires fortify-ssc-parser-util to be translated/scanned on the same machine
6+
# before running this script.
7+
#scanOpts="-include-modules fortify-ssc-parser-util -scan"
8+
scanOpts="-b fortify-ssc-parser-util -scan"
9+
10+
# Load and execute actual scan script from GitHub
11+
curl -s https://raw.githubusercontent.com/fortify-ps/gradle-helpers/1.0/fortify-scan.sh | bash -s - ${scanOpts}

gradle/wrapper/gradle-wrapper.jar

57.8 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)