Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
kaja-nav committed Nov 28, 2023
1 parent b82b4cf commit d50a2b8
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 3 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "CodeQL"

on:
pull_request:

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' 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.

# 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
# queries: security-extended,security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2
env:
ORG_GRADLE_PROJECT_githubUser: x-access-token
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
19 changes: 19 additions & 0 deletions src/common/api/axios/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,25 @@ export const get = <ResponseData>(
});
};

export const get2 = <ResponseData>(
url: string,
baseurl: string,
errorType: ErrorType,
options?: AxiosOptions
): Promise<ResponseData> => {
return axios
.get(url, {
baseURL: baseurl,
headers: defaultRequestHeaders(options),
responseType: options?.responseType,
withCredentials: true,
})

Check failure

Code scanning / CodeQL

Server-side request forgery Critical

The
URL
of this request depends on a
user-provided value
.
.then((response) => response.data)
.catch(function (error) {
handleError(error, errorType);
});
};

export const post = <ResponseData>(
url: string,
errorType: ErrorType,
Expand Down
7 changes: 4 additions & 3 deletions src/common/api/queries/arbeidsgiver/dialogmoteDataQueryAG.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useQuery } from "@tanstack/react-query";
import { get } from "@/common/api/axios/axios";
import { get2 } from "@/common/api/axios/axios";
import { useNarmesteLederId } from "@/common/hooks/useNarmesteLederId";
import { useApiBasePath } from "@/common/hooks/routeHooks";
import { DialogmoteData } from "types/shared/dialogmote";
Expand All @@ -11,8 +11,9 @@ export const useDialogmoteDataAG = () => {
const apiBasePath = useApiBasePath();

const fetchDialogmoteData = () =>
get<DialogmoteData>(
`${apiBasePath}/${narmestelederid}`,
get2<DialogmoteData>(
`/${narmestelederid}`,
apiBasePath,
"fetchDialogmoteDataAGException"
);

Expand Down

0 comments on commit d50a2b8

Please sign in to comment.