mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(eks): preserve worker webhook scope in the URL path (#3849)
* fix(eks): preserve worker webhook scope in the URL path * docs(eks): clarify scoped and legacy webhook routes
This commit is contained in:
1 parent
bd9700db0d
commit
fdec637c27
5 files changed
+44
-5
No files matched your search
+21
@@ -74,7 +74,28 @@ class EksWorkerAuthenticationIntegrationTest {
|
||||
given().queryParam("accountId", "999999999999").queryParam("region", "us-east-1")
|
||||
.queryParam("createdAt", incarnation).contentType("application/json").body(review)
|
||||
.post(path).then().statusCode(200).body("status.authenticated", equalTo(false));
|
||||
String scopedPath = path + "/scope/" + account + "/us-east-1/" + incarnation;
|
||||
// No scope query parameters: client-go replaces the webhook server URL query.
|
||||
given().contentType("application/json").body(review).post(scopedPath).then().statusCode(200)
|
||||
.body("status.authenticated", equalTo(true))
|
||||
.body("status.user.username", equalTo("system:node:" + instance.getPrivateDnsName()))
|
||||
.body("status.user.groups", contains("system:bootstrappers", "system:nodes"));
|
||||
// Query values cannot override the scoped route's cluster identity.
|
||||
given().queryParam("accountId", "999999999999").queryParam("region", "us-west-2")
|
||||
.queryParam("createdAt", "2000-01-01T00:00:00Z")
|
||||
.contentType("application/json").body(review).post(scopedPath).then().statusCode(200)
|
||||
.body("status.authenticated", equalTo(true));
|
||||
for (String invalidPath : new String[]{
|
||||
path,
|
||||
path + "/scope/999999999999/us-east-1/" + incarnation,
|
||||
path + "/scope/" + account + "/us-west-2/" + incarnation,
|
||||
path + "/scope/" + account + "/us-east-1/2000-01-01T00:00:00Z"}) {
|
||||
given().contentType("application/json").body(review).post(invalidPath).then().statusCode(200)
|
||||
.body("status.authenticated", equalTo(false));
|
||||
}
|
||||
credentials.unregister(instance);
|
||||
given().contentType("application/json").body(review).post(scopedPath).then().statusCode(200)
|
||||
.body("status.authenticated", equalTo(false));
|
||||
given().queryParam("accountId", account).queryParam("region", "us-east-1")
|
||||
.queryParam("createdAt", incarnation).contentType("application/json").body(review)
|
||||
.post(path).then().statusCode(200).body("status.authenticated", equalTo(false));
|
||||
|
||||
@@ -67,8 +67,8 @@ class EksClusterManagerTest {
|
||||
cluster.setAccountId("123456789012");
|
||||
cluster.setArn("arn:aws:eks:us-west-2:123456789012:cluster/demo");
|
||||
cluster.setCreatedAt(Instant.parse("2026-09-17T00:00:00Z"));
|
||||
assertEquals("/_floci/eks/clusters/demo/token-webhook?accountId=123456789012"
|
||||
+ "®ion=us-west-2&createdAt=2026-09-17T00:00:00Z", EksClusterManager.webhookPath(cluster));
|
||||
assertEquals("/_floci/eks/clusters/demo/token-webhook/scope/123456789012"
|
||||
+ "/us-west-2/2026-09-17T00:00:00Z", EksClusterManager.webhookPath(cluster));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user