mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
60985b9a80d604ee842679e82f7ee3f4a7cde320
2505
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
60985b9a80 |
fix(cloudformation): skip unchanged resources during updates (#4442)
* fix(cloudformation): skip unchanged resources during updates * fix(cloudformation): refresh dependent resources during updates (#4442) * fix(cloudformation): support SQS rollback and scope dependent updates to replaced resources - Implement replacement and in-place update rollback in SqsCfnProvisioner - Scope dependent updates during stack update to only resources depending on replaced resources - Compute and include dependent modified resources in ChangeSets to align DescribeChangeSet with execution - Prevent unmodified resources such as S3 buckets from losing configuration when referenced resources update in-place * fix(cloudformation): load create-only properties from schemas and handle condition changes * fix(cloudformation): skip resources on outputs-only update and include create-only schema in native image * fix(cloudformation): accurately assert unchanged queue events on outputs-only update * fix(cloudformation): supply location constraint when creating nested stack templates bucket * fix(cloudformation): revisit dependents on attribute changes and treat empty schema create-only lists as authoritative * fix(cloudformation): preview in-place attribute dependents in changesets and support ASG rollback - Include dependents of in-place modified resources with changed attributes in ChangeSet previews - Snapshot and roll back in-place AutoScalingGroup updates on stack failure - Implement LaunchTemplate update rollback to cleanly unwind launch template versions * fix(cloudformation): restore ASG defaults during rollback * fix(cloudformation): skip unchanged resources for empty updates * fix(cloudformation): reconcile resources on identical updates and tolerate null attributes * fix(cloudformation): skip unchanged resources on identical updates |
||
|
|
2170c89d88 |
fix(lambda): include the resource namespace in code volume names (#4872)
* fix(lambda): include the resource namespace in code volume names Code volumes, their completion markers and the populate helper container are named through prefixedDockerName, so FLOCI_DOCKER_RESOURCE_NAMESPACE follows the container name prefix as it already does for Lambda containers. Two namespaced instances on one daemon no longer share a code volume, and one's superseded-volume cleanup can no longer remove the other's. Names are unchanged without a namespace. * fix(lambda): keep two resource namespaces from sharing a code volume Greptile and pgermosen on #4872: a namespace and a function name may both contain dashes, so namespace ci with function foo-code-bar and namespace ci-code-foo with function bar spelled the same volume name for the same code, and the superseded sweep, which works from a per-process map of names, could remove the other instance's volume. A namespaced code volume name now ends with a short hash of the namespace (names without a namespace are unchanged), and the sweep checks the volume's floci_namespace label before deleting, so a volume of another namespace is left alone however its name parses. Also imports the Mockito types in ContainerLauncherCodeVolumeReuseTest instead of qualifying them inline. |
||
|
|
24c655050f |
feat(docker): give internal Docker labels io.floci.* names and keep the old keys as aliases (#4871)
* feat(docker): give internal Docker labels io.floci.* names and keep the old keys as aliases Owner, ECS run, credentials-proxy, security-group and VPC network labels move to io.floci.owner, io.floci.ecs.run, io.floci.ecs.credentials-proxy, io.floci.security-group.helper/workload, io.floci.component and the standard resource-identity keys. The previous keys (floci_owner_port, floci.ecs-run, floci.ecs-task-role-credentials-proxy, floci.security-group-*, floci.component, floci_component, floci_vpc_id, floci_vpc_region, floci_vpc_owner_port) are still written as legacy aliases with the same value. Readers take the new key first and fall back to the legacy one, label filters query both key sets, and owner-scoped cleanup leaves an object alone when the two disagree. All alias keys are reserved from extra-labels. VPC networks are now owned by ownerIdentity (namespace and port) instead of the bare API port, so two namespaced instances on the same port no longer reconcile each other's networks. * fix(ec2): keep pre-upgrade VPC networks of a namespaced deployment its own Greptile and pgermosen on #4871: a VPC network created before the owner label took the resource namespace carries only floci_vpc_owner_port with the bare API port, so with a namespace set the deployment read its own surviving network as a CIDR collision and the startup sweep left it behind. Such a legacy-only network is now this deployment's when it holds this port and its floci_namespace label names this deployment's namespace, the identity the new io.floci.owner key encodes. Matching the bare port alone would also claim, and let the sweep delete, the pre-upgrade networks of another namespace on the same port. Also imports List in ContainerStorageHelperTest instead of qualifying it inline. |
||
|
|
bcb50b765f |
feat(cloudformation): provision Transfer Family servers (#4809)
* feat(cloudformation): provision Transfer Family servers * fix(cloudformation): clear Transfer update snapshot after success * test(cloudformation): cover Transfer tag rollback * fix(cloudformation): match Transfer server return values |
||
|
|
2bdfe45207 |
fix(iam): match a resource policy's Principal by the kind of caller it names (#4839)
IamPolicyEvaluator matched a resource policy's Principal against one string,
the caller's ARN, and compared every principal type other than AWS and "*"
with it by glob. So {"Service": "*"} and {"Federated": "*"} matched every IAM
caller: under enforcement a bucket policy granting {"Service": "*"}, a form AWS
does not accept at all, let an IAM user from any account read the bucket.
Services could not be passed as a caller at all, so {"AWS": "*"}, which AWS
itself relies on to cover services (an FIS Deny pausing DynamoDB replication
names the replication service that way), could not match one. And a role
session matched a Principal naming its role only through a role ARN rebuilt
from the session ARN, which drops the role's path, so a policy naming
role/team/App never matched that role's sessions.
A new RequestPrincipal carries the kind of caller (IAM, service, anonymous),
and for a role session the ARN of the role it assumed. Each principal type now
matches only the callers it can name (IAM User Guide, "AWS JSON policy
elements: Principal"): "*" anyone; {"AWS": "*"} IAM identities and services;
any other AWS entry IAM identities only, a role session matching through its
role's own ARN; {"Service": "<name>"} that service exactly; {"Service": "*"}
nothing; Federated and CanonicalUser never an IAM caller. NotPrincipal is typed
the same way. The direct-IAM-user branch and the aws:PrincipalArn stand-in for
a missing caller stay IAM-only.
A new evaluateResourcePolicyFor takes a RequestPrincipal; the existing String
evaluateResourcePolicy reads its argument as an IAM caller and delegates to it.
The typed method has its own name rather than being an overload of the same
arity, so a call passing a literal null caller to the String form still
compiles. A new
evaluateServicePrincipal decides a call a service makes on its own behalf from
the resource policy alone, since a service principal has no identity policy,
boundary or session policy and SCPs do not apply to it: Deny denies, Allow
allows, silence denies. Nothing calls it yet; the shared service-call
authorizer will.
The enforcement filter now passes the typed principal, with a role session's
role ARN from IamService.resolveCallerArns, to both resource-policy
evaluations. S3's own bucket-policy checks still go through the String
overload; giving them the role ARN follows the change that splits the two ARNs
there.
docs/services/iam.md describes the matching rules.
|
||
|
|
b512d273e1 |
fix(s3): give a role session's aws:PrincipalArn as its role's ARN in S3's bucket-policy checks (#4838)
Follow-up from the review of #4810. S3 evaluates bucket policies itself in two places: the signed-request check (authorizeSignedBucketPolicy, behind s3.enforce-auth) and the CopyObject and UploadPartCopy source check (signedPrincipalResourcePolicyDecision). Both took the caller from S3Service.resolvePrincipalArn, which read IamService .resolveCallerArn, so for a role session the same value, the assumed-role session ARN, served both as the principal a policy's Principal is matched against and as aws:PrincipalArn. AWS puts the ARN of the role that was assumed, path included, in aws:PrincipalArn, as the enforcement filter does since #4810. A bucket-policy Deny keyed on the session ARN therefore fired, and refused the read or the copy, where AWS would not apply it. S3 now reads both through IamService.resolveCallerArns, added in #4810: the caller ARN still drives Principal matching and the same-account test, and the principal ARN fills aws:PrincipalArn. A key IAM does not know keeps S3's account-root fallback, which is both. The private helper is renamed resolveCaller, so it is not mistaken for IamService.resolvePrincipalArn. S3BucketPolicyEnforcementIntegrationTest gets a role under /team/ whose session reads and copies from a bucket with two Denies: one keyed on the role's ARN, which refuses it, and one keyed on the session ARN, which does not. It fails on main, where the read the session-ARN Deny should not touch gets 403. |
||
|
|
cd89be4a80 |
fix(codeartifact): treat identical-content maven redeploy as idempotent (#4837)
Reposilite's own redeployment:false setting rejects a redeploy to an
existing GAV path unconditionally, even when the new content is
byte-identical to what is already there (confirmed against a real
instance). AWS's own CodeArtifact docs ("Overwriting package assets"
in the packages overview) say a republish of an asset whose content
matches what is already published succeeds because the operation is
idempotent; only a genuine content mismatch is a real conflict.
Reposilite has no content-aware mode of its own, so this fetches the
existing artifact first and short-circuits to a 200 on an exact match
rather than ever sending Reposilite a PUT it would reject regardless
of whether the retry was actually harmless.
|
||
|
|
c7bb03ace3 |
feat(iam): model virtual MFA devices with real TOTP verification (#4820)
Replace the ListMFADevices stub with the virtual MFA device lifecycle: CreateVirtualMFADevice, ListVirtualMFADevices, DeleteVirtualMFADevice, EnableMFADevice, DeactivateMFADevice, ResyncMFADevice, ListMFADevices, and the device tag readers/writers. The seed is real rather than a placeholder. CreateVirtualMFADevice generates a 160-bit secret from SecureRandom and returns it as an RFC 4648 base32 string, and EnableMFADevice/ResyncMFADevice verify codes against it as RFC 6238 TOTP, so a caller that does not hold the seed cannot enable a device. The codes must be consecutive, as AWS asks for. Implemented on the JDK's own javax.crypto, with no new dependency. The TOTP arithmetic is the shared core.common.Totp primitive (#4814): CognitoTotp keeps its single-code window and attempt budget, and VirtualMfaCodes holds the consecutive-pair rule that is specific to IAM. Request shapes are validated against the wire model before the device is resolved, so a malformed SerialNumber is a ValidationError rather than a NoSuchEntity, and UserName is enforced as required on Enable and Resync. VirtualMFADeviceName gets its own validator because it is the one IAM name type with no documented maximum length, so borrowing the usual 1-to-128 name check would have rejected names AWS accepts. Device state also reaches the places that report on it: DeleteUser now returns DeleteConflict while a user still holds a device, GetAccountSummary counts devices and their assignments, and the credential report's mfa_active column is backed by real state instead of a constant. Documented as out of scope: QRCodePNG is not returned (it needs a QR encoder, and the otpauth URI it encodes is derivable from the seed that is returned), GetMFADevice takes only FIDO security key ARNs, hardware and FIDO devices are not modeled, MFA still has no effect on authorization because the aws:MultiFactorAuth* keys are never populated, and STS does not accept SerialNumber/TokenCode. |
||
|
|
44e9b1600e |
fix(secretsmanager): refuse an unreadable rotation function reference with InvalidParameterException (#4768)
Follow-up from the review of #4709. A RotationLambdaARN that Lambda's reference parser cannot read was refused with Lambda's own error, InvalidParameterValueException for a malformed reference or ValidationException for a name outside the FunctionName pattern. Neither is an error RotateSecret declares: its four are ResourceNotFoundException, InvalidParameterException, InternalServiceError and InvalidRequestException, so an SDK client could not type the refusal. It is now Secrets Manager's InvalidParameterException ("The parameter name or value is invalid.", HTTP 400), with Lambda's explanation kept in the message. The unit test that pinned the old code used a Region-prefixed partial ARN, which Lambda's documented FunctionName pattern accepts even though Floci's parser does not yet. It now uses references that are invalid under that pattern too: an empty function name, a character the name pattern excludes, and an empty qualifier. They cover both of Lambda's codes. An integration test checks the error type on the wire. |
||
|
|
62bcfb95ed |
fix(ses): refuse a list token whose scope only starts with the request's (#4870)
* fix(ses): refuse a list token whose scope only starts with the request's A tenant-list token named its scope by plain concatenation, so a scope that began with another one, which a name containing the token's own separator can do, passed the prefix check and was read as a position in the wrong list. The token now carries the scope's length. * test(ses): replay a list token on a resource whose name it starts with Cover the scope fix through ListResourceTenants itself: a token issued for an identity whose name continues another identity's with the token separator is refused on the shorter one and still continues its own list. |
||
|
|
d72923ab33 |
fix(core): compare ARN partitions with the resource's region, not the literal aws (#4791)
* fix(core): compare ARN partitions with the resource's region, not the literal aws Part of #4272 (P10b). Running the Java SDK suite against a Floci deployed in cn-north-1 (#4790) found five checks comparing a parsed ARN with "aws" and a seeded ARN fixed to the commercial partition: - RdsService.hasRdsResourceIdentity required partition aws, so DB instances, clusters, DB and cluster snapshots and subnet groups created outside aws failed their own ownership check and were not found right after creation. The proxy target group check had the same comparison, and CopyDBSnapshot refused any source ARN outside aws; it now requires the target region's partition, since a snapshot copies within its partition. - ElastiCache ListTagsForResource rejected every arn:aws-cn: ARN; it now expects the request region's partition and names it in the message. - RAM ignored organization principals outside aws; any published partition is accepted, the organization id ties the principal to the caller's. - The seeded IAM Identity Center instance was arn:aws:sso:::instance/... in every deployment, so China permission sets never found it. It now takes the partition of the deployment's home region, and AddRegion compares against the instance's own primary region instead of a fixed us-east-1. * fix(sso): move a persisted bootstrap instance to its partition, and drop the fixed China allowlist entries Greptile on #4791: a deployment persisted before the seeded instance took its partition keeps it as arn:aws:sso:::instance/..., while its permission sets were already minted in the instance's own partition, so the fix would not reach it. ensureBootstrapInstance now rewrites a stored bootstrap instance whose ARN is not in its primary region's partition. pgermosen on #4791: with #4790 on main, the cn-north-1 allowlist entries this fixes would turn stale and fail the nightly. Measured against this branch in cn-north-1: CloudFormationRdsDynamicReferenceTest, the ten RdsControlPlaneTest entries, RdsJdbcCompatTest#createDbInstanceAndConnectWithPassword and SsoPortalTest now pass and are deleted. The four IAM-token connection tests still fail because they sign their tokens for a pinned us-east-1, which a cn-north-1 database rightly refuses; they move to the group of tests that pin commercial values. * fix(ram): answer the listing operations for the request's region only Greptile on #4791: with organization principals accepted in every partition, a commercial GetResourceShares from a member of the organization returned a China share. The cause predates this PR: GetResourceShares, ListResources, ListPrincipals and GetResourceShareInvitations walked every stored share, so a share created in eu-west-1 was listed through us-east-1 too, while a resource share is a regional resource. RamController now passes the request region and the four operations keep only shares (and invitations to shares) in it, which also keeps a share out of another partition. * fix(ram): resolve a share or invitation to mutate in the request's region only pgermosen on #4791: after the listings were scoped to the request's region, findOwnedShare still walked every stored share, so a share invisible to GetResourceShares in one region could still be deleted, updated, associated, disassociated or retagged from there; AssociateResourceShare would add a resource the same endpoint's ListResources does not report. Accept and RejectResourceShareInvitation had the same gap. The six share mutations and the two invitation responses now take the request region from RamController and resolve only a share or invitation in it: one from another region gets UnknownResourceException or ResourceShareInvitationArnNotFoundException, like an ARN that does not exist. |
||
|
|
9840b5a998 | feat(eks): link containerd certs directory for launch template registry hosts (#4265) | ||
|
|
b5f053c587 |
fix(cloudformation): forward ProviderARNs on AWS::ApiGateway::Authorizer (#4704)
The REST API Gateway provisioner never read ProviderARNs, so a COGNITO_USER_POOLS authorizer was created with no user pool and CognitoUserPoolAuthorizer rejected every token with 401 before inspecting it. Resolve the list like the other list-shaped properties and forward it as providerARNs, which createAuthorizer already accepts. |
||
|
|
9c3593f4d1 |
fix(cloudformation): reject more than one endpoint type on a RestApi update (#4728)
* fix(cloudformation): keep AWS::ApiGateway::RestApi on stack updates UpdateStack runs provision again for every resource, and the RestApi arm called CreateRestApi unconditionally. Each update minted a new API, pointed the stack at it and left the previous one behind, so the API id and invoke URL changed on every deploy. No RestApi property requires replacement, so an update now keeps the API from the previous provision and patches it in place: - Name and Description go through UpdateRestApi, and a template without Name keeps the name the API has. - A changed EndpointConfiguration is applied through the UpdateRestApi paths AWS documents for it, replace /endpointConfiguration/types/<type> and add or remove /endpointConfiguration/vpcEndpointIds, which UpdateRestApi now accepts under the rules CreateRestApi applies. - A Body or BodyS3Location is resolved before anything changes and is still applied with PutRestApi in overwrite mode. - RootResourceId comes from the API's root rather than the first resource listed, which is the root only on a freshly created API. - An API removed out of band is created again, as a replacement that a rollback deletes. The name, description and endpoint configuration are snapshotted before the patch, so a later resource that fails the update puts them back, and so does a Body that PutRestApi rejects. An update that re-applied a Body still reports that rollback is not implemented: PutRestApi replaced the API's resources, methods and models, which the snapshot does not hold. The Resources and Methods on the kept API rely on the update and delete handling from #4511. * fix(apigateway): accept the index form of the endpoint type patch path UpdateRestApi took replace /endpointConfiguration/types/<type> only when the path named the API's current type, as the API Gateway guide writes it. Terraform sends /endpointConfiguration/types/0 instead, which AWS accepts too, and Floci answered it with a 400. An API has exactly one endpoint type, so index 0 is accepted as well. * fix(cloudformation): reject more than one endpoint type on a RestApi update CreateRestApi rejects an EndpointConfiguration with more than one type, but an in-place update of AWS::ApiGateway::RestApi used the first type and reported success. The provisioner now rejects the list before it changes anything, with the same BadRequestException as CreateRestApi, and the stack rolls back with the API unchanged. * fix(cloudformation): delete a recreated RestApi whose OpenAPI body is rejected An update that recreates an API removed out of band, and whose Body putRestApi rejects, left the new API behind. After the failed update the stack keeps its previous resource, so nothing tracked the new API. The provisioner now deletes it before it reports the failure. * fix(cloudformation): list a recreated RestApi that cannot be deleted for cleanup When the delete of an API recreated by a failed update also fails, list that API for the next cleanup, which the restored resource inherits, and report the rollback failure, as Ec2NetworkCfnProvisioner does for a failed undo. * refactor(cloudformation): log the failed RestApi cleanup with warnv Use JBoss Logging's parameterized form, as AGENTS.md requires. |
||
|
|
cbc4cf9b91 |
fix(apigatewayv2): allow an idempotent override-id tag on UpdateApi (#4602)
* fix(apigatewayv2): allow an idempotent override-id tag on UpdateApi A CloudFormation update resends the template's full tag set, so an AWS::ApiGatewayV2::Api that pinned its id with floci:override-id failed every stack update with "Reserved tag key floci:override-id can only be supplied during resource creation" and rolled back. UpdateApi now passes the api id to the reserved-tag guard, which already treats an override equal to the existing id as a no-op (as TagResource does since #3430), and stores the tags with the override keys stripped. A different override value is still rejected. docs/services/api-gateway.md now says a changed override is rejected on TagResource and UpdateApi while resending the current id is accepted. The TagResource half has been true since #3430 but was never documented. CloudFormationIntegrationTest covers a stack update that resends the pinned id and one that changes it. * fix(apigatewayv2): validate UpdateApi tags before applying any field UpdateApi set the name, description and other fields before the reserved-tag guard ran, so a request it rejected had already changed the stored API. A CloudFormation update that changed an api's override id rolled back with the stack reporting UPDATE_ROLLBACK_COMPLETE while the api kept the rejected update's description. The guard now runs first, so a rejected update leaves the api as it was. The CloudFormation test checks the description and tags after the rollback. |
||
|
|
955264cf5d |
fix(ecs): send container logs to the task's account (#4833)
The awslogs streamer was attached without an account. The lines are forwarded from Docker's log threads, which have no request context, so putLogEvents resolved the default account. In any other account the log group and stream had been created in the caller's account, and every line was dropped. Attach with the account of the task's ARN, as Lambda, EKS, MSK and RDS already pass theirs. |
||
|
|
2316b2fc28 |
feat(appconfig): serve feature flag variants to the AppConfig Agent as Amazon Ion (#4674)
* feat(appconfig): serve feature flag variants to the AppConfig Agent as Amazon Ion The AWS AppConfig Agent evaluates multi-variant feature flags itself: it asks AppConfigData for application/ion;type=AWS.AppConfig.FeatureFlags and gets each flag's variants and rules back as Ion. Floci returned the stored JSON document unchanged, which the agent cannot read, so every variant flag failed with NoSuchFlag. A caller that accepts that type now gets the Ion stream AWS sends: a symbol table importing AWS's ops and anns tables, then a list per flag holding its variants (name, rule, attributes) and its default. Rules of the form (eq $attribute "value") are encoded; any other is left to the existing JSON path with a warning. The encoding reproduces a captured AWS response for a real 22-flag profile byte for byte. * fix(appconfig): honour q=0 for Ion, label the stored content type, read the stream back in tests An Accept of application/ion;type=AWS.AppConfig.FeatureFlags;q=0.0000 was treated as acceptable; any run of zeros now means the caller rejects it. The content type of a response was inferred from its first bytes. It now comes from the path that produced them, so a profile that is not a feature flag profile keeps its stored type even if it holds Ion and the caller accepts the feature flag type. The tests decode the stream with Amazon's ion-java (test scope), with the ops and anns shared tables registered, instead of checking the encoder against itself. * fix(appconfig): encode a basic flag in an Ion profile as an annotated string AWS sends a flag without variants in the Ion format as its retrieval-time JSON, annotated with its key, not as a list holding a default variant. The encoder now does the same, reusing the JSON path's per-flag conversion, so a profile that mixes variant and basic flags reads as AWS's. The encoder and docs cite the layout AWS documents for the agent's local development mode rather than the captured responses. |
||
|
|
95315b8b18 | fix(rds): store and return DeletionProtection in DescribeDBInstances (#4557) | ||
|
|
45b7be9362 |
feat(cognito): offer an email code on managed login (#4765)
* feat(cognito): offer an email code on managed login Managed login could not sign in a user of a passwordless pool: /login was a username and password form only. When the pool's SignInPolicy allows EMAIL_OTP and the client allows USER_AUTH, the page now asks for the username first, offers the factors that user has (PASSWORD and EMAIL_OTP), and for EMAIL_OTP sends a code through the USER_AUTH EMAIL_OTP challenge, so it arrives in Floci's SES. A correct code signs the user in as the password does: a session cookie and a redirect to the callback with code and state, redeemed at /oauth2/token with PKCE. The USER_AUTH session travels in a hidden field. A wrong code shows the code field again and keeps the session for another try. An unknown user is asked for a code like anyone else, but nothing is sent and no code signs them in. Pools and clients without choice-based sign-in keep the password form unchanged. USER_AUTH ignored the sign-in policy for existing users, so a pool that allowed only EMAIL_OTP still offered PASSWORD and PASSWORD_SRP. The available challenges are now narrowed to AllowedFirstAuthFactors, whose PASSWORD covers both password challenges, and a PREFERRED_CHALLENGE or SELECT_CHALLENGE answer outside it is refused as an unavailable one is. A pool with no sign-in policy is not narrowed. /oauth2/authorize now carries login_hint to /login, on Floci's host and on a custom domain, and /login fills the username field with it, as AWS documents. Refs #4759 * fix(cognito): harden the managed login email-code step The step after the username told accounts apart. The page looked each user up, so a user with one factor skipped the choice others got, a user who could not sign in was told why, and the USER_AUTH session in the code form named the user it was for. The page now offers the policy's factors to every username, and a user who is unknown, cannot sign in, or has no verified email gets the same code field, with no message sent. Why a user cannot sign in shows only after a correct code. Asking again within the resend limit shows the code field for the code already sent, instead of an error only a real user could get. USER_AUTH session tokens no longer carry the username. The same code could sign in twice: requests answering one session with its code at once could all pass the check before any removed the session. The code is now checked and the session spent under the lock that every read and removal of a session takes, RespondToAuthChallenge's included, so one request signs in and the others find the session spent. A correct code spends the session, so a failure after it, such as a failing PostAuthentication trigger or a user who cannot sign in, now goes back to the username step with the reason, instead of showing a code field that can no longer work. Refs #4759 * fix(cognito): redeem an email or SMS sign-in code once across sessions Every live EMAIL_OTP or SMS_OTP session of a user takes the user's one sign-in code, and the code store reads a code before it deletes it. Two of a user's sessions answered with the code at once through RespondToAuthChallenge could both pass the check and both sign in. Such a second session is easier to come by now that asking the sign-in page for a code again within the resend limit opens one. RespondToAuthChallenge now checks the code under the lock the sign-in page checks it under, so one session signs in and the other gets CodeMismatchException. Nothing held under that lock calls a Lambda trigger. Refs #4759 * fix(cognito): redeem verification codes under a per-user lock Redeeming an email or SMS sign-in code held the lock shared by every USER_AUTH session while the code store read and wrote the code, which in persistent storage mode is a disk write, so one user's slow redemption held up other users' sign-ins. That lock now guards the session maps alone. The code store now redeems a code once by itself: consume() takes a lock striped by the code's pool, user and purpose, and calls nothing but the store under it, so no trigger runs and no other lock is taken there. Sign-up, password reset and attribute verification codes gain the same: each is redeemed once and every wrong attempt counts, where concurrent requests could redeem one twice or undercount its attempts before. Of several requests answering a user's sessions with one code at once, one signs in and the rest get CodeMismatchException. The sign-in page looks its session up, redeems the code, then removes the session, and still signs in if RespondToAuthChallenge spent the session meanwhile, since only one of them can have redeemed the code. Refs #4759 * fix(cognito): issue and invalidate verification codes in turn with redemption Only consume() took the code store's per-key lock, so redeeming the old code could read it, let a resend write the new one, and then delete the new one, leaving the user a code that never works. issue() and the two invalidations now take the same stripe, so each of them and consume() see the code as the one before left it. Refs #4759 * fix(cognito): offer the choice for a preferred challenge the user cannot take USER_AUTH refused a PREFERRED_CHALLENGE that the sign-in policy leaves out or the user has not set up with InvalidParameterException. AWS answers it as it answers InitiateAuth without one: SELECT_CHALLENGE and the challenges the user can take, which is what clients expect on the main sign-in path. Floci now does the same, and refuses only a name Cognito does not support, with AWS's message listing the ones it does. An unknown user whose client prevents user existence errors gets the same answer as a known user: the preferred challenge when the policy allows it, and the choice when it does not. A SELECT_CHALLENGE answer outside the choice is still refused. Refs #4759 * fix(cognito): default a pool's sign-in policy to PASSWORD alone AWS's DescribeUserPool reports a SignInPolicy of {"AllowedFirstAuthFactors": ["PASSWORD"]} for a pool created without one, on any tier, and USER_AUTH offers that pool's users password challenges alone. Floci stored no policy and did not narrow such a pool, so it offered EMAIL_OTP and SMS_OTP that AWS would not. CreateUserPool now stores the default, UpdateUserPool keeps the policy when the request omits Policies and puts the default back when its Policies has no SignInPolicy, and a pool persisted without one is treated as PASSWORD alone. Refs #4759 * test(cognito): pass login_hint in the scope tests from main |
||
|
|
f1d718cae2 |
fix(cognito): scope OAuth tokens to the requested scopes (#4771)
* fix(cognito): scope OAuth tokens to the requested scopes * fix(cognito): require the admin scope on access-token operations * fix(cognito): bind an authorization code to the scopes granted at authorize * fix(cognito): keep the provider's requested scopes apart from Cognito's grant |
||
|
|
c60da16c54 |
fix(glue): ignore Avro custom attributes in schema identity (#4692)
* fix(glue): ignore Avro custom attributes in schema identity * fix(glue): preserve lookup across legacy duplicate schema versions * fix(glue): synchronize schema definition lookups with deletion * perf(glue): narrow definition lookup lock * fix(glue): revalidate schema format during definition lookup * fix(glue): scope Avro schema properties by type * fix(glue): use modeled error for schema lookup retries |
||
|
|
0c8d184854 |
fix(cloudwatch): raise ResourceNotFoundException when a tag operation names a resource that does not exist (#4783)
* fix(cloudwatch): raise ResourceNotFoundException when a tag operation names a resource that does not exist TagResource, UntagResource and ListTagsForResource answered 200 for any ARN, so tagging a typo'd or deleted alarm, dashboard or metric stream told the caller the tag had been applied. AWS raises ResourceNotFoundException. All three operations now resolve the ARN first and report a 404 when nothing answers to it. The fix sits in the three services rather than in the handlers, because CloudWatch Metrics serves these operations over both Query and JSON 1.1 and the two handlers route to the same service methods. A handler-level check would have left the other protocol still answering 200. What the 200 was hiding is worth naming, because "return an error instead of 200" understates it. The write path resolved the ARN and then did nothing with the miss: tagResource and untagResource each ended in an ifPresent, so a tag against an unknown ARN was discarded, and ListTagsForResource answered the empty map. So the ARN was neither rejected nor recorded. Nothing was stored against a phantom resource, which is the one mercy here, but a caller that wrote a tag and read back an empty list had no way to tell "this resource has no tags" from "this resource does not exist". That is why ListTagsForResource is included rather than left alone. It is the one operation whose answer changes for a caller doing a speculative list, and the one whose leniency made the silent write survive a round trip. No test or caller in the repository depended on the empty-map answer for an unknown ARN: the only internal caller is CloudWatchDashboardCfnProvisioner.reconcileTags, and both of its call sites pass an ARN that putDashboard has just returned. The error code is ResourceNotFoundException, not the shorter ResourceNotFound that GetDashboard, DeleteDashboards and SetAlarmState answer with. Those are two separate shapes in the CloudWatch model, mapped to two exception classes by the SDK, and the model declares the longer one on exactly these three operations. CloudWatch Logs needed no change. Its own TagResource, UntagResource and ListTagsForResource already resolve the log group and raise ResourceNotFoundException, which the new test pins so the two halves of CloudWatch tagging cannot diverge in the other direction. * fix(cloudwatch): resolve a dashboard by either the regionless or the region-ful form of its ARN Dashboards are a global resource and AWS documents their ARN without a region, arn:aws:cloudwatch::<account-id>:dashboard/<dashboard-name>, on both the TagResource and the ListTagsForResource pages. Floci mints a region-ful one. The dashboard lookup now accepts both shapes deliberately, so a caller holding either resolves. Accepting both is what stops the preceding commit regressing a caller that does the documented thing. Until the tag operations raised on a miss, the divergence was invisible on this path: the documented ARN matched no stored dashboard, and the answer was a silent 200 with an empty tag map. Turning a miss into ResourceNotFoundException would have turned that into a hard 404 for a dashboard that exists. Only an absent region stands in for the dashboard's own, so an ARN naming some other region is still a miss and does not resolve to a same-named dashboard here. What Floci mints is not changed. Clients may already hold the ARNs it has handed out, so bringing the minted shape into line with AWS alters values already in circulation and belongs in its own change; it is tracked separately. The tolerant lookup is all that is needed to keep this path correct, and it is strictly more permissive than before, so it cannot break a caller that works today. Alarms and metric streams were checked rather than assumed: both mint region-ful ARNs and AWS documents both region-ful, so the question is dashboards only. Also reworded the not-found message on the alarm path to name the ARN that did not resolve instead of asserting it was an alarm. Both tag handlers route every ARN that is not a dashboard and not a metric stream to that path, including kinds AWS considers taggable and Floci does not serve, a Contributor Insights insight-rule ARN being the one AWS documents. Reporting that no resource matches the ARN is true of those; "alarm not found" was not. No Contributor Insights support is added here. * test(cloudwatch): assert a refused tag call left the real resource untagged The not-found tests tagged the unknown ARN env=prod and then re-tagged the real resource env=dev before reading it back, so a failed call that had written through to the real resource would have been overwritten and the assertion would still pass. Read the real resource's tags first; they must be empty. * test(cloudwatch): import matchers and use configureAwsContentTypes Import Matchers.not and java.util.Map in the new tests instead of writing them inline, register the x-amz-json content types through RestAssuredJsonUtils.configureAwsContentTypes() in place of registerParser and the hand-built encoder config, and drop DeleteDashboards from the requireDashboard Javadoc: only GetDashboard declares ResourceNotFound. |
||
|
|
436c15ca38 |
fix(sts): reject AssumeRole for roles that do not exist (#4463)
* fix(sts): từ chối AssumeRole khi role không tồn tại trong IAM AssumeRole trước đây cấp credential cho mọi role ARN, kể cả role chưa từng được tạo (iam:GetRole trả NoSuchEntity). Giờ trả AccessDenied như AWS, bất kể enforcement có bật hay không; trust policy vẫn chỉ được đánh giá khi enforcement bật. Các test cũ assume role chưa tạo được sửa để tạo role trước. Closes #4392 * fix(sts): so sánh chính xác role ARN và cập nhật compatibility tests - StsQueryHandler: kiểm tra roleArn khớp chính xác role.getArn() để tránh chấp nhận role cùng tên khác path - StsQueryHandlerTest: đổi tham số helper sang IamRole thay vì Optional, bổ sung test case từ chối role khác path - AssumeRoleTrustPolicyIntegrationTest: sửa Javadoc mô tả đúng hành vi từ chối unknown role - Cập nhật compatibility tests (Java, Node, Python, AWS CLI) để tạo role trước khi assume và kiểm tra lỗi 403 khi role không tồn tại * fix(sts): accept partition-correct role ARNs and strictly catch cleanup exceptions - StsQueryHandler: match role ARN structurally using AwsArnUtils to admit valid noncommercial partition ARNs - StsQueryHandler: preserve caller partition when generating assumedRoleArn - StsTest, test_sts.py, sts.test.ts: only ignore NoSuchEntity/EntityAlreadyExists in cleanup, re-raising unexpected errors per AGENTS.md - StsQueryHandlerTest, AssumeRoleTrustPolicyIntegrationTest: add unit and integration coverage for partition-correct role ARNs * fix(sts): preserve role partition in resolved session caller ARN * fix(sts): preserve stored role partition in assumed identity * fix(sts): validate web identity role ARN * fix(sts): require role existence in AssumeRoleWithWebIdentity and reuse path helpers * fix(sts): keep IAM ARN partition behavior unchanged * fix(sts): derive trust caller account from identity ARN * fix(iam): migrate legacy credential reports by partition * fix(iam): serialize legacy credential report migration * test(iam): make credential report race deterministic * fix(sts): address review feedback * fix(sts): reuse IAM role path normalization |
||
|
|
a22e65f993 |
feat(ses): paginate the tenant and import job lists (#4819)
* feat(ses): paginate the tenant and import job lists Page ListTenants, ListTenantResources, ListResourceTenants and ListImportJobs on the shared SES paging, each with its own token namespace, and delete SesTenantService.validateListPaging. The tenant lists answer the probed SES rules: PageSize 1 to 100 with the Smithy validation messages, an empty NextToken refused with its Smithy message before the tenant or resource is looked up, an unreadable token answered "Invalid Next Token", tenants listed by name, a tenant's resources by ARN and a resource's tenants in association order. ListImportJobs could not be probed and is modelled on the tenant lists, keeping Floci's oldest-first order. Without a PageSize all four lists serve up to 100, a Floci assumption where nothing could be measured. * fix(ses): follow the probed order, aggregation and token binding on the tenant lists A second probe of real SES showed three differences on ListTenantResources and ListResourceTenants: the tenant or resource is looked up, and the filter checked, before the page size and token; a page size outside the bound and an empty NextToken are reported together in one validation message; and a token is refused once the tenant, resource or filter changes. ListImportJobs, which cannot be probed, follows the same rules. The service docs keep the per-list paging detail and gain a paragraph for these four lists. |
||
|
|
bcf1045536 |
feat(codepipeline): execute ThirdParty GitHub version 1 source actions (#4615)
* feat(codepipeline): execute ThirdParty GitHub version 1 source actions Downloads the configured branch archive from codeload.github.com and republishes it with the repo at the artifact root, keeping unix modes and symlinks; zip entries decode as STORED or DEFLATED only, avoiding the ZSTD/XZ dispatch path that breaks the native build. * fix(codepipeline): bound GitHub source archive size and reject escaping entries Cap download, uncompressed bytes and entry count; reject escaping paths and symlinks; end the Inflater. * refactor(codepipeline): use explicit types and imports in the GitHub source, fix its symlink comment Rename the test class to the *ServiceTest convention and correct the invalid-ref error message, which claimed the branch cannot contain slashes. * fix(codepipeline): report the GitHub commit as the source revision and harden the GitHub source Only the ThirdParty version 1 GitHub action takes the codeload path, so a custom action named GitHub still reaches its worker. The revision is the commit SHA from the archive comment, recorded in sourceRevisions as well. Branch segments are percent-encoded, entry checksums are verified, and the archive caps drop to 128 MiB to keep the heap bounded. * test(codepipeline): wait on state with Awaitility and order imports in the GitHub source test * refactor(codepipeline): make GitHub source limits final behind overridable accessors Archive size, entry and base URL settings move from mutable fields to protected accessors that tests override. Also reject archive entries with a leading slash instead of treating it as the top-level separator. |
||
|
|
5000bcd041 |
fix(apigateway): accept a region label before the built-in execute-api suffixes (#4705)
* fix(apigateway): accept a region label before the built-in execute-api suffixes extractApiId accepted a region label only before localhost, the configured hostname, or an AWS DNS suffix, so <apiId>.execute-api.<region>.localhost.floci.io (the shape a client derives from a stage's invoke URL) was never claimed and fell through to S3's path routes, answering NoSuchBucket for the stage segment. Accept the built-in localhost.floci.io and localhost.localstack.cloud suffixes after a region label too, for REST and HTTP APIs alike. Closes #4701 * fix(apigateway): accept every published region label on execute-api hosts extractApiId validated the region label with a two-letter-geo pattern, so eusc-de-east-1 was rejected before the suffix was checked and the request fell through to S3, on every tail including amazonaws.eu. Check the label against the published region ids with AwsRegions.isRegionId, the same test RegionResolver.resolveRegionFromHost applies, so the hosts the filter claims match the regions it can resolve. * fix(apigateway): accept execute-api region labels not yet in the partition catalog isRegionId accepts only regions in the vendored published list, so a region launched after that data was generated was rejected on its execute-api host even though signed requests accept it. Use RegionResolver.isKnownRegion, which falls back to each partition's botocore region regex; an unrecognized label such as zz-nowhere-9 is still rejected. |
||
|
|
b2dd5665db |
fix(s3): validate notification destinations before storing configuration (#4747)
* fix(s3): validate notification destinations before storing configuration * test(s3): consume validation events before POST notifications * fix(s3): preserve bucket lifecycle during notification validation * fix(s3): enforce SQS queue policies for notifications * fix(s3): align notification validation with IAM enforcement * fix(test): stub IAM config for S3 failure delivery * fix(s3): validate cross-account SNS without test publish * fix(sns): recognize legacy topics during destination validation * docs(s3): describe cross-account notification validation * fix(s3): skip cross-account SNS notification test publishes |
||
|
|
bc2592e300 |
fix(ecs): send container logs to the awslogs group and stream from the task definition (#4808)
* fix(ecs): send container logs to the awslogs group and stream from the task definition * fix(ecs): keep console output for containers without awslogs |
||
|
|
8f904afa5a |
fix(s3): verify header and presigned POST signatures under validate-signatures (#4786)
* fix(s3): verify header and presigned POST signatures under validate-signatures floci.auth.validate-signatures verified only presigned URL signatures. A header-signed request or a presigned POST with a forged signature or an unknown access key was accepted unless enforce-auth was on, and enforce-auth also turns on bucket-policy evaluation, so there was no way to authenticate S3 requests without authorizing them. S3 verifies a signature before, and independently of, deciding from policies and ACLs whether the caller may act. validate-signatures now does the first step for every placement: S3HeaderSignatureFilter runs under either flag, and a browser POST that carries SigV4 form fields is verified. Bucket policies are still not evaluated, and unsigned requests are still left to enforce-auth, which decides anonymous access from policies and ACLs as AWS does. docs/services/s3.md now says what each flag verifies. * chore(s3): keep validatePresignedPostAuth's Javadoc on its method * docs(s3): clarify multi-account credentials under signature verification * docs(s3): update docs/configuration/multi-account.md Signed-off-by: Abhigya <abhigyakrishna21@gmail.com> --------- Signed-off-by: Abhigya <abhigyakrishna21@gmail.com> |
||
|
|
fa4d4663a2 |
feat(lambda): honour the Invoke Qualifier and wait between asynchronous retries as AWS does (#4733)
* feat(lambda): honour the Invoke Qualifier query parameter * feat(lambda): wait between asynchronous retries as AWS does A failed Event invocation now waits floci.services.lambda.async-retry-delay-seconds before its first retry and twice that before its second (default 60, matching AWS), capped at the event's remaining maximum age. The concurrency permit is held only for each attempt, and an emulator reset drops retries still waiting. * test(lambda): prove asynchronous retries end to end * docs(lambda): document asynchronous retry timing and the Invoke Qualifier * fix(lambda): drop retries of deleted functions and tighten async retry edges - Drop a pending asynchronous retry when its function (or version) was deleted. - Decide expiry once, on the injected clock, when a retry is scheduled. - Check the reset generation at routing, so no stale outcome is delivered. - Restore upstream behavior when an attempt throws: stop retrying and route the previous result, or UnknownError when there is none. - Harden tests: in-order permit release, deterministic reset, error types and an unqualified-ARN Qualifier case for Invoke. * fix(lambda): drop a deleted function's pending events on every path Replace the store lookup with a per-function deletion counter, captured when the event is invoked and checked wherever an event is attempted or routed. This covers the expiry path, which bypassed the old check, and a delete-and-recreate of the same name during the wait, which the lookup could not see. Verified against AWS that DeleteFunction drops pending retries without delivering a record. * fix(lambda): clear deletion counts before bumping the reset generation An invoke between the two statements of clear() captured the new generation with a stale deletion count and its event was dropped. The expiry-path deletion test now drops inside the first attempt, so it no longer races the one-second maximum event age. * fix(lambda): keep deletion counts across a reset Clearing them while the old generation was still current let a deleted function's pending event see a zero count and be routed. A reset now only bumps the generation, in one atomic step. * fix(lambda): drop an Event invoke that races DeleteFunction An Event invoke that resolved the function just before a concurrent DeleteFunction could take its deletion-count snapshot after the delete had already moved the count. The event then never looked stale, so the deleted function could still be started and a failure record could still reach its destination. DeleteFunction now moves the deletion count only after the function has left the store, and an Event invoke checks that the function is still in the store after it takes its snapshot and before it queues the event. Either the check sees the function gone and the invoke answers 202 without queueing anything, or the snapshot predates the count change and the event is dropped as stale later. * fix(lambda): validate the Invoke Qualifier query parameter Invoke treated an empty or blank Qualifier as if none had been given and ran $LATEST, and it passed a qualifier longer than 128 characters on to the lookup, which answered 404. AWS rejects both with a 400. A supplied Qualifier must now be 1 to 128 characters of letters, digits, $, _ and -, or Invoke fails with ValidationException. The controller reads the parameter from the raw query, because @QueryParam reports a present but empty value as null and the check could not see it. * fix(lambda): stop pending events before a delete or reset removes state DeleteFunction moved a function's deletion count only after it had removed the function's code and store entry. A retry whose timer fired in that gap still passed the staleness check, tried to start a function with no code, and could deliver a failure record to its destination. An attempt that finished in that gap could deliver its OnFailure record. DeleteFunction now moves the count before it deletes anything, which stops every queued or running event, and again after the store entry is gone, which stops an Event invoke that read the count in between. An emulator reset wiped storage before the executor's clear() moved the reset generation, so a retry firing during the wipe could run or deliver against half-cleared state. The executor now also moves the generation in beforeReset(), which runs before the wipe. clear() still moves it, to drop events accepted between the two. * test(lambda): fix a doc comment and name the tolerated Docker ping failure The class comment now reads "wait as they do on AWS". The Docker ping check names its caught exception "expected" and says why returning false is safe: the test is then skipped rather than failed. * fix(lambda): count version and alias invokes against the function's reservation Routing the Invoke Qualifier to a published version meant a qualified invoke took its permit against the version's snapshot, which carries no reservation, so a reserved concurrency of 0 on the function no longer throttled it and a positive one stopped counting those invokes. The name-qualified path (fn:1, fn:alias) already had the same gap. Reserved concurrency is function-wide in AWS, so the executor now takes the permit against the function's $LATEST record, which holds the reservation. That covers direct Invoke with a Qualifier, qualified names and ARNs, aliases, event source mappings and asynchronous retries alike. It reads the stored record rather than the limiter's region registry because event source pollers can invoke before LambdaService has rehydrated that registry after a restart. * fix(lambda): drop a deleted function's pending events before draining its containers DeleteFunction drained the warm pool before fencing pending asynchronous events, and draining blocks while idle containers stop. A retry whose timer fired in that window still passed the staleness check and could cold-start a container after the drain, leaving it warm for a function that no longer exists. The fence now goes up first. |
||
|
|
8a2b998378 |
fix(mwaa): restrict CLI proxy to supported commands (#4797)
* fix(mwaa): restrict CLI proxy to supported commands * test(mwaa): cover every supported CLI command |
||
|
|
6a98f69a5d |
refactor(core): extract the shared TOTP primitive from Cognito (#4814)
Cognito's software-token MFA computes RFC 6238 time-based one-time passwords: HMAC-SHA1 over 30-second steps, truncated to six digits, with the secret handed out as RFC 4648 base32 so an authenticator app can be programmed from it. None of that is specific to Cognito, and IAM's virtual MFA devices need exactly the same arithmetic. Move it to core.common.Totp and leave CognitoTotp as a thin view over it, keeping its single-code drift window and its attempt budget. Behaviour is unchanged: CognitoTotp's public surface and semantics are identical, which its existing test still covers, and the new TotpTest pins the arithmetic against RFC 6238 Appendix B's published vectors rather than against this implementation's own output. The static SecureRandom moves with it, so the --initialize-at-run-time registration moves from CognitoTotp to Totp. Without it GraalVM captures the instance in the image heap and the native build aborts. Only what Cognito needs crosses the package boundary. isSixDigits, codeEquals and the base32 helpers stay package-private until a second caller actually needs them. This is step 1 of 2. Step 2 adds IAM virtual MFA device support on top of this primitive, instead of landing a second copy of the same code. |
||
|
|
8fdf23d303 |
fix(ses): authorize the SES v2 operations and routes botocore added since the rule table (#4811)
Follow-up from the review of #4775. The SES v2 rules in IamActionRegistry came from botocore 1.43.62's model. The current model (botocore develop at 9931e9741, 2026-09-29) adds four operations, AssociateEmailIdentityCertificate, DisassociateEmailIdentityCertificate, ListEmailIdentityCertificates and UpdateConfigurationSet, and moves two: ListConfigurationSets is now POST /v2/email/list-configuration-sets and ListEmailIdentities POST /v2/email/list-identities, each taking a Filter in the body, where they were GET /v2/email/configuration-sets and GET /v2/email/identities. Each new route gets its rule, mapped to the action AWS's service reference lists for it (ses:<Operation> in every case). The two GET routes keep theirs, since older SDKs, and Floci's own routes, still use them. 118 routes in all; no two can match the same path. Floci serves none of the new routes yet, so nothing was exposed; the rules make sure they are authorized from the day a route lands. The test table is regenerated from the current model and the service reference; its six new rows fail without the new rules. |
||
|
|
cf04f433b6 |
fix(iam): give a role session's aws:PrincipalArn as its role's ARN under enforcement (#4810)
Follow-up from the review of #4716. The enforcement filter put the assumed-role session ARN (arn:aws:sts::<account>:assumed-role/<role>/<session>) in aws:PrincipalArn for a caller using role-session credentials. AWS puts the ARN of the role that was assumed there, path included ("For IAM roles, the request context returns the ARN of the role, not the ARN of the user that assumed the role", IAM User Guide, global condition keys). So an identity or resource policy keyed on the role's ARN never matched its sessions: an Allow scoped that way refused them and a Deny written that way never fired, while a condition naming the session ARN, which AWS says not to use for this key, matched. The filter now reads both values from one lookup of the key, through a new IamService.resolveCallerArns: the caller ARN, still the session ARN for a role session, and the principal ARN, the role ARN the session recorded when it was issued (#4716). A user's key and the account-root principal give the same value for both. One lookup matters: two could straddle the session's expiry, answer the first and not the second, and leave a fallback to fill aws:PrincipalArn with the session ARN, so a Deny keyed on the role's ARN would miss. resolveCallerArn and resolvePrincipalArn now read through it, and the STS trust check, which made the same two lookups, uses it too. Both places the filter fills the key (the request's own authorization and authorizeAdditionalResource) take it from there. The session ARN stays the caller's principal for matching a resource policy's Principal, which is a separate change. docs/services/iam.md describes the key for role sessions and drops the caveat about the session name, which no longer applies to it. The integration test covers both paths: IAM calls whose policy is keyed on the role's ARN, and an SSM GetParameter on a Secrets Manager reference, whose secretsmanager:GetSecretValue check goes through authorizeAdditionalResource. The SDK compatibility suite's IamEnforcementTest gets the same IAM checks with AWS SDK clients; like the rest of that class it runs only against a Floci with IAM enforcement on. |
||
|
|
0a54d0708e |
feat(eventbridge): execute target retry and dead-letter policies (#4736)
* feat(eventbridge): execute target retry and dead-letter policies PutTargets now validates, stores and returns a target's RetryPolicy and DeadLetterConfig. Failed deliveries from PutEvents and scheduled rules are retried with backoff within the configured attempts and event age, and exhausted or non-retryable events are sent to the standard SQS dead-letter queue with the AWS failure attributes. * fix(eventbridge): order target retries by due time and honour a lowered retry limit Pending retries are kept in a queue ordered by their next attempt, so each wake-up takes only what is due instead of scanning every pending retry. The clock is read again for each retry, so a slow target cannot let a later retry run past its event age, and a reset mid-tick stops the remaining retries. A retry now checks the target's current MaximumRetryAttempts before invoking it, as it already did for MaximumEventAgeInSeconds. * fix(eventbridge): drop a target retry that outlives a reset An attempt still running when the emulator resets can fail afterwards. Its retry or dead-letter delivery is now dropped, so a rule and target recreated under the same names after the reset do not receive a pre-reset event. A scheduled retry wake-up keeps only its due time, not the event. * fix(eventbridge): wake a target retry at its due time after a slow attempt The retry delay was measured from when the failed attempt started but counted from when it failed, so every retry after a slow attempt woke late by the attempt's duration, and an expired event reached its dead-letter queue late. * fix(eventbridge): drop a removed target's retries and drive retries from one tick RemoveTargets now drops the removed targets' pending retries, so a target re-added under the same Id does not receive an event from before its removal. Pending retries are taken by one periodic tick, as in the scheduler's dispatcher, instead of a timer per retry, so a reset leaves no timers behind. * fix(eventbridge): warn about a blank dead-letter queue ARN PutTargets accepts a whitespace-only DeadLetterConfig Arn, since AWS constrains only its length. Delivery skipped it without a word; it now gets the same WARN as any other dead-letter queue that is not a standard SQS queue in the rule's region. |
||
|
|
4716ac9992 |
fix(ecs): end a deployment the circuit breaker detects as failed (#4767)
* feat(ecs): end a deployment the circuit breaker detects as failed A service deployment whose tasks never start stayed IN_PROGRESS forever. With deploymentCircuitBreaker enabled and rollback off, a service task that stops without reaching RUNNING now counts toward the breaker's threshold. Once the count reaches the threshold, the deployment is STOPPED with a statusReason, finishedAt and stoppedAt. The service's deployment reports rolloutState FAILED, and the reconciler launches nothing more for it. The threshold follows the circuit breaker documentation: BOUNDED_PERCENT (default 50) of the desired count rounded up and clamped to 3..200, UNBOUNDED_PERCENT without the clamp, COUNT as given. resetOnHealthyTask (default true) zeroes the count when a task starts. With the breaker off, ECS keeps retrying, and so does this. With rollback on, AWS rolls back instead of stopping; that is not modelled, so such a deployment is left in progress rather than reported STOPPED. The reconciler now settles a deployment on the tick its tasks come up, so a later launch failure cannot fail a deployment that already completed. * fix(ecs): settle a converged deployment on every reconciler tick The tick settle ran only when the tick launched tasks. A deployment that converged without a launch was left unsettled. Scaling in to the tasks already running is one way that happens. If a task then died and its replacements failed to start, the circuit breaker stopped a deployment that had already completed. * fix(ecs): read a deployment's breaker state under its lock deploymentsFor runs on request threads and read the failure count and the triggered flag straight off the live record. It now reads them from a copy taken under the deployment's lock, like every other read path. The reconciler's halt check does the same. * test(ecs): pin the circuit breaker threshold's rounding, cap and unbounded type Three cases: 50% of 7 rounds up to 4, 50% of 402 is capped at 200, and UNBOUNDED_PERCENT at 100% of 201 goes past the cap to 201. * fix(ecs): count only tasks that failed to start against the circuit breaker Any launch that came back short of RUNNING used to count, including a task a user stopped with StopTask while its image was still pulling. Only a STOPPED task with stopCode TaskFailedToStart counts now. The Docker start-failure path always sets that code. * fix(ecs): use a neutral reason when the circuit breaker ends a deployment The previous wording read like an AWS message but does not appear in the AWS documentation. The ServiceDeployment reference describes statusReason only by example: the circuit breaker detected a failure. Both statusReason and rolloutStateReason now say that. * fix(ecs): keep a circuit-breaker-failed deployment halted across a restart Deployment records live only in memory, while services persist. After a restart the failed deployment had no record, so the reconciler launched its tasks again and nothing could count their failures. The failed deployment id is now kept on the persisted service model, as lastCompletedDeploymentId already is, and both the reconciler's halt and the FAILED rolloutState read it from there. |
||
|
|
95b5acb1db |
test(lambda): wait for each SQS poll before advancing the batching-window clock (#4796)
batchingWindowHoldsUnderfilledBatchUntilTheWindowElapses slept 25ms between polls and then moved the fake clock forward. The poll runs on a separate thread and starts the window when it reads the clock, so a poll that took longer than 25ms on a busy runner started the window late (for example at 3s). The later polls were skipped while it was still running, and at 5s the window had not elapsed, so the function was never invoked. pollAndInvoke now returns the future of the submitted poll, and the test waits for each poll to finish before moving the clock. |
||
|
|
419e840260 |
fix(s3): store x-amz-meta-* passed in a presigned URL query string (#4753)
* fix(s3): store x-amz-meta-* passed in a presigned URL query string Presigners such as the AWS SDK for JavaScript v3 hoist user metadata into the query string instead of sending it as headers. Read x-amz-meta-* from the query as well, with headers taking precedence. Fixes #4752 * fix(s3): prefer signed query metadata over unsigned headers The presigned URL signature covers x-amz-meta-* query parameters, so an unsigned header with the same key must not replace them. Also cover presigned CreateMultipartUpload and CopyObject with query metadata. * fix(s3): reject unsigned x-amz-meta-* headers on presigned requests S3 requires every x-amz-* header sent with a presigned URL to be listed in X-Amz-SignedHeaders and answers HeadersNotSigned otherwise. Apply the existing unsigned checksum header check to user metadata headers too. |
||
|
|
75b56d49e2 |
fix(sqs): honor ReceiveMessage message attribute selectors (#4699)
* fix(sqs): honor ReceiveMessage message attribute selectors * fix(sqs): match receive attribute checksum to selected fields * test(sns): use the SQS Query message attribute selector * fix(sqs): match message attribute prefix selectors |
||
|
|
27ddf0bb00 |
fix(core): mint every regionless ARN in its partition and gate blank-region Arn.of calls (#4787)
* fix(core): mint every regionless ARN in its partition and gate blank-region Arn.of calls Part of #4272 (P10a). Arn.of derives the partition from the region, so a blank region always minted arn:aws:, and the partition literal gate could not see it because it is a call shape, not a literal. Sixteen call sites did this, and three gated literals were left: - RdsSigV4Validator built the rds-db:connect resource as arn:aws:rds-db:, so a China IAM policy naming arn:aws-cn:rds-db: never matched and IAM auth to an RDS proxy was denied there. - CloudFront, Organizations, Cost Explorer anomaly monitors and the SSO portal role ARN now take the request's partition (RegionResolver injected). - S3 bucket ARNs (event notifications, AWS::S3::Bucket Arn, Cost Explorer S3 usage) take the bucket's or the stack region's partition; the Lambda CFN default role, the Kinesis ESM invokeIdentityArn, the EC2 launch template CreatedBy and the SQS AddPermission root principal take their own region's. - FlinkContainerManager's fallback key goes through Arn.of, and the CloudFormation S3 TemplateURL host check accepts every partition's DNS suffix. partition_literals.py gains a gated, code-scoped blank-region-arn category (Arn.of with a "" or null region, comments excluded). The baseline is now empty, so any new literal or blank-region mint fails Partition Literals. * fix(core): scan blank-region Arn.of calls across lines and skip text blocks Greptile on #4787: the blank-region-arn category ran per line, so a call whose region argument sits on the next line escaped it, and text-block contents were kept, so an example inside one would count as a call against the empty baseline. code_text now blanks comments and text blocks over the whole source and the code categories match across lines, reporting the line the call starts on. |
||
|
|
37f3ebd8e8 |
chore(build): drop the native-image config files Quarkus overwrites (#4632)
* chore(build): drop the native-image config files Quarkus overwrites Quarkus writes its own reflect-config.json and resource-config.json to the same paths in the runner jar, so these two never reached the native image. Their 388 docker-java entries disagreed with DockerJavaNativeSupport. A native build without them generates the same configs. * chore(docker): say why the docker-java command classes in the list stay registered They are the request bodies Jackson serializes. The comment said commands need no registration, which invites pruning them. |
||
|
|
4f2f494442 |
fix(codeartifact): log unexpected I/O errors in existingFileMatches (#4769)
Follow-up hectorvent flagged on #4708 (approved, merged): the catch blocks in existingFileMatches returned false silently for both a routine missing file and any other I/O error reading an existing asset, with no log line either way, which AGENTS.md's exception-handling rule doesn't allow for a case that isn't genuinely routine. Splits the two: a missing file stays a silent, named expected (routine, the exact case this method's repair path exists for), while any other I/O error now logs via the same LOG.warnv pattern already used elsewhere in this class for a safe-to-continue failure, since an existing file that can't be read for some other reason is worth a record even though the safe response is still the same repair write. |
||
|
|
ea41b775aa |
feat(ses): paginate the identity, configuration set and custom verification template lists (#4781)
* feat(ses): paginate the identity, configuration set and custom verification template lists Move paging into the SES services, so each resource's cursor lives with its list and the v1 and v2 operations of the same resource share it. Page ListIdentities/ListEmailIdentities, ListConfigurationSets (v1 and v2) and ListCustomVerificationEmailTemplates (v1 and v2) with the probed defaults, bounds and messages: identities default to 25 on v2, configuration sets and custom verification templates to 50, and a v1 page size outside the bound is served the probed size instead of refused. * fix(ses): refuse a list token replayed in another region A list token carried only the resource kind and the cursor, so the same list in another region read it as a position and could answer an empty last page. Real SES refuses such a token with the operation's unreadable-token error (probed on the identity and configuration-set lists), so the token namespace now includes the region. The v1 and v2 lists of one resource still share tokens within a region. |
||
|
|
275d874fed |
fix(ses): authorize SES v2 calls against their IAM actions under enforcement (#4775)
SES v1 is a Query API, so IAM enforcement resolves its action from the request's Action like any other. SES v2 is REST-JSON under /v2/email and IamActionRegistry had no rules for it, so every v2 call resolved to no action, which the enforcement filter lets through: with enforcement on, the whole v2 API was unguarded, CreateConfigurationSetEventDestination included. IamActionRegistry now has one rule per operation in the SES v2 model (botocore sesv2/2019-09-27, 112 operations), each mapped to the IAM action AWS's service reference lists for it (servicereference.us-east-1.amazonaws.com/v1/ses/ses.json). That is always ses:<Operation>, in the ses namespace v1 and v2 share. SendEmail has no entry there; the Service Authorization Reference's SES v2 page defines ses:SendEmail as v2's only send action whatever the content (ses:SendRawEmail is a v1 action), so it takes its name too. No two rules can match the same path, so their order does not matter. The 20 operations Floci does not serve yet are mapped too, so a route added later is guarded from the start. Two ways round a rule are closed for every REST service, not only SES v2. IamActionRegistry.resolve read X-Amz-Target before the path rules, so a REST request carrying one was checked as whatever operation the header named: a POST /v2/email/outbound-emails with X-Amz-Target: SES.GetAccount went through for a caller denied ses:SendEmail. REST-claimed requests now resolve through a new resolveRoute, from method and path alone. And the rules matched the decoded path while the router matches the encoded one, so a%2Fb@example.com reached the suppressed-destination endpoint while its decoded path matched no rule and passed as an unknown action. resolveRoute matches the path still percent-encoded, read from the request URI since RESTEasy Reactive does not serve UriInfo.getPath(false). A denied call answers AccessDeniedException with HTTP 403, as the SES v2 API Reference lists among its common errors. Like v1, v2 is evaluated with resource "*"; resource ARNs for SES, and the extra actions the service reference lists for some operations (ses:TagResource on the create operations, iam:PassRole for event destinations), are left for later and documented in docs/services/ses.md. IamActionRegistryTest checks every operation against a table generated from the model and the service reference, not from the rule table. SesV2IamEnforcementIntegrationTest shows a caller without SES permissions refused, a single allowed action granting only that operation, a target header not changing the checked action, and an encoded slash still authorized. |
||
|
|
be87f99220 |
fix(s3): validate Content-MD5 on PutObject and UploadPart (#4524)
* fix(s3): validate Content-MD5 on PutObject and UploadPart A Content-MD5 header was only checked on the object-annotation path, so a PutObject or UploadPart whose body did not match its digest returned 200 and stored the corrupt payload. The check now lives in validateChecksumHeaders next to the x-amz-checksum-* headers, which every upload path already calls on the decoded (aws-chunked) payload. A well-formed digest that does not match answers 400 BadDigest; a value that is not the base64 of a 16-byte digest answers 400 InvalidDigest, as S3 does. The annotation path previously answered BadDigest for both. * test(s3): pin Content-MD5 to the decoded payload and unstored parts A digest of the aws-chunked framing, rather than of the payload, is now asserted as BadDigest, so the check cannot silently move to the raw body. A part rejected for its digest is asserted absent from ListParts. * style(s3): import the classes the Content-MD5 check uses Replaces the inline java.util.Base64 and java.security names with imports, as AGENTS.md asks, including the two older inline Base64 uses in the POST policy decoding that the new import makes redundant. * fix(s3): use S3's own messages for InvalidDigest and BadDigest on Content-MD5 SDKs and tooling that surface the error text now see what real S3 returns, and the tests assert the message so it cannot drift. * fix(s3): correct Content-MD5 InvalidDigest message |
||
|
|
231655b70a |
fix(ecr): answer GetAuthorizationToken without the backing registry (#4635)
GetAuthorizationToken is an authentication call. The token is a constant and proxyEndpoint is computed from configuration, so neither value involves the registry:2 container, and EcrRegistryManager already documents its URI methods as not requiring Docker. Gating the call on requireRegistry() returned a retryable 500 whenever no Docker daemon was reachable from Floci, which SDK and IaC clients retried with backoff before touching any repository, while CreateRepository and DescribeRepositories answered 200 in the same state. The four image operations keep the gate: they do need the container. Closes #4634 |
||
|
|
a66e2a131d |
fix(cloudformation): keep AWS::ApiGateway::RestApi on stack updates (#4512)
* fix(cloudformation): keep AWS::ApiGateway::RestApi on stack updates UpdateStack runs provision again for every resource, and the RestApi arm called CreateRestApi unconditionally. Each update minted a new API, pointed the stack at it and left the previous one behind, so the API id and invoke URL changed on every deploy. No RestApi property requires replacement, so an update now keeps the API from the previous provision and patches it in place: - Name and Description go through UpdateRestApi, and a template without Name keeps the name the API has. - A changed EndpointConfiguration is applied through the UpdateRestApi paths AWS documents for it, replace /endpointConfiguration/types/<type> and add or remove /endpointConfiguration/vpcEndpointIds, which UpdateRestApi now accepts under the rules CreateRestApi applies. - A Body or BodyS3Location is resolved before anything changes and is still applied with PutRestApi in overwrite mode. - RootResourceId comes from the API's root rather than the first resource listed, which is the root only on a freshly created API. - An API removed out of band is created again, as a replacement that a rollback deletes. The name, description and endpoint configuration are snapshotted before the patch, so a later resource that fails the update puts them back, and so does a Body that PutRestApi rejects. An update that re-applied a Body still reports that rollback is not implemented: PutRestApi replaced the API's resources, methods and models, which the snapshot does not hold. The Resources and Methods on the kept API rely on the update and delete handling from #4511. * fix(apigateway): accept the index form of the endpoint type patch path UpdateRestApi took replace /endpointConfiguration/types/<type> only when the path named the API's current type, as the API Gateway guide writes it. Terraform sends /endpointConfiguration/types/0 instead, which AWS accepts too, and Floci answered it with a 400. An API has exactly one endpoint type, so index 0 is accepted as well. |
||
|
|
c43269e0ad |
fix(ecs): roll a DAEMON service's tasks when its task definition changes (#4766)
* fix(ecs): roll a DAEMON service's tasks when its task definition changes The daemon reconciler kept whichever live task covered each container instance, so after UpdateService changed the task definition or forced a new deployment the old task held its slot and no replacement launched. A task from a superseded deployment is now stopped, using the same staleness rule as REPLICA services, and its instance is re-covered once it is STOPPED. DAEMON services run with maximumPercent 100, so a task still STOPPING keeps its instance and the replacement waits for it. Fixes #4744 * fix(ecs): prefer the current-deployment daemon task when two share an instance If a stale and a current task are both RUNNING on one instance and the stale one is seen first, a failed Docker stop left it holding the slot and the current task was stopped as the duplicate. Break the ordering tie in favour of the current deployment, and drop a running count that a stale task past stopTask can no longer reach. * fix(ecs): count only current-deployment tasks for a DAEMON service A DAEMON service now rolls on a task-definition change, so the DAEMON case in runningOnCurrentDeployment that counted every owned RUNNING task is wrong: right after UpdateService it reported the new deployment COMPLETED, emitted a steady-state event and settled the ServiceDeployment SUCCESSFUL, terminally, while only the old revision's task was running. Scope DAEMON like REPLICA, and replace the test that asserted the old non-rolling behaviour. * test(ecs): write the explicit type for the daemon convergence check AGENTS.md and CONTRIBUTING.md both ask for explicit types over var. |
||
|
|
3df7fb17ee |
fix(ec2): decode CloudFormation launch template user data (#4711)
* fix(ec2): decode CloudFormation launch template user data * fix(ec2): bound and recover launch template user data * fix(ec2): honor explicit user data over legacy templates |
||
|
|
a338a430cc |
feat(cloudformation): provision Cloud Map namespaces and services (#4599)
* feat(cloudformation): provision Cloud Map namespaces and services AWS::ServiceDiscovery::PrivateDnsNamespace, PublicDnsNamespace, HttpNamespace and Service were stubbed, so a stack reported them created while nothing existed in Cloud Map and Fn::GetAtt resolved to literals. CloudMapCfnProvisioner creates them through CloudMapService. Ref returns the id; Fn::GetAtt exposes Id and Arn, HostedZoneId on a DNS namespace and Name on a service. An unnamed service is named <LogicalId>-<12 chars>, as measured on AWS. Description, DnsConfig, HealthCheckConfig and Tags update in place; a createOnly change replaces the resource through ReplacementCleanup, and a rolled-back replacement restores the createOnly record. A Ref to a Number parameter is coerced back to a JSON number for DnsRecords TTL and FailureThreshold. Closes #4596 * fix(cloudformation): roll back in-place Cloud Map updates An in-place namespace or service update followed by a later resource failing left the Cloud Map changes live and the stack in UPDATE_ROLLBACK_FAILED, since rollbackUpdate only undid replacements. The provisioner now keeps the description, DnsConfig, HealthCheckConfig and tags an in-place update overwrites and puts them back on rollback; a committed update drops the snapshot. * fix(cloudmap): reject DNS record type changes on service update UpdateService only changes the TTLs of a service's existing DNS records on AWS. An in-place CloudFormation update that changes the record types, or gives a DnsConfig to a service without one, now fails with InvalidInput instead of being applied, so it rolls back like on AWS and a rollback never has to remove a DnsConfig. * fix(cloudmap): accept only TTL changes in a service DnsConfig update UpdateService carries only DnsRecords on AWS and CloudFormation does not support a RoutingPolicy update. Comparing the record types as a set let a RoutingPolicy change or an added record of the same type through; the requested and stored DnsConfig now have to match apart from the TTLs. * fix(cloudmap): ignore DNS record order in a service DnsConfig update A TTL-only update that listed the same records in another order was rejected. The comparison now uses the sorted record types, so counts, types and RoutingPolicy still have to match. * test(cloudformation): restore a real HealthCheckConfig in the Cloud Map rollback test The in-place rollback test went from a null health check config to null, so dropping it from the snapshot would have passed. |