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

fix(middleware-endpoint): check for s3 arn parts #1227

Merged
merged 2 commits into from
Apr 4, 2024
Merged

Conversation

bitIO
Copy link
Contributor

@bitIO bitIO commented Apr 3, 2024

As stated in this issue #1121 arn check should not check s3 arns contain nor account nor region since they are not part of s3 arns

Issue #, if available:

#1121

Description of changes:

Check S3 arn is valid by not expecting account nor region to be in the arn (fail if any of those two are present)

If one or more of the packages in the /packages directory has been modified, be sure yarn changeset add has been run and its output has
been committed and included in this pull request. See CONTRIBUTING.md.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

As stated in this issue smithy-lang#1121 arn check should not check s3 arns contain nor account nor region since they are not part of s3 arns
@bitIO bitIO requested review from a team as code owners April 3, 2024 08:22
@bitIO bitIO requested a review from AndrewFossAWS April 3, 2024 08:22
@@ -61,9 +61,10 @@ export const isDnsCompatibleBucketName = (bucketName: string): boolean =>
export const isArnBucketName = (bucketName: string): boolean => {
const [arn, partition, service, region, account, typeOrId] = bucketName.split(":");
const isArn = arn === "arn" && bucketName.split(":").length >= 6;
const isValidArn = [arn, partition, service, account, typeOrId].filter(Boolean).length === 5;
const isValidArn =
[arn, partition, service, typeOrId].filter(Boolean).length === 4 && [region, account].filter(Boolean).length == 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot require that region and account are definitively not set.

An access point MRAP ARN works with and without the account id present, for example with listObjects({ Bucket: "arn:aws:s3::12345:accesspoint/xyz.mrap" })

@kuhe
Copy link
Contributor

kuhe commented Apr 3, 2024

I amended the PR to only make account id segment of the ARN optional, not to require that it is not present.

@kuhe kuhe merged commit cc54b8d into smithy-lang:main Apr 4, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants