-
-
Notifications
You must be signed in to change notification settings - Fork 9
Survey and targeting calculation enhancements, plus API docs, also added Oauth related headers to status json #200
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
Conversation
…eters, and updated the way target lines are rendered, so they are more likely to be visible.
…for later on the highcharts service
…the status endpoint
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
| } | ||
|
|
||
| res.status(200).json(openApiSpec); | ||
| } catch (error) { |
Check failure
Code scanning / ESLint
Disallow unused variables Error
| @@ -0,0 +1,900 @@ | |||
| import settingsService, { SettingsType } from './settings.service.js'; | |||
Check failure
Code scanning / ESLint
Disallow unused variables Error
| } | ||
|
|
||
| // More specific typed interfaces for metrics data | ||
| interface MetricsData { |
Check failure
Code scanning / ESLint
Disallow unused variables Error
| // Collection of logs to return with the response | ||
| calculationLogs: Array<{ | ||
| name: string; | ||
| inputs: Record<string, any>; |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
| name: string; | ||
| inputs: Record<string, any>; | ||
| formula: string; | ||
| result: any; |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
| org: string | null, | ||
| enableLogging: boolean = false, | ||
| includeLogsInResponse: boolean = false | ||
| ): Promise<{ targets: Targets; logs?: Array<any> }> { |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
| org: string | null, | ||
| enableLogging: boolean = false, | ||
| includeLogsInResponse: boolean = false | ||
| ): Promise<{ targets: Targets; logs?: Array<any> }> { |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
| const existingTargets = await Targets.findOne(); | ||
|
|
||
| if (!existingTargets) { | ||
| if (!existingTargets || true) { |
Check failure
Code scanning / ESLint
Disallow constant expressions in conditions Error
|
|
||
| constructor(private http: HttpClient) {} | ||
|
|
||
| getOrgMembers(): Observable<any[]> { |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
| constructor(private http: HttpClient) {} | ||
|
|
||
| getOrgMembers(): Observable<any[]> { | ||
| return this.http.get<any[]>(`${this.apiUrl}/members`); |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
| import { MembersService, Member } from '../../../../services/api/members.service'; | ||
| import { InstallationsService } from '../../../../services/api/installations.service'; | ||
| import { catchError, map, Observable, of } from 'rxjs'; | ||
| import { BehaviorSubject, catchError, finalize, map, Observable, of, Subject, startWith, take } from 'rxjs'; |
Check failure
Code scanning / ESLint
Disallow unused variables Error
| import { MembersService, Member } from '../../../../services/api/members.service'; | ||
| import { InstallationsService } from '../../../../services/api/installations.service'; | ||
| import { catchError, map, Observable, of } from 'rxjs'; | ||
| import { BehaviorSubject, catchError, finalize, map, Observable, of, Subject, startWith, take } from 'rxjs'; |
Check failure
Code scanning / ESLint
Disallow unused variables Error
| import { MatRadioModule } from '@angular/material/radio'; // Import MatRadioModule | ||
| import { MatCardModule } from '@angular/material/card'; // Import MatCardModule | ||
| import { MatSliderModule } from '@angular/material/slider'; // Import MatSliderModule | ||
| import { debounceTime, distinctUntilChanged, filter, switchMap, tap } from 'rxjs/operators'; |
Check failure
Code scanning / ESLint
Disallow unused variables Error
| import { MatRadioModule } from '@angular/material/radio'; // Import MatRadioModule | ||
| import { MatCardModule } from '@angular/material/card'; // Import MatCardModule | ||
| import { MatSliderModule } from '@angular/material/slider'; // Import MatSliderModule | ||
| import { debounceTime, distinctUntilChanged, filter, switchMap, tap } from 'rxjs/operators'; |
Check failure
Code scanning / ESLint
Disallow unused variables Error
|
|
||
| // Handle GitHub URL parsing | ||
| if (params['url'] && params['url'].includes('github.com')) { | ||
| const { org, repo, prNumber } = this.parseGitHubPRUrl(params['url']); |
Check failure
Code scanning / ESLint
Disallow unused variables Error
| import { HttpClient } from '@angular/common/http'; | ||
| import { Endpoints } from '@octokit/types'; | ||
| import { catchError } from 'rxjs/operators'; | ||
| import { catchError, map, Observable, tap } from 'rxjs'; |
Check failure
Code scanning / ESLint
Disallow unused variables Error
|
|
||
| getMemberByLogin(login: string) { | ||
| return this.http.get<Endpoints["GET /users/{username}"]["response"]["data"]>(`${this.apiUrl}/${login}`); | ||
| getMemberByLogin(login: string, exact: boolean = true) { |
Check failure
Code scanning / ESLint
Disallow explicit type declarations for variables or parameters initialized to a number, string, or boolean Error
| } | ||
|
|
||
| // Handle GitHub URL parsing | ||
| if (params['url'] && params['url'].includes('github.com')) { |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High
github.com
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 10 months ago
To fix the problem, we need to parse the URL and check the host value explicitly. This ensures that the check handles arbitrary subdomain sequences correctly and prevents bypassing the security check by embedding "github.com" in unexpected locations within the URL.
The best way to fix the problem without changing existing functionality is to use the URL constructor to parse the URL and then check the host value against a whitelist of allowed hosts. This approach ensures that only valid GitHub URLs are accepted.
We need to modify the code in the ngOnInit method to parse the URL and check the host value. We will also need to import the URL class from the standard library.
-
Copy modified lines R159-R173
| @@ -158,9 +158,17 @@ | ||
| // Handle GitHub URL parsing | ||
| if (params['url'] && params['url'].includes('github.com')) { | ||
| const { org, repo, prNumber } = this.parseGitHubPRUrl(params['url']); | ||
| if (!params['repo'] && repo) { | ||
| this.surveyForm.get('repo')?.setValue(repo); | ||
| } | ||
| if (!params['prno'] && prNumber) { | ||
| this.surveyForm.get('prNumber')?.setValue(prNumber); | ||
| if (params['url']) { | ||
| try { | ||
| const url = new URL(params['url']); | ||
| const allowedHosts = ['github.com', 'www.github.com']; | ||
| if (allowedHosts.includes(url.host)) { | ||
| const { org, repo, prNumber } = this.parseGitHubPRUrl(params['url']); | ||
| if (!params['repo'] && repo) { | ||
| this.surveyForm.get('repo')?.setValue(repo); | ||
| } | ||
| if (!params['prno'] && prNumber) { | ||
| this.surveyForm.get('prNumber')?.setValue(prNumber); | ||
| } | ||
| } | ||
| } catch (e) { | ||
| console.error('Invalid URL:', params['url']); | ||
| } |
| annualTimeSavingsAsDollars: Target; | ||
| productivityOrThroughputBoostPercent: Target; | ||
| }; | ||
| [key: string]: any; // Add this index signature |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
| } | ||
|
|
||
| async initialize() { | ||
| calculateTargets(settings: SettingsType, adoptions: AdoptionType[]): Promise<{ targets: Targets; logs?: any[] }> { |
Check failure
Code scanning / ESLint
Disallow unused variables Error
| } | ||
|
|
||
| async initialize() { | ||
| calculateTargets(settings: SettingsType, adoptions: AdoptionType[]): Promise<{ targets: Targets; logs?: any[] }> { |
Check failure
Code scanning / ESLint
Disallow unused variables Error
| } | ||
|
|
||
| async initialize() { | ||
| calculateTargets(settings: SettingsType, adoptions: AdoptionType[]): Promise<{ targets: Targets; logs?: any[] }> { |
Check failure
Code scanning / ESLint
Disallow the `any` type Error
|
Hi, can someone help me with an nfcgate application to install on a Samsung android and keep my server active for money of course? |
I updated all the issues that were related to this work.
I probably need to add an issue for the api docs and oauth status for traceability.