mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
The two EKS Pod Identity Docker classes each declared a profile named Profile with the same webhook, TLS and port settings. Only the agent class's turned EKS mocking off, which never reaches the other class: it stores its cluster and add-on through the services directly. They now share EksPodIdentityProfile. AppSyncHttpDataSourceSidecarIntegrationTest and EventBridgeAppSyncSidecarIntegrationTest each declared an EnforcedSidecars profile, the sidecar namespace and port with IAM enforcement, the first with signature validation as well. AwsIamHttpDataSourceIntegrationTest declared the same two switches without the sidecar settings, which never reach it: it starts no container and sends to the port the application listens on. The three now share SidecarIamEnforcementProfile. The EventBridge class creates and deletes its stack through a signed CloudFormation client rather than a hand-written Authorization header, which signature validation would refuse. Its cleanup now holds the SDK clients in a try-with-resources, so each closes whatever the stack and IAM cleanup throws.
44 lines
2.3 KiB
Java
44 lines
2.3 KiB
Java
package io.floci.aws.testing;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* IAM enforcement and signature validation on, over the sidecar containers' namespace and port, for
|
|
* the classes that check what a role may do when AppSync or EventBridge acts as it. Quarkus builds
|
|
* the application once per distinct profile class, and keeps every one it built for the rest of the
|
|
* test JVM, so they share this one rather than each declaring their own.
|
|
*
|
|
* <p>The overrides, and who relies on them:
|
|
* <ul>
|
|
* <li>{@link SidecarContainersProfile#containerOverrides()} names the containers and points a
|
|
* launched container's callbacks at the port the application listens on.
|
|
* {@code AppSyncHttpDataSourceSidecarIntegrationTest} and
|
|
* {@code EventBridgeAppSyncSidecarIntegrationTest} run the GraphQL sidecar and rely on it.</li>
|
|
* <li>{@code floci.services.iam.enforcement-enabled=true} evaluates every request against the
|
|
* caller's policies. All three classes check a decision it makes: the role an HTTP data source
|
|
* signs as, and the role an EventBridge target and a DynamoDB data source act as.</li>
|
|
* <li>{@code floci.auth.validate-signatures=true} rejects a request whose SigV4 signature does not
|
|
* match its credentials. {@code AppSyncHttpDataSourceSidecarIntegrationTest} and
|
|
* {@code AwsIamHttpDataSourceIntegrationTest} check the signature an AWS_IAM HTTP data source
|
|
* sends with it.</li>
|
|
* </ul>
|
|
*
|
|
* <p>The namespace never reaches {@code AwsIamHttpDataSourceIntegrationTest}, which starts no
|
|
* container, and the port is the one it already sends to. {@code EventBridgeAppSyncSidecarIntegrationTest}
|
|
* sends every request through an SDK client, which signs it, so signature validation passes it.
|
|
*
|
|
* <p>A class joins if every setting here is either one it relies on or one that never reaches its
|
|
* requests, and if it signs every request it sends.
|
|
*/
|
|
public class SidecarIamEnforcementProfile extends SidecarContainersProfile {
|
|
|
|
@Override
|
|
public Map<String, String> getConfigOverrides() {
|
|
Map<String, String> overrides = new HashMap<>(containerOverrides());
|
|
overrides.put("floci.services.iam.enforcement-enabled", "true");
|
|
overrides.put("floci.auth.validate-signatures", "true");
|
|
return overrides;
|
|
}
|
|
}
|