Skip to content
Merged
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
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ workflows:
- dev
- TOP-2044_show-signin-modal
- maintenance
- review-app

- deployProd:
context: org-global
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/trivy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Trivy Scanner

permissions:
contents: read
security-events: write
on:
push:
branches:
- main
- dev
pull_request:
jobs:
trivy-scan:
name: Use Trivy
runs-on: ubuntu-24.04
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ maintainability]
Consider using a stable version of the runner, such as ubuntu-latest, instead of ubuntu-24.04 to ensure compatibility and reduce maintenance overhead when new Ubuntu versions are released.

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Trivy scanner in repo mode
uses: aquasecurity/trivy-action@0.33.1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ security]
The Trivy action version 0.33.1 is specified. Ensure this is the latest stable version to benefit from the latest features and security patches. Consider using a version range or the latest tag if appropriate.

with:
scan-type: "fs"
ignore-unfixed: true
format: "sarif"
output: "trivy-results.sarif"
severity: "CRITICAL,HIGH,UNKNOWN"
scanners: vuln,secret,misconfig,license
github-pat: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ security]
The upload-sarif action version v3 is specified. Ensure this is the latest stable version to benefit from the latest features and security patches. Consider using a version range or the latest tag if appropriate.

with:
sarif_file: "trivy-results.sarif"
4 changes: 2 additions & 2 deletions src/lib/config/hosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export const THRIVE_HOST: string = {
}[HOST_ENV] || `https://www.${TC_DOMAIN}`;

export const APP_AUTH_CONNECTOR: string = `https://accounts-auth0.${TC_DOMAIN}`;
export const ONLINE_REVIEW_HOST: string = `https://software.${TC_DOMAIN}`;
export const REVIEW_APP_HOST: string = `https://review.${TC_DOMAIN}`;
export const TCACADEMY_HOST: string = `https://academy.${TC_DOMAIN}`;
export const SELF_SERVICE_HOST: string = `https://work.${TC_DOMAIN}`;
export const TC_API_V5_HOST: string = `https://api.${TC_DOMAIN}/v5`;
export const TC_API_HOST: string = `https://api.${TC_DOMAIN}/v6`;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
Changing the API version from /v5 to /v6 could have significant implications on the functionality and compatibility of the application. Ensure that all endpoints and data structures are compatible with the new version, and thoroughly test the integration to prevent any runtime errors or unexpected behavior.

export const CONNECT_HOST: string = `https://connect.${TC_DOMAIN}`;
export const WORK_MANAGER_HOST: string = `https://challenges.${TC_DOMAIN}`;
export const PROFILE_HOST: string = `https://profiles.${TC_DOMAIN}`;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/config/nav-menu/all-nav-items.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
COMMUNITY_HOST,
CONNECT_HOST,
COPILOT_PORTAL_HOST,
ONLINE_REVIEW_HOST,
REVIEW_APP_HOST,
TALENT_SEARCH_HOST,
TCACADEMY_HOST,
PLATFORM_APP_HOST,
Expand Down Expand Up @@ -142,7 +142,7 @@ export const allNavItems: {[key: string]: NavMenuItem} = {
},
review: {
label: 'Review',
url: ONLINE_REVIEW_HOST,
url: REVIEW_APP_HOST,
icon: 'review',
description: 'Review submissions',
},
Expand Down
4 changes: 2 additions & 2 deletions src/lib/functions/profile-nudges.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TC_API_V5_HOST } from "lib/config";
import { TC_API_HOST } from "lib/config";
import type { AuthUser } from "lib/app-context";
import { DISABLE_NUDGES, NUDGES_DISABLED_HOSTS } from "lib/config/profile-toasts.config";

Expand Down Expand Up @@ -51,7 +51,7 @@ export const fetchUserProfileCompletedness = async (user: AuthUser, force = fals
// for QA purpose only
const toastOverrideFlagParam = (window?.location.search.match(/[?&]+toast=(\w+)/i) ?? [])[1];
const toastOverrideFlag = toastOverrideFlagParam ? `?toast=${toastOverrideFlagParam}` : '';
const requestUrl: string = `${TC_API_V5_HOST}/members/${userHandle}/profileCompleteness${toastOverrideFlag}`;
const requestUrl: string = `${TC_API_HOST}/members/${userHandle}/profileCompleteness${toastOverrideFlag}`;
const request = fetch(requestUrl, {headers: {...getRequestAuthHeaders()}});

const response = await (await request).json();
Expand Down
4 changes: 2 additions & 2 deletions src/lib/functions/support/support.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { TC_API_V5_HOST } from 'lib/config';
import { TC_API_HOST } from 'lib/config';
import type { ContactSupportRequest } from './contact-support-request.model'

export async function sendSupportRequest(request: ContactSupportRequest): Promise<any> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ maintainability]
The function sendSupportRequest returns a Promise<any>. Consider specifying a more precise return type instead of any to improve type safety and maintainability. This will help catch potential errors at compile time and make the code easier to understand.

const url: string = `${TC_API_V5_HOST}/challenges/support-requests`
const url: string = `${TC_API_HOST}/challenges/support-requests`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The change from TC_API_V5_HOST to TC_API_HOST suggests a potential update in API versioning or endpoint configuration. Ensure that TC_API_HOST is correctly configured and that this change aligns with the intended API version and endpoint structure. This could impact the correctness of the API calls if not properly updated.


return fetch(url, {
method: 'POST',
Expand Down
4 changes: 2 additions & 2 deletions src/lib/functions/user-profile.provider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { AuthUser } from '../../main';
import { AUTH_USER_ROLE, AUTH_USER_ROLE_VALUES } from '../config/auth';
import { TC_API_V5_HOST } from '../config';
import { TC_API_HOST } from '../config';
import { getAuthJwtDomainProp, getRequestAuthHeaders } from './auth-jwt';

export type fetchUserProfileFn = () => AuthUser | null;
Expand Down Expand Up @@ -46,7 +46,7 @@ export const fetchUserProfile = async (): Promise<AuthUser> => {
let resolve: (value: AuthUser) => void;
localCache[userHandle] = new Promise((r) => {resolve = r});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The promise initialization with let resolve: (value: AuthUser) => void; and new Promise((r) => {resolve = r}); can lead to potential issues if resolve is not called, as it will leave the promise pending indefinitely. Consider using a more robust pattern to ensure the promise is always resolved or rejected.


const requestUrl: string = `${TC_API_V5_HOST}/members/${userHandle}`;
const requestUrl: string = `${TC_API_HOST}/members/${userHandle}`;
const request = fetch(requestUrl, {headers: {...getRequestAuthHeaders()}});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The fetch call does not handle HTTP errors. If the response status is not 200, the json() method will still be called, which could lead to unexpected behavior. Consider checking response.ok and handling errors appropriately.


const response = await (await request).json();
Expand Down
4 changes: 2 additions & 2 deletions types/src/lib/config/hosts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export declare const CHALLENGE_HOST: string;
export declare const COMMUNITY_HOST: string;
export declare const THRIVE_HOST: string;
export declare const APP_AUTH_CONNECTOR: string;
export declare const ONLINE_REVIEW_HOST: string;
export declare const REVIEW_APP_HOST: string;
export declare const TCACADEMY_HOST: string;
export declare const SELF_SERVICE_HOST: string;
export declare const TC_API_V5_HOST: string;
export declare const TC_API_HOST: string;
export declare const CONNECT_HOST: string;
export declare const WORK_MANAGER_HOST: string;
export declare const PROFILE_HOST: string;
Expand Down
Loading