Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 2 deletions frontend/src/app/Services/code-fixes.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { HttpClient } from '@angular/common/http'
import { catchError, map } from 'rxjs/operators'
import { type Observable } from 'rxjs'

export interface result {
export interface Result {
verdict: boolean
}

Expand Down Expand Up @@ -33,6 +33,6 @@ export class CodeFixesService {
return this.http.post(this.host, {
key,
selectedFix
}).pipe(map((response: result) => response), catchError((error: any) => { throw error }))
}).pipe(map((response: Result) => response), catchError((error: any) => { throw error }))
}
}
4 changes: 2 additions & 2 deletions frontend/src/app/Services/vuln-lines.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { environment } from '../../environments/environment'
import { HttpClient } from '@angular/common/http'
import { catchError, map } from 'rxjs/operators'

export interface result {
export interface Result {
verdict: boolean
hint: string
}
Expand All @@ -21,6 +21,6 @@ export class VulnLinesService {
return this.http.post(this.host, {
key,
selectedLines
}).pipe(map((response: result) => response), catchError((error: any) => { throw error }))
}).pipe(map((response: Result) => response), catchError((error: any) => { throw error }))
}
}
4 changes: 2 additions & 2 deletions frontend/src/app/code-snippet/code-snippet.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { CodeSnippetService, type CodeSnippet } from '../Services/code-snippet.s
import { CodeFixesService } from '../Services/code-fixes.service'
import { CookieService } from 'ngx-cookie'
import { ChallengeService } from '../Services/challenge.service'
import { VulnLinesService, type result } from '../Services/vuln-lines.service'
import { VulnLinesService, type Result } from '../Services/vuln-lines.service'
import { Component, Inject, type OnInit } from '@angular/core'

import { MAT_DIALOG_DATA } from '@angular/material/dialog'
Expand Down Expand Up @@ -112,7 +112,7 @@ export class CodeSnippetComponent implements OnInit {
}

checkLines = () => {
this.vulnLinesService.check(this.dialogData.key, this.selectedLines).subscribe((verdict: result) => {
this.vulnLinesService.check(this.dialogData.key, this.selectedLines).subscribe((verdict: Result) => {
this.setVerdict(verdict.verdict)
this.hint = verdict.hint
})
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/oauth/oauth.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export class OAuthComponent implements OnInit {
const hash = this.route.snapshot.data.params.substr(1)
const splitted = hash.split('&')
const params: any = {}
for (let i = 0; i < splitted.length; i++) {
const param: string = splitted[i].split('=')
for (const item of splitted) {
const param: string = item.split('=')
const key: string = param[0]
params[key] = param[1]
}
Expand Down
2 changes: 1 addition & 1 deletion lib/codingChallenges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function getCodeChallengesFromFile (file: FileMatch) {
}

function getCodingChallengeFromFileContent (source: string, challengeKey: string) {
const snippets = source.match(`[/#]{0,2} vuln-code-snippet start.*${challengeKey}([^])*vuln-code-snippet end.*${challengeKey}`)
const snippets = new RegExp(`[/#]{0,2} vuln-code-snippet start.*${challengeKey}([^])*vuln-code-snippet end.*${challengeKey}`).exec(source)
if (snippets == null) {
throw new BrokenBoundary('Broken code snippet boundaries for: ' + challengeKey)
}
Expand Down
2 changes: 1 addition & 1 deletion test/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Cypress.Commands.add(
'login',
(context: { email: string, password: string, totpSecret?: string }) => {
cy.visit('/#/login')
if (context.email.match(/\S+@\S+\.\S+/) != null) {
if (/\S+@\S+\.\S+/.exec(context.email) != null) {
cy.get('#email').type(context.email)
} else {
cy.task<string>('GetFromConfig', 'application.domain').then(
Expand Down
Loading