Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
edmachado-fao authored Nov 7, 2023
0 parents commit 3be59f5
Show file tree
Hide file tree
Showing 98 changed files with 11,903 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:jammy",
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/powershell:1": {}
},
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"humao.rest-client",
"github.copilot",
"github.copilot-chat",
"github.copilot-labs",
"ms-sarifvscode.sarif-viewer",
"Vue.volar",
"vsls-contrib.codetour"
]
}
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
8 changes: 8 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: "CodeQL config"
queries:
- name: Run custom queries
uses: ./queries/vue-xss.ql

query-filters:
- exclude:
id: js/xss
3 changes: 3 additions & 0 deletions .github/secret_scanning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
paths-ignore:
- 'README.md'
- 'exercises/*'
84 changes: 84 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '33 7 * * 6'
workflow_dispatch:

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go', 'java', 'javascript', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
config-file: .github/codeql/codeql-config.yml


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2


# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode
21 changes: 21 additions & 0 deletions .tours/lab-1-exercise-1.tour
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://aka.ms/codetour-schema",
"title": "Lab-1-Exercise-1",
"steps": [
{
"file": "storage/src/main/resources/application.properties",
"description": "This is the secret pattern `mona_value_abc124` for which we will create an AI generated custom pattern for Secret Scanning in GitHub Advanced Security",
"line": 5,
"selection": {
"start": {
"line": 5,
"character": 16
},
"end": {
"line": 5,
"character": 33
}
}
}
]
}
26 changes: 26 additions & 0 deletions .tours/lab-2-exercise-1.tour
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://aka.ms/codetour-schema",
"title": "Lab-2-Exercise-1",
"steps": [
{
"file": "frontend/src/components/Gallery.vue",
"description": "Add the Sanitization function listed in the exercise description here",
"line": 233,
"selection": {
"start": {
"line": 233,
"character": 1
},
"end": {
"line": 233,
"character": 33
}
}
},
{
"file": "frontend/src/components/Gallery.vue",
"description": "Call the sanization function from the Update function by placing the following call\n\n artItem.description = sanitizeInput(artItem.description)\n artItem.title = sanitizeInput(artItem.title)",
"line": 339
}
]
}
21 changes: 21 additions & 0 deletions .tours/lab-2-exercise-2.tour
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://aka.ms/codetour-schema",
"title": "Lab-2-Exercise-2",
"steps": [
{
"file": "gallery/main.go",
"description": "Select this line of code which has an Injection vulnerability and we will ask GitHub Copilot to explain what an Injection Vulnerability is and how it can be exploited. Below prompt can be used:\n\n\"Explain me what is an SQL Injection and how it can be exploited with my code as a reference. Also explain me how the vulnerability can be fixed\"",
"line": 198,
"selection": {
"start": {
"line": 198,
"character": 2
},
"end": {
"line": 198,
"character": 153
}
}
}
]
}
21 changes: 21 additions & 0 deletions .tours/lab-2-exercise-3.tour
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://aka.ms/codetour-schema",
"title": "Lab-2-Exercise-3",
"steps": [
{
"file": "gallery/main.go",
"description": "Ask GitHub Copilot for a fix for this SQL Injection vulnerability.",
"line": 308,
"selection": {
"start": {
"line": 308,
"character": 2
},
"end": {
"line": 308,
"character": 199
}
}
}
]
}
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 github

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
63 changes: 63 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<h1 align="center">Harnessing AI: Next Level Strategies for Advanced Security</h1>
<h5 align="center">@s-samadi</h3>
<h5 align="center">@abhi-dutta</h3>

<p align="center">
<a href="#introduction">Introduction</a> •
<a href="#prerequisites">Prerequisites</a> •
<a href="#mona-gallery">Mona Gallery</a> •
<a href="#learning-objectives">Learning Objectives</a> •
<a href="#learning-resources">Learning Resources</a>
</p>



### Introduction

This repository contains the source code for the `Mona Gallery` vulnerable web application. The exercises for this workshop can be found in the `exercises.md` file.

### Prerequisites

Please make sure that you have all the prerequisites in place before we start of the wokshop

1) Create a codespace from the repository
<details>
<summary> Demo </summary>
![create-codespace](https://github.com/octodemo/universe-wip/assets/68650974/6dde8598-0cd3-4b62-ae60-c609ea4e27c7)

</details>


2) Verify that the GitHub Copilot, GitHub Copilot Chat, and GitHub Copilot Lab plugins are pre-installed in your codespace. These installations should occur automatically when you start the codespace.
3) Configure the plugin to grant you access to GitHub copilot through the [githubuniverseworkshops](https://github.com/githubuniverseworkshops) Org that you have been granted access to
4) Confirm that Advanced Security and all its features have been enabled on your repository

### Mona Gallery

The Mona Gallery is a delibrately vulnerable web application consisting of several prevalent vulnerability types, such as SQL injection, XSS, and deserialization, among others. The application's codebase is diverse, utilizing multiple technologies, including Go, Python, Javascript, and Java. A architecture diagram can be found below. We will use this application's codebase for this workshop.


![mona-gallery](https://github.com/octodemo/universe-wip/assets/68650974/cb0bbf88-6d68-49e8-9129-fa3e487b2be9)

#### Architecture Diagram

The application's frontend is built with Vue.js 3 and Bootstrap 5, while authorization is managed through the Zitadel OIDC service implemented in Go. Middleware functions are handled in Python. The API is developed in Go, and Blob storage is implemented with MinIO, written in Java. Furthermore, the API layer is also implemented in Go, and the database relies on SQL Lite. Each of these services is encapsulated in its respective Docker container, resulting in a total of five images. To run the application, you can utilize Docker Compose.


![image](https://github.com/octodemo/universe-wip/assets/79184790/34600cdc-5dde-4dc4-9a68-8e31709c1ec0)

### Learning Objectives

- Hands on exercise demonstrating our new feature to generate regexes using AI
- Use AI to find generic secrets
- Practical lab demonstrating the new autofix feature for Javascript CodeQL alerts on the pull request
- How to use GitHub Copilot to learn about CodeQL
- Use GitHub Copilot to learn about application security

### Learning Resources

- [GitHub Advanced Security Learning Path - Microsoft Learn](https://learn.microsoft.com/en-us/collections/rqymc6yw8q5rey)
- [Docs - GitHub Advanced Security](https://docs.github.com/en/enterprise-cloud@latest/get-started/learning-about-github/about-github-advanced-security)
- [GitHub Copilot Learning Path - Microsoft Learn](https://learn.microsoft.com/en-us/training/modules/introduction-to-github-copilot/)
- [Docs - GitHub Copilot](https://docs.github.com/en/copilot)
Loading

0 comments on commit 3be59f5

Please sign in to comment.