fix(cognito): add input validation for CreateUserPool, ListUserPools, DescribeUserPoolDomain#287
Merged
vieiralucas merged 1 commit intomainfrom Apr 12, 2026
Merged
Conversation
… DescribeUserPoolDomain - Validate enum fields (DeletionProtection, MfaConfiguration, UserPoolTier) - Validate string length constraints (PoolName, EmailVerificationMessage, EmailVerificationSubject, SmsAuthenticationMessage, SmsVerificationMessage, Domain) - Validate MaxResults is required and within range (1-60) for ListUserPools - Validate NextToken minimum length for ListUserPools - Add reusable validate_enum, validate_string_length, validate_range helpers Fixes 17 conformance probe variants that expected validation errors but got HTTP 200. Conformance: 80/80 operations fully passing (was 77/80).
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/fakecloud-cognito/src/service/mod.rs">
<violation number="1" location="crates/fakecloud-cognito/src/service/mod.rs:993">
P2: String length validation uses UTF-8 byte length instead of character count, which can incorrectly fail validation for non-ASCII input.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| min: usize, | ||
| max: usize, | ||
| ) -> Result<(), AwsServiceError> { | ||
| let len = value.len(); |
There was a problem hiding this comment.
P2: String length validation uses UTF-8 byte length instead of character count, which can incorrectly fail validation for non-ASCII input.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At crates/fakecloud-cognito/src/service/mod.rs, line 993:
<comment>String length validation uses UTF-8 byte length instead of character count, which can incorrectly fail validation for non-ASCII input.</comment>
<file context>
@@ -968,6 +968,67 @@ fn validate_password(password: &str, policy: &PasswordPolicy) -> Result<(), AwsS
+ min: usize,
+ max: usize,
+) -> Result<(), AwsServiceError> {
+ let len = value.len();
+ if len < min {
+ return Err(AwsServiceError::aws_error(
</file context>
Suggested change
| let len = value.len(); | |
| let len = value.chars().count(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
validate_enum,validate_string_length,validate_rangehelpersFixes 17 conformance probe variants. Cognito conformance: 80/80 implemented operations fully passing (was 77/80).
Test plan
Summary by cubic
Add strict input validation to Cognito’s CreateUserPool, ListUserPools, and DescribeUserPoolDomain so invalid inputs return correct errors. Fixes 17 conformance probe variants; 80/80 operations now fully pass (was 77/80).
validate_enum,validate_string_length,validate_range.Written for commit ffe9a93. Summary will update on new commits.