-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1184 from tubone24/owasp
[skip netlify] owaspzap
- Loading branch information
Showing
13 changed files
with
244 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,77 @@ | ||
name: OWASP ZAP Actions | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
target_website: | ||
default: "https://blog.tubone-project24.xyz" | ||
type: string | ||
env: | ||
cache-version: v1 | ||
jobs: | ||
website-scan: | ||
runs-on: ubuntu-latest | ||
name: DAST (Dynamic Application Security Testing) | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Checkout source code | ||
uses: actions/checkout@v3 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
registry-url: https://npm.pkg.github.com/ | ||
scope: '@tubone24' | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | ||
- name: Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache | ||
${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
node_modules | ||
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: yarn install | ||
env: | ||
GATSBY_GITHUB_CLIENT_SECRET: ${{secrets.GATSBY_GITHUB_CLIENT_SECRET}} | ||
GATSBY_GITHUB_CLIENT_ID: ${{secrets.GATSBY_GITHUB_CLIENT_ID}} | ||
GATSBY_ALGOLIA_SEARCH_API_KEY: ${{secrets.GATSBY_ALGOLIA_SEARCH_API_KEY}} | ||
GATSBY_ALGOLIA_INDEX_NAME: ${{secrets.GATSBY_ALGOLIA_INDEX_NAME}} | ||
GATSBY_ALGOLIA_APP_ID: ${{secrets.GATSBY_ALGOLIA_APP_ID}} | ||
GATSBY_ALGOLIA_ADMIN_API_KEY: ${{secrets.GATSBY_ALGOLIA_ADMIN_API_KEY}} | ||
GATSBY_GITHUB_SHA: ${{ github.sha }} | ||
FAUNADB_SERVER_SECRET: ${{secrets.FAUNADB_SERVER_SECRET}} | ||
NETLIFY_ENV: deploy-preview | ||
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
run: yarn install --frozen-lockfile | ||
- name: yarn build | ||
env: | ||
GATSBY_GITHUB_CLIENT_SECRET: ${{secrets.GATSBY_GITHUB_CLIENT_SECRET}} | ||
GATSBY_GITHUB_CLIENT_ID: ${{secrets.GATSBY_GITHUB_CLIENT_ID}} | ||
GATSBY_ALGOLIA_SEARCH_API_KEY: ${{secrets.GATSBY_ALGOLIA_SEARCH_API_KEY}} | ||
GATSBY_ALGOLIA_INDEX_NAME: ${{secrets.GATSBY_ALGOLIA_INDEX_NAME}} | ||
GATSBY_ALGOLIA_APP_ID: ${{secrets.GATSBY_ALGOLIA_APP_ID}} | ||
GATSBY_ALGOLIA_ADMIN_API_KEY: ${{secrets.GATSBY_ALGOLIA_ADMIN_API_KEY}} | ||
GATSBY_GITHUB_SHA: ${{ github.sha }} | ||
FAUNADB_SERVER_SECRET: ${{secrets.FAUNADB_SERVER_SECRET}} | ||
NETLIFY_ENV: deploy-preview | ||
run: yarn build | ||
- name: Action Full Scan | ||
uses: zaproxy/[email protected] | ||
run: | | ||
chmod 777 owasp/zap | ||
docker-compose -f owasp/docker-compose-ci.yml up -d | ||
docker-compose -f owasp/docker-compose-ci.yml exec -T owasp zap-full-scan.py -t http://web:9000 -r report.html -a -d -j -I -z "-config alert.maxInstances=0 -config view.locale=ja_JP" | ||
- name: Deploy Report | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./owasp/zap/ | ||
destination_dir: owasp | ||
keep_files: true | ||
exclude_assets: '*.cer,*.key' | ||
- name: push report | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
docker_name: owasp/zap2docker-stable | ||
target: ${{ inputs.target_website }} | ||
cmd_options: > | ||
-a | ||
-j | ||
-z " | ||
-config alert.maxInstances=0 | ||
-config view.locale=ja_JP | ||
" | ||
name: owasp-report | ||
path: owasp/zap/report.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,8 +42,6 @@ jobs: | |
~/.cache | ||
${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
node_modules | ||
.cache | ||
public | ||
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
|
@@ -126,8 +124,6 @@ jobs: | |
~/.cache | ||
${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
node_modules | ||
.cache | ||
public | ||
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
|
@@ -175,8 +171,6 @@ jobs: | |
~/.cache | ||
${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
node_modules | ||
.cache | ||
public | ||
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
|
@@ -262,8 +256,6 @@ jobs: | |
~/.cache | ||
${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
node_modules | ||
.cache | ||
public | ||
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
|
@@ -330,8 +322,6 @@ jobs: | |
~/.cache | ||
${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
node_modules | ||
.cache | ||
public | ||
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
|
@@ -360,10 +350,10 @@ jobs: | |
- name: summarize | ||
run: | | ||
cat test/memlab/data/out/leaks.txt | ||
sed -i '1s/^/## Memlab leaks report\\n\`\`\`\\n/g' test/memlab/data/out/leaks.txt | ||
sed -i '1s/^/## Memlab leaks report\\n\<details\>\\n\\n\`\`\`\\n/g' test/memlab/data/out/leaks.txt | ||
sed -i -z 's/\n/\\n/g' test/memlab/data/out/leaks.txt | ||
sed -i -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?m//g" test/memlab/data/out/leaks.txt | ||
echo -n "\\n \`\`\` \\n " >> test/memlab/data/out/leaks.txt | ||
echo -n "\\n \`\`\` \\n</details>\\n " >> test/memlab/data/out/leaks.txt | ||
- name: Post Memlab Report Comment | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
@@ -394,8 +384,6 @@ jobs: | |
~/.cache | ||
${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
node_modules | ||
.cache | ||
public | ||
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
|
@@ -432,17 +420,28 @@ jobs: | |
echo '# Snyk vulnerability report' >> summarize.txt | ||
echo '## OSS packages' >> summarize.txt | ||
echo '' >> summarize.txt | ||
echo '' >> summarize.txt | ||
echo '<details>' >> summarize.txt | ||
cat snyk.txt | sed -z 's/\n/\\n/g' >> summarize.txt | ||
echo '</details>' >> summarize.txt | ||
echo '' >> summarize.txt | ||
echo '' >> summarize.txt | ||
echo '## Application' >> summarize.txt | ||
echo '' >> summarize.txt | ||
echo '' >> summarize.txt | ||
echo '<details>' >> summarize.txt | ||
cat snyk_code.txt | sed -z 's/\n/\\n/g' >> summarize.txt | ||
echo '</details>' >> summarize.txt | ||
echo '' >> summarize.txt | ||
echo '' >> summarize.txt | ||
echo '## IaC' >> summarize.txt | ||
echo '' >> summarize.txt | ||
echo '' >> summarize.txt | ||
echo '<details>' >> summarize.txt | ||
echo '' >> summarize.txt | ||
cat snyk_iac.txt | sed -z 's/\n/\\n/g' >> summarize.txt | ||
echo '' >> summarize.txt | ||
echo '</details>' >> summarize.txt | ||
sed -i -z 's/\n/\\n/g' summarize.txt | ||
sed -i 's/Testing \.\.\.\.//g' summarize.txt | ||
sed -i 's/Testing \. \.\.\.//g' summarize.txt | ||
|
@@ -461,7 +460,7 @@ jobs: | |
- name: Checkout source code | ||
uses: actions/checkout@v3 | ||
- name: "depcheck" | ||
uses: tubone24/depcheck_action@v1.1.0 | ||
uses: tubone24/depcheck_action@v1.2.0 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PR_COMMENT_URL: ${{ github.event.pull_request.comments_url }} | ||
|
@@ -485,8 +484,6 @@ jobs: | |
~/.cache | ||
${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
node_modules | ||
.cache | ||
public | ||
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
|
@@ -519,8 +516,6 @@ jobs: | |
~/.cache | ||
${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
node_modules | ||
.cache | ||
public | ||
key: ${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | ||
|
@@ -577,3 +572,18 @@ jobs: | |
-d "{\"body\": \"$(cat cli.txt)\"}" \ | ||
${URL} | ||
webscreenshot: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
- check-skip-flags | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Capture Webpage Screenshot | ||
if: ${{ !contains(needs.check-skip-flags.outputs.head-commit-message, '[skip netlify]') }} | ||
uses: saadmk11/[email protected] | ||
with: | ||
upload_to: github_branch | ||
capture_changed_html_files: yes | ||
capture_urls: ${{ needs.build.outputs.draftUrl }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,3 +41,7 @@ test/memlab/data | |
|
||
# synk | ||
.dccache | ||
|
||
# OWASPZAP | ||
owasp/zap/*.key | ||
owasp/zap/*.cer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM node:16.17.0-buster-slim | ||
|
||
ENV NODE_ENV production | ||
WORKDIR /app | ||
COPY ["package.json", "./"] | ||
COPY ["public", "public"] | ||
RUN npm install -g serve | ||
CMD ["serve", "-s", "-l", "9000", "public"] |
Oops, something went wrong.