From 9db0c4e2e898c56874eaa7e2df94f7ff74c6ce9b Mon Sep 17 00:00:00 2001 From: cloudsenseiNG Date: Mon, 22 Apr 2024 11:27:05 +0100 Subject: [PATCH 1/2] semgrep test --- .github/workflows/semgrep.yml | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/semgrep.yml diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml new file mode 100644 index 0000000..ee86784 --- /dev/null +++ b/.github/workflows/semgrep.yml @@ -0,0 +1,43 @@ +name: Semgrep +on: + workflow_dispatch: {} + pull_request: {} + push: + branches: + - main + - master + paths: + - .github/workflows/semgrep.yml + schedule: + # randoms HH:MM to avoid a load spike on GitHub Actions at 00:00 + - cron: 55 14 * * * +jobs: + semgrep_include: + strategy: + matrix: + subdir: + - cloud-devops-ci-cd-udapeople + - cloud-devops-cloudformation + - cloud-devops-operationalizing-ml + - cloud-devops-static-website + name: semgrep/ci + runs-on: ubuntu-20.04 + env: + SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} + SEMGREP_REPO_DISPLAY_NAME: monorepo-test--${{ matrix.subdir }} + container: + image: returntocorp/semgrep + steps: + - uses: actions/checkout@v3 + - run: semgrep ci --include=${{ matrix.subdir }} + + semgrep_exclude: + name: semgrep/ci + runs-on: ubuntu-20.04 + env: + SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} + container: + image: returntocorp/semgrep + steps: + - uses: actions/checkout@v3 + - run: semgrep ci From fa736c6876049151c7b2b3fb1bbce6dba687e0fe Mon Sep 17 00:00:00 2001 From: mayusB <54024278+mayusB@users.noreply.github.com> Date: Mon, 22 Apr 2024 11:51:02 +0100 Subject: [PATCH 2/2] Create vuln.js --- vuln.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 vuln.js diff --git a/vuln.js b/vuln.js new file mode 100644 index 0000000..27f66f2 --- /dev/null +++ b/vuln.js @@ -0,0 +1,18 @@ +var app = angular.module('MyApp', []); +app.controller('myCtrl', function($scope, $sce) { + $scope.userInput = 'foo'; + + $scope.sayHello = function() { + // ruleid:detect-angular-open-redirect + $window.location.href = input + '/app/logout'; + input = $scope.input; + // ruleid:detect-angular-open-redirect + $window.location.href = input + '/app/logout'; + + //Data is not coming from user input + $location.location.location = test + // ok:detect-angular-open-redirect + $window.location.href = "//untatintedredirect" + }; + +});