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

Removing of internal constraint on AmplifyOutputsData in Swift implementation. #3960

Open
sbelbin opened this issue Feb 20, 2025 · 4 comments
Labels
feature-request Request a new feature

Comments

@sbelbin
Copy link

sbelbin commented Feb 20, 2025

Is your feature request related to a problem? Please describe.

At times a Swift application needs to do the following for itself:

  1. Configure AWS Amplify Gen 2 Swift application using AmplifyOutputsData.init since these settings are stored in a secure & encrypted manner and other than in JSON file (i.e. amplify_outputs.json) or JSON representation.

  2. Fetching these configuration settings so that the application's behavior can be adapted based on those settings or present them to the application's users.

Showing to users the AWS region, authentication properties & policies, name of the AWS S3 bucket & region, ... can be useful for them.
Additionally, the application can have specific behaviors based on the values of those settings.

Describe the solution you'd like

The removal of the @_spi(InternalAmplifyConfiguration) on the struct AmplifyOutputsData as well as various sub-structures and functions.

Doing this will make this accessible to Swift developers using AWS Amplify Gen 2.

Describe alternatives you've considered

What I've done is to copied the code of struct AmplifyOutputsData as well as various sub-structures and functions within my application code to avoid naming collision with Amplify module. But, where the @_spi(...) directive is commented out.

I've tried to workaround by using a different import directive the application such as @_spi(InternalAmplifyConfiguration) import Amplify, but Swift fails to compile stating that the AmplifyOutputsData is internal.

Is the feature request related to any of the existing Amplify categories?

No response

Additional context

The first point of being able to use AmplifyOutputsData.initis practical for those such as myself when developing an applications used the medical domain, since our best practices is store configuration in a secure manner such as iOS Keychain.

In that context being able to initialize a AmplifyOutputsData object with the appropriate settings without having to compose into an intermediary JSON representation is practical.

Thanks for your consideration.

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Feb 20, 2025
@tylerjroach
Copy link
Member

AmplifyOutputsData is marked internal because it is not considered stable. We may at times, change the internal structure, variable names, etc within AmplifyOutputsData. If we were to make this public, any changes would require a major release.

Android has a way to pass a json string, instead of a file, so this may be something that Swift can look into adding as well. You could store the json string however you would like. However, I would like to assure you that no data within the amplify_outputs.json file is considered private. There should be no need to encrypt these values.

I'll go ahead and mark this as a feature request.

@tylerjroach tylerjroach added the feature-request Request a new feature label Feb 20, 2025
@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Feb 20, 2025
Copy link
Contributor

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!

@tylerjroach tylerjroach removed the pending-triage Issue is pending triage label Feb 20, 2025
@sbelbin
Copy link
Author

sbelbin commented Feb 20, 2025

AmplifyOutputsData is marked internal because it is not considered stable. We may at times, change the internal structure, variable names, etc within AmplifyOutputsData. If we were to make this public, any changes would require a major release.

There are major release of AWS Amplify Gen 2, and at this point the configuration shouldn't be something that could change in the next major release.

We are potentially already have an issue even with this internal approach because some changes to configuration may have a significant undesirable side-effects.

Here is a scenario.

Presume that AWS Amplify Gen 2 developers changed the Amplify.AmplifyOutputsData.Storage struct from a struct having two string properties (awsRegion & bucketName) into an array of those properties. Such changes will have undesirable impact to application developers, such as myself, when they upgrade to that AWS Amplify Gen 2 release.

Application developers would be required to download a revised the amplify_outputs.json. Even though their AWS Amplify backend doesn't change and using the revised configuration layout doesn't benefit their applications.

Additionally, in my scenario the application is deployed in many time, thus introducing complexities during deployment of the application that is prone to errors since each instance will require changing the amplify_outputs.json on each device.

My advice for the AWS Amplify Gen 2 developers, use one the many paradigms that allow supporting different configuration revisions across releases. Eventually, the AWS Amplify Gen 2 developers will declare that earlier revisions are deprecated where application developers are required to downloading the appropriate amplify_outputs.json.

Android has a way to pass a json string, instead of a file, so this may be something that Swift can look into adding as well. You could store the json string however you would like.

What I've done is to construct extract the properties from a secure source and placed those into a JSON representation into a Data variable then pass that variable.

However, I would like to assure you that no data within the amplify_outputs.json file is considered private. There should be no need to encrypt these values.

I'll encourage you to discuss amongst your peers about the merits preventing individuals from accessing such information in the first place.

I've had to deal with domain where skilled bad actors with sufficient details such as endpoints & AWS S3 bucket details were enough for them to cause mischief.

I'll go ahead and mark this as a feature request.

Thanks, I do appreciate that as well other persons (if not now, sometime in the future). ;-)

@github-actions github-actions bot added the pending-maintainer-response Issue is pending response from an Amplify team member label Feb 20, 2025
@tylerjroach
Copy link
Member

@sbelbin I did not mean to indicate that amplify_outputs.json is not under a public contract. That contract is set. How we choose to parse that json and convert it into structs/classes that we use internally within Amplify is what is subject to change. Since it is not public, any changes made within would not be breaking.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests

2 participants