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

ARN parsing is too strict on resources #2

Closed
dacut opened this issue Apr 3, 2021 · 3 comments
Closed

ARN parsing is too strict on resources #2

dacut opened this issue Apr 3, 2021 · 3 comments

Comments

@dacut
Copy link

dacut commented Apr 3, 2021

I have a CloudWatch alarm named Production:LB:High4xx, which has an ARN in the form: arn:aws:cloudwatch:us-west-1:123456789012:alarm:Production:LB:High4xx. Note the multiple : after the account id.

This pattern doesn't satisfy either Resource::TypedId or Resource::QTypedId variants, so code like this fails:

ARN::from_str("arn:aws:cloudwatch:us-west-2:123456789012:alarm:Production:LB:High4xx").unwrap()

I'm not aware of any particular rules on the resource section of an ARN here; unfortunately, IIRC the original (AWS internal) Aspen spec left it up to the services teams, and CloudWatch made some particularly bad choices here with regard to separators and user-defined names. There are also cases (notably in S3 paths) where double slashes are allowed and needed (though this seems to work ok).

You might consider just letting the ':' codepath go similarly to the '/' codepath, or even abandoning validating the resource part entirely (beyond that "it's ASCII").

@johnstonskj
Copy link
Owner

Thanks! I'll take a look.

@johnstonskj
Copy link
Owner

Have undertaken a major refactor, removing the old Resource enum and adding new Identifier and ResourceIdentifier types. I specifically added a test case for your CloudWatch example as well.

fn test_github_issues_2() {

@dacut
Copy link
Author

dacut commented Apr 11, 2021

I read through the latest, and it definitely solves this issue. Thanks! I'll close this out here.

@dacut dacut closed this as completed Apr 11, 2021
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

No branches or pull requests

2 participants