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

chore: notice for https://github.com/aws/aws-cdk/issues/25674 #210

Merged
merged 4 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions data/notices.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,46 @@
}
],
"schemaVersion": "1"
},
{
"title": "(eks) eks overly permissive trust policies",
"issueNumber": 25674,
"overview": "The default MastersRole allows any identity in the account with the appropriate sts:AssumeRole permissions to assume it.",
"components": [
Copy link
Contributor Author

@iliapolo iliapolo May 23, 2023

Choose a reason for hiding this comment

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

These only suffer from the default masters role.

{
"name": "@aws-cdk/aws-eks.Cluster",
"version": ">=1.57.0 <1.62.0"
},
{
"name": "@aws-cdk/aws-eks.FargateCluster",
"version": ">=1.57.0 <1.62.0"
}
],
"schemaVersion": "1"
},
{
"title": "(eks) eks overly permissive trust policies",
"issueNumber": 25674,
"overview": "Cluster CreationRole and default MastersRole allows any identity in the account with the appropriate sts:AssumeRole permissions to assume it.",
"components": [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These suffer from both the default masters role and the creation role

{
"name": "@aws-cdk/aws-eks.Cluster",
"version": ">=1.62.0 <1.202.0"
},
{
"name": "@aws-cdk/aws-eks.FargateCluster",
"version": ">=1.62.0 <1.202.0"
},
{
"name": "aws-cdk-lib.aws_eks.Cluster",
"version": ">=2.0.0-rc.1 <2.80.0"
},
{
"name": "aws-cdk-lib.aws_eks.FargateCluster",
"version": ">=2.0.0-rc.1 <2.80.0"
}
],
"schemaVersion": "1"
}
]
}
3 changes: 2 additions & 1 deletion test/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ describe('Notices file is valid', () => {
test('v2 version ranges must be bounded at the bottom', () => {
for (const component of notice.components) {
if (component.version === '1.*') { continue; } // Special range that we allow
if (semver.intersects(component.version, '2') && !semver.subset(component.version, '2')) {
Copy link
Contributor Author

@iliapolo iliapolo May 23, 2023

Choose a reason for hiding this comment

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

Using 2 as the range wouldn't allow pre releases, and we still have customers using those...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

> semver.satisfies('2.0.0-rc.2', '>=2.0.0-rc.1 <2.80.0')
true
> semver.satisfies('2.0.0-rc.2', '^2.0.0 <2.80.0')
false

Copy link
Contributor

@rix0rrr rix0rrr May 23, 2023

Choose a reason for hiding this comment

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

I think what we're trying to convey here is that:

  • A range may not cross a major version boundary (if we use >= we must also have a <)
  • A range must be bounded at the top (if we use ^ we must also have a <)

Maybe it would be simpler to do the following:

  • Do a linear scan of version ranges x ∈ [1..10], test x.0.0 and x.10000.0 and make sure not more than one x is within the range
  • Of that same x, test x.10000.0 and test that it is not matched.

Potentially a simpler set of tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Potentially, I honestly don't have the mental capacity right now to rework this...

if (semver.intersects(component.version, '2', { includePrerelease: true })
&& !semver.subset(component.version, '2', { includePrerelease: true })) {
throw new Error(`${component.version} should have an upper bound in v1 range, or a lower bound in v2 range (version should look like "^2.3.4 <2.5.6")`);
}
}
Expand Down