Skip to content

LocalEmu 1.4.0

Latest

Choose a tag to compare

@TarekCheikh TarekCheikh released this 06 Nov 18:26

LocalEmu 1.4.0

The dashboard at /_localemu/dashboard is rewritten as the LocalEmu Console: a new layout, light and dark themes, and new panels backed by request telemetry the gateway now records for every AWS call. Alongside the Console, IAM enforcement closes three gaps where a stored policy or grant had no actual effect on authorization, sts:AssumeRoleWithWebIdentity verifies a token's signature for the first time instead of trusting it by string match, and five more services are covered: CodeBuild, Cognito Identity, RAM, SageMaker and WAFv2.

Install

pip install --upgrade localemu
localemu start

Or with Docker:

docker run --rm -it -p 4566:4566 -p 4510-4559:4510-4559 localemu/localemu:1.4.0

LocalEmu Console

The page is a top bar, a service navigation column, the workspace, and a live API-call panel on the right. Light and dark themes follow the OS preference until you pick one with the theme button; the choice is kept in localStorage. Fonts ship with the dashboard, so it works offline. The existing per-resource drills and action modals keep their behavior.

Every AWS call is now recorded in memory with status, error code, handling time, the calling principal, the resource it named, and whether it was an IAM denial. New endpoints: /_localemu/api/system, /_localemu/api/metrics/requests, /_localemu/api/calls, /_localemu/api/changes, /_localemu/api/metrics/services. Records are kept in memory only; nothing is persisted.

The overview shows endpoint, version, uptime, IAM enforcement mode, persistence and Docker/Bedrock backend status, a requests-per-second chart, and a filterable grid of all 133 registered services. The top bar selects the account the console works in; /_localemu/api/accounts/<id>/summary no longer undercounts S3, SQS, Lambda and KMS resources.

Also: a command palette (Cmd+K) over every service, resource and action; new write actions (create an S3 bucket, SQS queue, SNS topic or DynamoDB table, purge a queue); the live panel shows status, error code, resource, principal, account and handling time with filters and pause/resume; the CloudTrail page filters by account and service.

IAM enforcement: stored policies that had no effect

Three controls were accepted and stored but never consulted during authorization, so they did nothing:

  • Organizations SCPs. A Service Control Policy attached to the root, an OU or an account was stored but never read during evaluation. A Deny SCP had zero effect, so any identity with a permissive IAM policy could still perform the action the SCP was meant to block.
  • KMS grants. kms:CreateGrant stored the grant, but the enforcer only ever read moto's native KMS backend, which LocalEmu's own KMS provider never populates. A grant authorized nothing.
  • Cognito AllowAdminCreateUserOnly. A user pool configured to require admin-created accounts still let anyone self-register with a plain SignUp call.

All three now actually authorize or deny. New condition-key support: aws:PrincipalTag/<key> resolves from the caller's IAM user/role tags, aws:ResourceTag/<key> resolves from each target service's own tag store, and a VPC Interface endpoint's own policy is evaluated with aws:SourceVpce / aws:SourceVpc read from the port a connection arrived on.

A new in-memory, queryable decision log replaces reading the server log for "why was this denied": GET /_localemu/iam/decisions (filterable by principal_arn, action, resource, decision) and POST /_localemu/iam/decisions/clear. Each entry carries the decision, the reason, which policy type decided it, and the matched statement. It is a bounded 2000-entry ring buffer, not a persisted audit trail.

STS: real signature verification for AssumeRoleWithWebIdentity

LocalEmu previously accepted any sts:AssumeRoleWithWebIdentity token structurally, including one with no signature or a garbage one, as long as the trust policy's Principal: {Federated: ...} matched by string. The token's signature is now verified against the registered OIDC provider's real JWKS, fetched over HTTPS from the provider's well-known URL exactly like AWS does.

For local lab and test use where reaching the real external provider is not possible, POST /_localemu/api/oidc/mint-token mints a token signed with a LocalEmu-generated per-provider keypair, so a trust policy referencing a real provider (for example token.actions.githubusercontent.com) can be exercised locally with a token that passes real verification, without a real workflow run at that provider.

New services

  • CodeBuild: moto has no UpdateProject at all, not a stub, absent entirely. UpdateProject now merges the same optional fields CreateProject accepts onto the existing project.
  • Cognito Identity: moto creates identity pools and identities but has no role attachment and returns fixed fake credentials. SetIdentityPoolRoles, GetIdentityPoolRoles and GetCredentialsForIdentity are implemented for real: the role is chosen the way AWS chooses it, the role's trust policy must actually trust cognito-identity.amazonaws.com, and a login issued by a LocalEmu Cognito user pool is verified cryptographically.
  • RAM: resource shares were recorded but nothing else consulted them. Scoped to EC2 subnets for now: a subnet shared via RAM is now visible to the account it was shared with.
  • SageMaker: a notebook instance's OnStart lifecycle script now runs.
  • WAFv2: real-time Web ACL rule evaluation (rules in ascending Priority order, Block/Allow terminate evaluation, Count does not) against an ALB, with its own decision log mirroring the IAM one.

Cognito, CloudTrail, Lambda, EKS

  • Custom and profile user attributes now appear as claims in the ID token Cognito issues.
  • CloudTrail's userIdentity on a recorded event now reflects the real caller shape (root, IAM user, assumed role with its issuing role's own ARN, or anonymous) instead of a generic fallback. CloudTrail-to-EventBridge forwarding delay is now modeled per service instead of one flat delay.
  • A Lambda version that reached State.Failed during startup was never added to the running-versions tracking, so stop_version raised and DeleteFunction/UpdateFunctionConfiguration aborted, leaving the function permanently undeletable. A version whose prepare_version hung had no timeout and stayed Pending forever. Both are fixed: stop_version on an untracked ARN is a no-op, and prepare_version has a ceiling (LAMBDA_VERSION_START_TIMEOUT_SECONDS, 0 disables it), moving to State.Failed with a clear reason instead of hanging.
  • EKS endpointPrivateAccess is now threaded into a real network-isolation decision (the cluster's API server joins the VPC's Docker bridge and the public port is firewalled) instead of being accepted and ignored.

Other fixes

  • Re-setting a managed policy's default version to the version already default is now a no-op, matching AWS.
  • A trust policy naming an IAM user or role, in enforcement mode, is now validated against the users and roles that actually exist.
  • localemu status: service state colors were backwards, running showed yellow and the dormant available state showed green. running is now green, available is a dim grey circle.
  • events:PutEvents IAM enforcement always resolved the request's resource to the default event bus, because EventBusName is nested inside each Entries item rather than a top-level request parameter. A policy scoped to a custom bus could never authorize a PutEvents call that was correctly routed to that bus. Fixed; every other events:* action is unaffected.

Verification

This release was validated end to end: all 33 runnable examples and use-case guides in the examples repository were deployed, tested and torn down against a live LocalEmu instance with no leftover resources, the IAM enforcement unit suite and the full unit test suite pass, and the generated API and Terraform export coverage data (133 services) was regenerated from this source and matches what ships.