Skip to content

Commit

Permalink
Merge pull request #1266 from tubone24/code_scan
Browse files Browse the repository at this point in the history
Code scan
  • Loading branch information
tubone24 authored Jan 19, 2023
2 parents 400044e + 00942de commit 75841cd
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 2 deletions.
152 changes: 152 additions & 0 deletions .github/workflows/previewDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,34 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: yarn install --frozen-lockfile
# create-cache-e2e:
# runs-on: ubuntu-latest
# container: cypress/browsers:node16.18.0-chrome107-ff106-edge
# steps:
# - name: Checkout source code
# uses: actions/checkout@v3
# - name: Setup Node
# uses: actions/setup-node@v3
# with:
# node-version: 16.x
# - 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-${{ env.cache-version }}-
# - name: yarn install
# env:
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
# run: yarn install --frozen-lockfile
test:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -149,6 +177,130 @@ jobs:
GITHUB_PULL_REQUEST_NUMBER: ${{ steps.get-pr-num.outputs.prnum }}
BRANCH_NAME: "screenshot"
run: deno run --allow-env --allow-read --allow-net scripts/uploadScreenShot.ts
# test-e2e-chrome:
# runs-on: ubuntu-latest
# container: cypress/browsers:node16.18.0-chrome107-ff106-edge
# steps:
# - name: Checkout source code
# uses: actions/checkout@v3
# - name: install apt
# run: |
# apt-get -y update
# apt-get -y install fonts-noto unzip build-essential
# - uses: denoland/setup-deno@v1
# with:
# deno-version: 'v1.x'
# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}"
# - name: Cache
# uses: actions/cache/restore@v3
# with:
# path: |
# ~/.cache
# ${{ steps.yarn-cache-dir-path.outputs.dir }}
# node_modules
# key: ${{ runner.os }}-e2e-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-e2e-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }}
# ${{ runner.os }}-e2e-build-${{ env.cache-version }}-
# - name: yarn install
# env:
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
# run: yarn install --frozen-lockfile
# - name: chmod
# run: |
# chmod 777 -R /github/home/
# chmod 777 -R src/
# chmod 777 -R /__w/blog/blog/
# chmod 777 -R /root/
# - name: Test e2e
# 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 test:e2e:ci:chrome
# - name: Get PR Number
# id: get-pr-num
# run: echo "prnum=$(echo "${GITHUB_REF}" | sed -e 's/[^0-9]//g')" >> "${GITHUB_OUTPUT}"
# - name: Add file
# env:
# FILE_PATH: ./cypress/videos/e2e/main.spec.ts.mp4
# FILE_NAME: video-chrome-${{ steps.get-pr-num.outputs.prnum }}-${{ github.head_ref }}-main.spec.ts.mp4
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# HEAD_REF: ${{ github.head_ref }}
# GITHUB_REPOSITORY: "tubone24/blog"
# GITHUB_PULL_REQUEST_NUMBER: ${{ steps.get-pr-num.outputs.prnum }}
# BRANCH_NAME: "screenshot"
# run: deno run --allow-env --allow-read --allow-net scripts/uploadScreenShot.ts
# test-e2e-firefox:
# runs-on: ubuntu-latest
# container: cypress/browsers:node16.18.0-chrome107-ff106-edge
# steps:
# - name: Checkout source code
# uses: actions/checkout@v3
# - name: install apt
# run: |
# apt-get -y update
# apt-get -y install fonts-noto unzip build-essential
# - uses: denoland/setup-deno@v1
# with:
# deno-version: 'v1.x'
# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: echo "dir=$(yarn cache dir)" >> "${GITHUB_OUTPUT}"
# - name: Cache
# uses: actions/cache/restore@v3
# with:
# path: |
# ~/.cache
# ${{ steps.yarn-cache-dir-path.outputs.dir }}
# node_modules
# key: ${{ runner.os }}-e2e-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-e2e-build-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }}
# ${{ runner.os }}-e2e-build-${{ env.cache-version }}-
# - name: yarn install
# env:
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
# run: yarn install --frozen-lockfile
# - name: chmod
# run: |
# chmod 777 -R /github/home/
# chmod 777 -R src/
# chmod 777 -R /__w/blog/blog/
# chmod 777 -R /root/
# - name: Test e2e
# 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 test:e2e:ci:firefox
# - name: Get PR Number
# id: get-pr-num
# run: echo "prnum=$(echo "${GITHUB_REF}" | sed -e 's/[^0-9]//g')" >> "${GITHUB_OUTPUT}"
# - name: Add file
# env:
# FILE_PATH: ./cypress/videos/e2e/main.spec.ts.mp4
# FILE_NAME: video-firefox-${{ steps.get-pr-num.outputs.prnum }}-${{ github.head_ref }}-main.spec.ts.mp4
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# HEAD_REF: ${{ github.head_ref }}
# GITHUB_REPOSITORY: "tubone24/blog"
# GITHUB_PULL_REQUEST_NUMBER: ${{ steps.get-pr-num.outputs.prnum }}
# BRANCH_NAME: "screenshot"
# run: deno run --allow-env --allow-read --allow-net scripts/uploadScreenShot.ts
lint:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
3 changes: 3 additions & 0 deletions functions/src/csp-report.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import * as Sentry from "@sentry/node";
import "@sentry/tracing";
import { ProfilingIntegration } from "@sentry/profiling-node";

Sentry.init({
dsn: "https://aa2f31c272db4f8494e3903a43cc5ca6@o302352.ingest.sentry.io/4504433289986048",
tracesSampleRate: 1.0,
integrations: [new ProfilingIntegration()],
profilesSampleRate: 1.0,
});

const transaction = Sentry.startTransaction({
Expand Down
4 changes: 2 additions & 2 deletions owasp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ ENV NODE_ENV production
WORKDIR /app
COPY ["package.json", "./"]
COPY ["public", "public"]
RUN npm install -g serve
CMD ["serve", "-s", "-l", "9000", "public"]
RUN npm install -g serve@14.1.2
CMD ["serve", "-s", "-l", "9000", "public"]
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,13 @@
"test:storybook": "npm test storybook.test.ts",
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"cypress:run:chrome": "cypress run --browser chrome",
"cypress:run:firefox": "cypress run --browser firefox",
"cypress:base": "cypress run --env type=base --config screenshotsFolder=cypress/snapshots/base,testFiles=\\\"**/*main.spec.ts\\\"",
"test:e2e": "start-server-and-test develop:e2e http://localhost:8000 cypress:open",
"test:e2e:ci": "start-server-and-test develop:e2e http://localhost:8000 cypress:run",
"test:e2e:ci:chrome": "start-server-and-test develop:e2e http://localhost:8000 cypress:run:chrome",
"test:e2e:ci:firefox": "start-server-and-test develop:e2e http://localhost:8000 cypress:run:firefox",
"test:e2e:base": "start-server-and-test develop:e2e http://localhost:8000 cypress:base",
"functions": "netlify-lambda serve functions",
"clean": "gatsby clean",
Expand Down

0 comments on commit 75841cd

Please sign in to comment.