Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Violation ("any") Dev Soki #27

Open
wants to merge 103 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
549962d
fixed test and created ci
Qedrigord Dec 17, 2024
a7850d0
ci workflow
chrisvobi Dec 17, 2024
241bd27
commented out easterEgg2 test
chrisvobi Dec 17, 2024
26608f9
fixed name for ci
Qedrigord Dec 17, 2024
0378b9c
fixing ci
alexkrit02 Dec 17, 2024
91c588d
fixing ci
alexkrit02 Dec 17, 2024
ef107ca
fixed unused variables
Qedrigord Dec 17, 2024
f482fac
Merge pull request #1 from alexkrit02/Dev--Tasos
Qedrigord Dec 17, 2024
0ef0b9e
removed ci
chrisvobi Dec 17, 2024
8736aa0
fixed SQL injection in login and removed tests for SQLinjection
chrisvobi Dec 17, 2024
1a7c62e
Merge branch 'main' into Dev--Chris
chrisvobi Dec 17, 2024
bdfb72a
Merge pull request #2 from alexkrit02/Dev--Chris
chrisvobi Dec 17, 2024
e697489
fixed search SQL Injection and removed related tests
chrisvobi Dec 17, 2024
3b3dd54
fixed hardcoded secret
chrisvobi Dec 17, 2024
45f715c
removed SQL Injection search tests
chrisvobi Dec 17, 2024
31cb1b4
fixed require statements
Qedrigord Dec 17, 2024
9c8b261
fixed cross-site-scripting with DOMPurify
chrisvobi Dec 17, 2024
724348e
Merge pull request #3 from alexkrit02/Dev--Chris
chrisvobi Dec 17, 2024
88c6019
fixed unused variables
Qedrigord Dec 17, 2024
2a56332
Merge pull request #4 from alexkrit02/Dev--Tasos
Qedrigord Dec 17, 2024
8a74984
Duplicate
sokiang Dec 17, 2024
4e447f0
fix xss
chrisvobi Dec 17, 2024
5520fef
fix cryptographic issues
chrisvobi Dec 17, 2024
bf62266
Merge pull request #5 from alexkrit02/Dev--Soki
sokiang Dec 17, 2024
601129b
Merge pull request #6 from alexkrit02/Dev--Chris
chrisvobi Dec 17, 2024
83fb3d3
fixing duplicates
alexkrit02 Dec 17, 2024
2836439
fixed unused variables
Qedrigord Dec 17, 2024
931fed5
removed 'any' from cypress.config.ts
chrisvobi Dec 17, 2024
e8ddc55
Merge branch 'main' into Dev--Alex
alexkrit02 Dec 17, 2024
359c15e
Merge pull request #7 from alexkrit02/Dev--Alex
alexkrit02 Dec 17, 2024
73bcbee
try to fix xss issue again
chrisvobi Dec 17, 2024
6ee14c2
test/api/chatbot
sokiang Dec 17, 2024
42d026a
Merge pull request #8 from alexkrit02/Dev--Tasos
Qedrigord Dec 17, 2024
e477015
Merge pull request #9 from alexkrit02/Dev--Chris
chrisvobi Dec 17, 2024
d96ae3c
File: /frontend/src/app/score-board/components/challenge-card/chall…
sokiang Dec 17, 2024
1e0c299
/frontend/src/app/score-board/components/challenge-card/challenge-car…
sokiang Dec 17, 2024
7646cf0
File: /frontend/src/app/score-board/components/challenges-unavailab…
sokiang Dec 17, 2024
0e36327
removed 'any' from antiCheat.ts
chrisvobi Dec 17, 2024
ad583f1
/frontend/src/app/score-board/components/tutorial-mode-warning/tutori…
sokiang Dec 17, 2024
3e55f77
removed 'any' from challengedUtils
chrisvobi Dec 17, 2024
72d142d
try sanitize-html to fix xss
chrisvobi Dec 17, 2024
6062a1e
fixed
chrisvobi Dec 17, 2024
9a01afd
removed 'any' from insecurity.ts
chrisvobi Dec 17, 2024
a470832
maybe fixed xss now
chrisvobi Dec 17, 2024
329297d
Merge pull request #10 from alexkrit02/Dev--Chris
chrisvobi Dec 17, 2024
6e92e9a
duplicated code fixing
alexkrit02 Dec 17, 2024
bde2044
Merge branch 'Dev--Alex' of https://github.com/alexkrit02/juice-shop …
alexkrit02 Dec 17, 2024
0bcff99
Welcome
sokiang Dec 18, 2024
46c96f9
Merge pull request #11 from alexkrit02/Dev--Soki
sokiang Dec 18, 2024
269e644
Welcome (violation)
sokiang Dec 18, 2024
aea5f93
fixing violations
alexkrit02 Dec 18, 2024
9693412
fixed antiCheat
chrisvobi Dec 18, 2024
926936d
added integrity attribute
chrisvobi Dec 18, 2024
07e426e
fixed path traversal in staticData
chrisvobi Dec 18, 2024
a4af30a
fixing violations
alexkrit02 Dec 18, 2024
c9eabd0
Merge pull request #12 from alexkrit02/Dev--Chris
chrisvobi Dec 18, 2024
95cd07b
Merge pull request #13 from alexkrit02/Dev--Alex
alexkrit02 Dec 18, 2024
0debd18
removed unused var
chrisvobi Dec 18, 2024
cc133e2
removed unused variables
chrisvobi Dec 18, 2024
a2591b6
upgrade brace
chrisvobi Dec 18, 2024
e8124d1
run npm audit fix
chrisvobi Dec 18, 2024
8c08e8b
remove 'any' from trackOrder.ts
chrisvobi Dec 18, 2024
d1991d8
removed 'any' from updateProductReviews.ts
chrisvobi Dec 18, 2024
aa68a94
removed 'any' vulnCodeSnippet
chrisvobi Dec 18, 2024
7e15a71
removed 'any'
chrisvobi Dec 18, 2024
b7b2c3d
removed 'any' registerWebsocketEvents.ts
chrisvobi Dec 18, 2024
f7d5d67
fixed imports
chrisvobi Dec 18, 2024
1af5be1
fixed some imports in server
chrisvobi Dec 18, 2024
0b4b75f
fixed imports
chrisvobi Dec 18, 2024
63cf700
fixed imports
chrisvobi Dec 18, 2024
e530592
fixing violations (part 2)
alexkrit02 Dec 18, 2024
ceca836
Merge branch 'main' into Dev--Chris
chrisvobi Dec 18, 2024
ff09cd5
Merge pull request #14 from alexkrit02/Dev--Chris
chrisvobi Dec 18, 2024
80f2900
Merge branch 'main' into Dev--Alex
alexkrit02 Dec 18, 2024
7b47cb0
Merge pull request #15 from alexkrit02/Dev--Alex
alexkrit02 Dec 18, 2024
a85a415
import - require
chrisvobi Dec 18, 2024
7b9127f
removed unused var
chrisvobi Dec 18, 2024
925b6d3
modified tests
chrisvobi Dec 18, 2024
1f4e96a
removed 'any' type
chrisvobi Dec 18, 2024
59802b1
removed 'any' type
chrisvobi Dec 18, 2024
4720369
removed screenshot because of conflicts
chrisvobi Dec 18, 2024
0dfdbb2
Merge branch 'main' into Dev--Chris
chrisvobi Dec 18, 2024
e71888f
Merge pull request #16 from alexkrit02/Dev--Chris
chrisvobi Dec 18, 2024
f76e9a8
removed 'any' type
chrisvobi Dec 18, 2024
e0dcdc7
Merge pull request #17 from alexkrit02/Dev--Chris
chrisvobi Dec 18, 2024
0765222
Some violations("any")
sokiang Dec 18, 2024
6aed0ee
removed 'any'
chrisvobi Dec 18, 2024
ae99b57
fixed require statements and dependencies
Qedrigord Dec 18, 2024
062c532
Merge pull request #18 from alexkrit02/Dev--Tasos
Qedrigord Dec 18, 2024
fe2d9d1
Merge pull request #19 from alexkrit02/Dev--Chris
chrisvobi Dec 18, 2024
5618415
restored package.json
Qedrigord Dec 18, 2024
a92f3a3
fiixed any violation
thomasDodopoulos Dec 18, 2024
3e2055f
Merge pull request #20 from alexkrit02/Dev--Tasos
Qedrigord Dec 18, 2024
1f6b676
Delete profile -- challenge usernameXss -- Username field should be s…
thomasDodopoulos Dec 18, 2024
abfdb79
Merge pull request #21 from alexkrit02/tommy2
thomasDodopoulos Dec 18, 2024
a71c16d
removed 'any' types
chrisvobi Dec 18, 2024
e009cf8
Violtations ("any")
sokiang Dec 18, 2024
c35f7aa
Merge pull request #22 from alexkrit02/Dev--Chris
chrisvobi Dec 18, 2024
48b63b7
Merge branch 'main' into Dev--Soki
sokiang Dec 18, 2024
07811e6
Violation ("any")
sokiang Dec 18, 2024
a69cd36
Merge branch 'Dev--Soki' of https://github.com/alexkrit02/juice-shop …
sokiang Dec 18, 2024
098df25
Violation ("any")
sokiang Dec 18, 2024
e012b62
Violation ("any")
sokiang Dec 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# should be added to .gitignore
TOTP_SECRET = IFTXE3SPOEYVURT2MRYGI52TKJ4HC3KH

TEST_JWT_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: ci

on: push

jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Setup nodejs
uses: actions/setup-node@v2
with:
node-version: 20

- name: Download dependencies
run: npm install

- name: Cypress run
uses: cypress-io/github-action@v6
with:
start: npm start
wait-on: 'http://localhost:3000'

22 changes: 12 additions & 10 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export default defineConfig({
downloadsFolder: 'test/cypress/downloads',
fixturesFolder: false,
supportFile: 'test/cypress/support/e2e.ts',
setupNodeEvents (on: any) {
on('before:browser:launch', (browser: any = {}, launchOptions: any) => { // TODO Remove after upgrade to Cypress >=12.5.0 <or> Chrome 119 become available on GitHub Workflows, see https://github.com/cypress-io/cypress-documentation/issues/5479
setupNodeEvents (on: Cypress.PluginEvents) {
on('before:browser:launch', (browser: Cypress.Browser, launchOptions: Cypress.BeforeBrowserLaunchOptions) => { // TODO Remove after upgrade to Cypress >=12.5.0 <or> Chrome 119 become available on GitHub Workflows, see https://github.com/cypress-io/cypress-documentation/issues/5479
if (browser.name === 'chrome' && browser.isHeadless) {
launchOptions.args = launchOptions.args.map((arg: any) => {
launchOptions.args = launchOptions.args.map((arg: string) => {
if (arg === '--headless') {
return '--headless=new'
}
Expand All @@ -33,7 +33,8 @@ export default defineConfig({
return security.generateCoupon(discount)
},
GetBlueprint () {
for (const product of config.get<ProductConfig[]>('products')) {
const products = config.get<ProductConfig[]>('products');
for (const product of products) {
if (product.fileForRetrieveBlueprintChallenge) {
const blueprint = product.fileForRetrieveBlueprintChallenge
return blueprint
Expand All @@ -45,17 +46,18 @@ export default defineConfig({
(product) => product.useForChristmasSpecialChallenge
)[0]
},
GetCouponIntent () {
const trainingData = require(`data/chatbot/${utils.extractFilename(
config.get('application.chatBot.trainingData')
)}`)
async GetCouponIntent () {
const trainingData = await import(
`data/chatbot/${utils.extractFilename(config.get('application.chatBot.trainingData'))}`
);
const couponIntent = trainingData.data.filter(
(data: { intent: string }) => data.intent === 'queries.couponCode'
)[0]
return couponIntent
},
GetFromMemories (property: string) {
for (const memory of config.get<MemoryConfig[]>('memories') as any) {
GetFromMemories (property: keyof MemoryConfig) {
const memories = config.get<MemoryConfig[]>('memories');
for (const memory of memories) {
if (memory[property]) {
return memory[property]
}
Expand Down
2 changes: 1 addition & 1 deletion data/static/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
email: wurstbrot
username: wurstbrot
password: 'EinBelegtesBrotMitSchinkenSCHINKEN!'
totpSecret: IFTXE3SPOEYVURT2MRYGI52TKJ4HC3KH
totpSecret: ${TOTP_SECRET}
key: timo
role: 'admin'
securityQuestion:
Expand Down
15 changes: 10 additions & 5 deletions data/staticData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ import { readFile } from 'fs/promises'
import { safeLoad } from 'js-yaml'
import logger from '../lib/logger'

export async function loadStaticData (file: string) {
const filePath = path.resolve('./data/static/' + file + '.yml')
return await readFile(filePath, 'utf8')
.then(safeLoad)
.catch(() => logger.error('Could not open file: "' + filePath + '"'))
export async function loadStaticData(file: string) {
const sanitizedFileName = path.basename(file);
const filePath = path.resolve('./data/static/' + sanitizedFileName + '.yml');

try {
const data = await readFile(filePath, 'utf8');
return safeLoad(data);
} catch (error) {
logger.error('Could not open file: "' + filePath + '"');
}
}

export interface StaticUser {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/Models/challenge.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { type SafeHtml } from '@angular/platform-browser'

export interface Challenge {
id: string; // Add the `id` field here
name: string
key: string
category: string
Expand Down
10 changes: 7 additions & 3 deletions frontend/src/app/Services/administration.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { fakeAsync, inject, TestBed, tick } from '@angular/core/testing'

import { AdministrationService } from './administration.service'

interface ApplicationVersionResponse {
version: string;
}

describe('AdministrationService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
Expand All @@ -22,14 +26,14 @@ describe('AdministrationService', () => {

it('should get application version directly from the rest api', inject([AdministrationService, HttpTestingController],
fakeAsync((service: AdministrationService, httpMock: HttpTestingController) => {
let res: any
service.getApplicationVersion().subscribe((data) => (res = data))
let res: ApplicationVersionResponse | undefined
service.getApplicationVersion().subscribe((data: ApplicationVersionResponse) => (res = data))
const req = httpMock.expectOne('http://localhost:3000/rest/admin/application-version')
req.flush({ version: 'apiResponse' })
tick()

expect(req.request.method).toBe('GET')
expect(res).toBe('apiResponse')
expect(res?.version).toBe('apiResponse')
httpMock.verify()
})
))
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/app/Services/administration.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { HttpClient } from '@angular/common/http'
import { Injectable } from '@angular/core'
import { catchError, map } from 'rxjs/operators'

interface ApplicationVersionResponse {
version: string;
}

@Injectable({
providedIn: 'root'
})
Expand All @@ -19,7 +23,7 @@ export class AdministrationService {

getApplicationVersion () {
return this.http.get(this.host + '/application-version').pipe(
map((response: any) => response.version),
map((response: ApplicationVersionResponse) => response.version),
catchError((error: Error) => { throw error })
)
}
Expand Down
10 changes: 7 additions & 3 deletions frontend/src/app/Services/captcha.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { fakeAsync, inject, TestBed, tick } from '@angular/core/testing'

import { CaptchaService } from './captcha.service'

interface ApplicationVersionResponse {
version: string;
}

describe('CaptchaService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
Expand All @@ -22,14 +26,14 @@ describe('CaptchaService', () => {

it('should get captcha directly from the rest api', inject([CaptchaService, HttpTestingController],
fakeAsync((service: CaptchaService, httpMock: HttpTestingController) => {
let res: any
service.getCaptcha().subscribe((data) => (res = data))
let res: ApplicationVersionResponse | undefined
service.getCaptcha().subscribe((data: ApplicationVersionResponse) => (res = data))
const req = httpMock.expectOne('http://localhost:3000/rest/captcha/')
req.flush('apiResponse')

tick()
expect(req.request.method).toBe('GET')
expect(res).toBe('apiResponse')
expect(res?.version).toBe('apiResponse')
httpMock.verify()
})
))
Expand Down
Loading