Skip to content
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

Add input validation to SIWA private key prompt #8097

Closed
2 tasks
josefaidt opened this issue Sep 3, 2021 · 4 comments · Fixed by aws-amplify/docs#5018 or #11790
Closed
2 tasks

Add input validation to SIWA private key prompt #8097

josefaidt opened this issue Sep 3, 2021 · 4 comments · Fixed by aws-amplify/docs#5018 or #11790
Labels
auth Issues tied to the auth category of the CLI feature-request Request a new feature p3

Comments

@josefaidt
Copy link
Contributor

josefaidt commented Sep 3, 2021

Is this related to a new or existing Amplify category?

auth

Is this related to another service?

n/a

Describe the feature you'd like to request

Add input validation for SIWA private key (PKCS8 PEM format) prompt, preventing developers from adding the social provider and mitigating failed push attempts. Currently providing an invalid value (example: fakeprivatekey) will allow a successful update to the local auth resource only to error on push for HostedUIProvidersCustomResourceInputs, and pointing developers to check the CloudWatch logs for this Lambda callout. This log will display the error:

CREATE_FAILED      HostedUIProvidersCustomResourceInputs Custom::LambdaCallout      Fri Sep 03 2021 13:32:00 GMT-0500 (Central Daylight Time) Received response status [FAILED] from custom resource. Message returned: See the details in CloudWatch Log Stream: 2021/09/03/[$LATEST]1f507a017e90478c88299b19bf549fe6 (RequestId: 4a841311-2d06-454e-8a93-bd360059c76c)

image

AWS Amplify Admin UI has input validation built into the form used to add SIWA social signin, preventing developers from providing an invalid value. By adding this input validation it will also align DX across Admin UI and the CLI.

image

Describe the solution you'd like

When providing an invalid private key value such as fakeprivatekey CLI should prevent the developer from continuing until a valid private key value (PKCS8 PEM format) is supplied, similar to how the validation error is supplied when adding an APNS notification:

? Choose authentication method used for APNs Key
? The bundle id used for APNs Tokens:  fakebundleid
? The team id used for APNs Tokens:  faketeamid
? The key id used for APNs Tokens:  fakekeyid
? The key file path (.p8):  /fake/key/path.p8
>> file path must be valid

Example:

Select the identity providers you want to configure for your user pool: Sign in with Apple
  
 You've opted to allow users to authenticate via Sign in with Apple. If you haven't already, you'll need to go to https://developer.
apple.com/account/#/welcome and configure Sign in with Apple. 
 
 Enter your Services ID for your OAuth flow:  fakeserviceid
 Enter your Team ID for your OAuth flow:  faketeamid
 Enter your Key ID for your OAuth flow:  fakekeyid
 Enter your Private Key for your OAuth flow:  fakeprivatekey
>> Private key must be valid

Describe alternatives you've considered

n/a

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change
@josefaidt josefaidt added feature-request Request a new feature auth Issues tied to the auth category of the CLI labels Sep 3, 2021
@josefaidt josefaidt added the p3 label Aug 8, 2022
@sebsto
Copy link

sebsto commented Oct 10, 2022

At least document the format required for the private key. At the moment, the iOS doc does not even mention that part of the CLI.
Developers have to guess if the CLI expects a path or a base64 encoded key. No clue

https://docs.amplify.aws/lib/auth/social/q/platform/ios/#launch-social-web-ui-sign-in

@sebsto
Copy link

sebsto commented Oct 10, 2022

Added an issue on the doc project to document the expected inputs aws-amplify/docs#4678

@sebsto
Copy link

sebsto commented Oct 10, 2022

Other issues because of this
#9478
#8939 (comment)

@sebsto
Copy link

sebsto commented Oct 10, 2022

What worked for me was to enter the p8 file content on one single line

Example
-----BEGIN PRIVATE KEY-----MIGT....ogty6P-----END PRIVATE KEY-----%

2022-10-10_09-13-22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Issues tied to the auth category of the CLI feature-request Request a new feature p3
Projects
None yet
2 participants