-
Notifications
You must be signed in to change notification settings - Fork 26
Feature/kro rgd cicd #315
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: riv25
Are you sure you want to change the base?
Feature/kro rgd cicd #315
Conversation
|
||
// Should have ECR registry entries | ||
const registryKeys = Object.keys(dockerConfig.auths); | ||
expect(registryKeys.some(key => key.includes('.dkr.ecr.') && key.includes('.amazonaws.com'))).toBe(true); |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High test
.amazonaws.com
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 12 hours ago
The fix is to parse the registry key as a URL (or at least separate out its host component) and explicitly match it against the exact allowed patterns. In this context, Docker registry keys are typically hostnames like <aws_account_id>.dkr.ecr.<region>.amazonaws.com
(with or without protocol), so we can use a regular expression or direct string checks to validate the format more robustly.
- Replace the substring check with a regular expression that requires the key to conform to the AWS ECR registry host pattern.
- Ensure the regular expression matches only valid AWS ECR hosts, not arbitrary hosts containing
.amazonaws.com
somewhere in the name. - No additional import is needed, unless robust URL parsing is desired, but for hostname patterns, a simple regex is sufficient.
- Only lines within the provided file need to be changed.
Change only the registry key assertion, on (and around) line 265 in aws-resource-validation.integration.test.js
.
-
Copy modified lines R265-R267
@@ -262,7 +262,9 @@ | ||
|
||
// Should have ECR registry entries | ||
const registryKeys = Object.keys(dockerConfig.auths); | ||
expect(registryKeys.some(key => key.includes('.dkr.ecr.') && key.includes('.amazonaws.com'))).toBe(true); | ||
// Match pattern: <account-id>.dkr.ecr.<region>.amazonaws.com optionally with :port | ||
const ecrRegistryRegex = /^\d{12}\.dkr\.ecr\.[a-z0-9-]+\.amazonaws\.com(:\d+)?$/; | ||
expect(registryKeys.some(key => ecrRegistryRegex.test(key))).toBe(true); | ||
}); | ||
}); | ||
}); |
Signed-off-by: Sébastien Allamand <sallaman@amazon.com>
Signed-off-by: Sébastien Allamand <sallaman@amazon.com>
Signed-off-by: Sébastien Allamand <sallaman@amazon.com>
Signed-off-by: Sébastien Allamand <sallaman@amazon.com>
- Fix readyWhen conditions to only reference current resource (no cross-resource refs) - Escape shell variables to avoid CEL expression parser conflicts - Update shell variable naming from UPPERCASE to lowercase to prevent template parsing - Replace Gitea references with GitLab for current workshop version - Update secret references from gitea-credentials to gitlab-credentials - Change GITEA_TOKEN to GITLAB_TOKEN environment variable Key fixes: - readyWhen patterns: self-reference only, dependencies via template variables - Shell variables: gitlab_hostname, webhook_url, api_url (lowercase) - Validation: RGD now passes Kro CLI validation successfully Resolves CEL expression validation errors: - undeclared reference to 'GITLAB_HOSTNAME' - undeclared reference to 'hooks_api_url' - undeclared reference to 'GITEA_TOKEN'
Signed-off-by: Sébastien Allamand <sallaman@amazon.com>
Signed-off-by: Sébastien Allamand <sallaman@amazon.com>
Signed-off-by: Sébastien Allamand <sallaman@amazon.com>
Signed-off-by: Sébastien Allamand <sallaman@amazon.com>
Signed-off-by: Sébastien Allamand <sallaman@amazon.com>
Signed-off-by: Sébastien Allamand <sallaman@amazon.com>
Signed-off-by: Sébastien Allamand <sallaman@amazon.com>
Signed-off-by: Sébastien Allamand <sallaman@amazon.com>
Signed-off-by: Sébastien Allamand <sallaman@amazon.com>
Signed-off-by: Sébastien Allamand <sallaman@amazon.com>
Signed-off-by: Sébastien Allamand <sallaman@amazon.com>
Signed-off-by: Sébastien Allamand <sallaman@amazon.com>
Create a new backstage template and kro RGD for the CICD pipeline