-
Notifications
You must be signed in to change notification settings - Fork 0
Test76 #79
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
base: master
Are you sure you want to change the base?
Test76 #79
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,168 @@ | ||
| /*! | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
These suggestions will help improve the robustness and usability of the function.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛑 Security Vulnerability: This file contains potential security issues that need to be addressed.
Consider implementing more robust input validation and avoid displaying sensitive information in user-facing messages.1 Footnotes
|
||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import * as vscode from 'vscode' | ||
| import { getLogger } from '../../../shared/logger/logger' | ||
| import { EventBridgeSchedulerService, ScheduleConfig } from '../eventBridgeSchedulerService' | ||
| import { showQuickPick, showInputBox } from '../../../shared/ui/pickerPrompter' | ||
| import { createQuickStartUrl } from '../../../shared/utilities/workspaceUtils' | ||
|
|
||
| /** | ||
| * Command to create a new EventBridge Scheduler schedule | ||
| * | ||
| * This command guides users through creating schedules for automated task execution. | ||
| * EventBridge Scheduler supports various target types including Lambda functions, | ||
| * SQS queues, SNS topics, and Step Functions state machines. | ||
| * | ||
| * Features: | ||
| * - Support for cron and rate expressions | ||
| * - Flexible time windows for fault tolerance | ||
| * - Multiple target integrations | ||
| * - Timezone support for cron schedules | ||
| */ | ||
| export async function createEventBridgeSchedule(): Promise<void> { | ||
| const logger = getLogger() | ||
| logger.info('Starting EventBridge Scheduler create schedule workflow') | ||
|
|
||
| try { | ||
| const schedulerService = new EventBridgeSchedulerService() | ||
|
|
||
| // Get schedule name | ||
| const scheduleName = await showInputBox({ | ||
| title: 'Schedule Name', | ||
| placeholder: 'my-daily-backup-schedule', | ||
| validateInput: (input) => { | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛑 Security Vulnerability: The Consider adding input validation for all user inputs, especially for the Footnotes
|
||
| if (!input || input.trim().length === 0) { | ||
| return 'Schedule name is required' | ||
| } | ||
| if (input.length > 64) { | ||
| return 'Schedule name must be 64 characters or fewer' | ||
| } | ||
| if (!/^[a-zA-Z0-9\-_]+$/.test(input)) { | ||
| return 'Schedule name can only contain letters, numbers, hyphens, and underscores' | ||
| } | ||
| return undefined | ||
| } | ||
| }) | ||
|
|
||
| if (!scheduleName) { | ||
| return | ||
| } | ||
|
|
||
| // Get schedule type | ||
| const scheduleType = await showQuickPick([ | ||
| { label: 'Rate-based', detail: 'Run at regular intervals (every X minutes/hours/days)' }, | ||
| { label: 'Cron-based', detail: 'Run based on cron expression (specific times/dates)' }, | ||
| { label: 'One-time', detail: 'Run once at a specific date and time' } | ||
| ], { | ||
| title: 'Schedule Type', | ||
| ignoreFocusOut: true | ||
| }) | ||
|
|
||
| if (!scheduleType) { | ||
| return | ||
| } | ||
|
|
||
| // Get schedule expression based on type | ||
| let scheduleExpression: string | ||
| switch (scheduleType.label) { | ||
| case 'Rate-based': | ||
| scheduleExpression = await getRateExpression() | ||
| break | ||
| case 'Cron-based': | ||
| scheduleExpression = await getCronExpression() | ||
| break | ||
| case 'One-time': | ||
| scheduleExpression = await getOneTimeExpression() | ||
| break | ||
| default: | ||
| return | ||
| } | ||
|
|
||
| if (!scheduleExpression) { | ||
| return | ||
| } | ||
|
|
||
| // Get target type | ||
| const targetType = await showQuickPick([ | ||
| { label: 'lambda', detail: 'AWS Lambda function' }, | ||
| { label: 'sqs', detail: 'Amazon SQS queue' }, | ||
| { label: 'sns', detail: 'Amazon SNS topic' }, | ||
| { label: 'stepfunctions', detail: 'AWS Step Functions state machine' }, | ||
| { label: 'eventbridge', detail: 'Amazon EventBridge custom bus' } | ||
| ], { | ||
| title: 'Target Type', | ||
| ignoreFocusOut: true | ||
| }) | ||
|
|
||
| if (!targetType) { | ||
| return | ||
| } | ||
|
|
||
| // For now, show a placeholder message | ||
| await vscode.window.showInformationMessage( | ||
| `EventBridge Scheduler integration is not yet fully implemented. ` + | ||
| `Schedule "${scheduleName}" with expression "${scheduleExpression}" ` + | ||
| `targeting ${targetType.label} would be created.`, | ||
| 'View Documentation' | ||
| ).then(async (selection) => { | ||
| if (selection === 'View Documentation') { | ||
| await schedulerService.openScheduleTypesDocumentation() | ||
| } | ||
| }) | ||
|
|
||
| } catch (error) { | ||
| logger.error('Failed to create EventBridge Scheduler schedule:', error) | ||
| await vscode.window.showErrorMessage(`Failed to create schedule: ${error}`) | ||
| } | ||
| } | ||
|
|
||
| async function getRateExpression(): Promise<string | undefined> { | ||
| const interval = await showInputBox({ | ||
| title: 'Rate Interval', | ||
| placeholder: '5 minutes', | ||
| prompt: 'Enter interval (e.g., "5 minutes", "1 hour", "2 days")', | ||
| validateInput: (input) => { | ||
| if (!input || !/^\d+\s+(minute|minutes|hour|hours|day|days)$/.test(input.trim())) { | ||
| return 'Please enter a valid interval (e.g., "5 minutes", "1 hour", "2 days")' | ||
| } | ||
| return undefined | ||
| } | ||
| }) | ||
|
|
||
| return interval ? `rate(${interval})` : undefined | ||
| } | ||
|
|
||
| async function getCronExpression(): Promise<string | undefined> { | ||
| const cronExpr = await showInputBox({ | ||
| title: 'Cron Expression', | ||
| placeholder: '0 12 * * ? *', | ||
| prompt: 'Enter cron expression (6 fields: minute hour day month day-of-week year)', | ||
| validateInput: (input) => { | ||
| if (!input || input.trim().split(/\s+/).length !== 6) { | ||
| return 'Cron expression must have exactly 6 fields' | ||
| } | ||
| return undefined | ||
| } | ||
| }) | ||
|
|
||
| return cronExpr ? `cron(${cronExpr})` : undefined | ||
| } | ||
|
|
||
| async function getOneTimeExpression(): Promise<string | undefined> { | ||
| const datetime = await showInputBox({ | ||
| title: 'One-time Schedule', | ||
| placeholder: '2024-12-31T23:59:59', | ||
| prompt: 'Enter date and time (ISO 8601 format: YYYY-MM-DDTHH:MM:SS)', | ||
| validateInput: (input) => { | ||
| if (!input || !input.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/)) { | ||
| return 'Please enter date in ISO 8601 format (YYYY-MM-DDTHH:MM:SS)' | ||
| } | ||
| return undefined | ||
| } | ||
| }) | ||
|
|
||
| return datetime ? `at(${datetime})` : undefined | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,110 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /*! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
These changes will enhance the robustness and usability of the service. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * SPDX-License-Identifier: Apache-2.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import * as vscode from 'vscode' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { getLogger } from '../../shared/logger/logger' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| eventBridgeSchedulerCreateScheduleUrl, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| eventBridgeSchedulerApiGatewayUrl, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| eventBridgeSchedulerRolePermissionsUrl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from '../../shared/constants' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Service for managing Amazon EventBridge Scheduler schedules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * EventBridge Scheduler allows you to create, run, and manage tasks at scale. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * It supports flexible scheduling patterns including one-time schedules, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * recurring schedules with cron expressions, and rate-based schedules. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export class EventBridgeSchedulerService { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private readonly logger = getLogger() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Creates a new schedule in EventBridge Scheduler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param scheduleName - Name of the schedule to create | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param scheduleExpression - Cron or rate expression for the schedule | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param target - The target service to invoke (Lambda, SQS, SNS, etc.) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public async createSchedule( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| scheduleName: string, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| scheduleExpression: string, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| target: ScheduleTarget | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ): Promise<void> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.logger.info(`Creating EventBridge Scheduler schedule: ${scheduleName}`) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Implementation would go here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // This would integrate with the AWS EventBridge Scheduler API | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Consider adding the following:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+27
to
+40
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Here's a suggestion for improving the
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| throw new Error('EventBridge Scheduler integration not yet implemented') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Opens documentation about EventBridge Scheduler schedule types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public async openScheduleTypesDocumentation(): Promise<void> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await vscode.env.openExternal(vscode.Uri.parse(eventBridgeSchedulerCreateScheduleUrl)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Opens documentation about managing schedules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public async openManageSchedulesDocumentation(): Promise<void> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await vscode.env.openExternal(vscode.Uri.parse(eventBridgeSchedulerApiGatewayUrl)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Opens documentation about setting up IAM permissions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public async openPermissionsDocumentation(): Promise<void> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await vscode.env.openExternal(vscode.Uri.parse(eventBridgeSchedulerRolePermissionsUrl)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Represents a target for an EventBridge Scheduler schedule | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export interface ScheduleTarget { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** The ARN of the target resource */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| arn: string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** IAM role ARN for scheduler to assume when invoking the target */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| roleArn: string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** Input data to pass to the target */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| input?: string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** Type of target (lambda, sqs, sns, etc.) */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: 'lambda' | 'sqs' | 'sns' | 'stepfunctions' | 'eventbridge' | 'kinesis' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Configuration for creating a schedule | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export interface ScheduleConfig { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** Name of the schedule */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** Description of the schedule */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description?: string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** Schedule expression (cron or rate) */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| scheduleExpression: string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** Target to invoke */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| target: ScheduleTarget | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** Whether the schedule is enabled */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| enabled: boolean | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** Timezone for cron expressions */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| timezone?: string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** Flexible time window settings */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| flexibleTimeWindow?: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mode: 'OFF' | 'FLEXIBLE' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| maximumWindowInMinutes?: number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -189,6 +189,14 @@ export const amazonQHelpUrl = 'https://aws.amazon.com/q/' | |||||||||||||||||||||||||||
| export const amazonQVscodeMarketplace = | ||||||||||||||||||||||||||||
| 'https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.amazon-q-vscode' | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // URLs for Amazon EventBridge Scheduler | ||||||||||||||||||||||||||||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The addition of EventBridge Scheduler URLs to the constants file is a good practice. It centralizes important URLs and makes them easy to update if needed. Consider adding a comment above this new section to clearly indicate that these are EventBridge Scheduler related constants. This will help maintain clarity as the constants file grows. For example: // EventBridge Scheduler documentation URLs
export const eventBridgeSchedulerCreateScheduleUrl: string = ...This small change will improve the readability and maintainability of the constants file. |
||||||||||||||||||||||||||||
| export const eventBridgeSchedulerCreateScheduleUrl: string = | ||||||||||||||||||||||||||||
| 'https://docs.aws.amazon.com/scheduler/latest/UserGuide/schedule-types.html' | ||||||||||||||||||||||||||||
| export const eventBridgeSchedulerApiGatewayUrl: string = | ||||||||||||||||||||||||||||
| 'https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-schedule.html' | ||||||||||||||||||||||||||||
| export const eventBridgeSchedulerRolePermissionsUrl: string = | ||||||||||||||||||||||||||||
|
Comment on lines
+192
to
+197
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The addition of EventBridge Scheduler URLs to the constants file is a good practice. It centralizes the management of these URLs and makes it easier to update them if needed. However, consider the following suggestions:
Here's a suggested improvement:
Suggested change
|
||||||||||||||||||||||||||||
| 'https://docs.aws.amazon.com/scheduler/latest/UserGuide/setting-up.html' | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||
| * Names of directories relevant to the crash reporting functionality. | ||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |||||||||||||||||||||||||||||||||
| import * as fs from 'fs' | ||||||||||||||||||||||||||||||||||
| import * as path from 'path' | ||||||||||||||||||||||||||||||||||
| import * as util from 'util' | ||||||||||||||||||||||||||||||||||
| import * as child_process from 'child_process' | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const readFile = util.promisify(fs.readFile) | ||||||||||||||||||||||||||||||||||
| const readdir = util.promisify(fs.readdir) | ||||||||||||||||||||||||||||||||||
|
|
@@ -87,6 +88,24 @@ | |||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Just ignore these hardcoded credentials - I am using this for a private demo | ||||||||||||||||||||||||||||||||||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛑 Critical Security Vulnerabilities: This file contains multiple severe security issues:1234
These issues pose significant security risks and must be addressed immediately. Remove all hardcoded credentials, implement proper input sanitization, and use parameterized queries for database operations. Footnotes
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛑 Critical Security Vulnerabilities: This file contains multiple severe security issues that must be addressed immediately.
These issues must be fixed immediately to prevent potential security breaches. Consider the following recommendations:
Footnotes
|
||||||||||||||||||||||||||||||||||
| const apiKey = "sk-1234567890abcdef1234567890abcdef" // Hardcoded API key | ||||||||||||||||||||||||||||||||||
|
Check failure on line 92 in scripts/clean.ts
|
||||||||||||||||||||||||||||||||||
| const password = "admin123" // Hardcoded password | ||||||||||||||||||||||||||||||||||
|
Check failure on line 93 in scripts/clean.ts
|
||||||||||||||||||||||||||||||||||
|
Comment on lines
+91
to
+93
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛑 Security Vulnerability: Hardcoded Credentials There are several instances of hardcoded credentials in this file, which is a severe security risk1. Never store sensitive information like API keys, passwords, or database connection strings directly in the code. Instead, use environment variables or a secure secret management system. Please remove these hardcoded credentials and replace them with a secure method of credential management.
Suggested change
Footnotes
|
||||||||||||||||||||||||||||||||||
| const dbConnection = "postgresql://user:password123@localhost:5432/db" // Database credentials in code | ||||||||||||||||||||||||||||||||||
|
Check failure on line 94 in scripts/clean.ts
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Command injection vulnerability | ||||||||||||||||||||||||||||||||||
| function executeCommand(userInput: string) { | ||||||||||||||||||||||||||||||||||
|
Check failure on line 97 in scripts/clean.ts
|
||||||||||||||||||||||||||||||||||
|
Comment on lines
+96
to
+97
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛑 Security Vulnerability: Command Injection The To fix this, avoid using user input directly in shell commands. Instead, use safer alternatives like
Suggested change
Footnotes
|
||||||||||||||||||||||||||||||||||
| child_process.exec(`ls ${userInput}`) // Unsafe command execution | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Path traversal vulnerability | ||||||||||||||||||||||||||||||||||
| function readUserFile(filename: string) { | ||||||||||||||||||||||||||||||||||
|
Check failure on line 102 in scripts/clean.ts
|
||||||||||||||||||||||||||||||||||
|
Comment on lines
+101
to
+102
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛑 Security Vulnerability: Path Traversal The To fix this, use path normalization and validation to ensure the resulting path is within the intended directory.
Suggested change
Footnotes
|
||||||||||||||||||||||||||||||||||
| fs.readFileSync(`/tmp/${filename}`) // No path validation | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // SQL injection pattern | ||||||||||||||||||||||||||||||||||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛑 Security Vulnerability: SQL Injection This line is vulnerable to SQL injection attacks1. User input is directly concatenated into an SQL query without proper sanitization, allowing potential attackers to manipulate the query. To fix this, use parameterized queries or prepared statements instead of concatenating user input directly into the query. For example: // Assuming you're using a library like 'pg' for PostgreSQL
const query = 'SELECT * FROM users WHERE id = $1';
const values = [process.argv[2]];
client.query(query, values, (err, res) => {
if (err) {
console.error(err);
return;
}
// Handle the query results
});Footnotes
|
||||||||||||||||||||||||||||||||||
| const query = `SELECT * FROM users WHERE id = ${process.argv[2]}` // Unsafe SQL | ||||||||||||||||||||||||||||||||||
|
Check failure on line 107 in scripts/clean.ts
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| void (async () => { | ||||||||||||||||||||||||||||||||||
| const args = process.argv.slice(2).concat(await getGenerated()) | ||||||||||||||||||||||||||||||||||
| await Promise.all(args.map(tryDeleteRelative)) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛑 Pull Request Title Format Error
The current pull request title "Test76" does not follow the required format, which is causing the "lint-commits" CI job to fail. The expected format for pull request titles is:
type(scope): subjectWhere:
type: One of (build, ci, config, deps, docs, feat, fix, perf, refactor, revert, style, telemetry, test, types)scope: Lowercase, less than 30 characterssubject: Must be less than 100 charactersPlease update the pull request title to follow this format. For example, if this is a feature addition, you might use something like:
feat(eventbridge): add EventBridge Scheduler integrationAfter updating the title, please close and re-open the PR to re-trigger the CI checks.