fix(aws): harden CloudFormation BYOC releases#179
Conversation
Greptile SummaryThis PR applies several targeted hardening fixes to AWS CloudFormation BYOC releases across four distinct problem areas. It is well-scoped with focused tests and real-environment validation proofs for each fix.
Confidence Score: 5/5This PR is safe to merge. Each fix is narrowly scoped, has dedicated tests, and was validated against real AWS environments. All four problem areas (SES permission scope, OpenSearch NextGen CloudFormation, OTLP bootstrap deferral, storage presign encoding) are addressed with targeted changes. The permission expansion in manage-identities correctly adds only the required configuration-set ARN without broadening identity scopes. The OTLP deferral logic is sound: it avoids capturing a stale unauthenticated provider in the tracing bridge while still delivering authenticated exports after vault resolution via the dynamically-read OTLP_PROVIDER. The build cache key change hashes addon file bytes (not just paths), which is the right unit of cache invalidation. No logic paths are left unguarded. No files require special attention.
|
| Filename | Overview |
|---|---|
| crates/alien-permissions/permission-sets/email/manage-identities.jsonc | Adds configuration-set ARNs to both stack and resource IAM bindings so ses:PutEmailIdentityConfigurationSetAttributes is authorized against the configuration-set ARN as AWS requires. |
| crates/alien-cloudformation/src/emitters/aws/open_search.rs | Emits AWS::OpenSearchServerless::CollectionGroup with Generation: NEXTGEN, optional CapacityLimits, collection group dependency, and corrected binding/import refs (no DashboardEndpoint for next-gen collections). |
| crates/alien-cloudformation/src/emitters/aws/storage.rs | Adds CorsConfiguration emission when corsAllowedOrigins is non-empty; methods hardcoded to GET/HEAD, exposed headers limited to ETag — matches the described presigned-read-URL use case. |
| crates/alien-worker-runtime/src/otlp.rs | Defers OTLP tracing bridge creation when ALIEN_RUNTIME_SECRETS is present, preventing an unauthenticated provider from being captured at subscriber construction time before vault credentials are resolved. |
| crates/alien-bindings-node/src/storage.rs | Adds parse_path helper that validates and parses raw storage keys through object_store::path::Path before presigning, ensuring reserved characters are percent-encoded exactly once. |
| crates/alien-build/src/lib.rs | Extends TypeScript artifact cache key to include bytes (not just path) of transitive native addons reached via sdk/node_modules, so addon updates correctly invalidate the cache. |
| crates/alien-worker-runtime/src/runtime.rs | Calls init_otlp_logging_from_config after vault secret resolution so the authenticated OTLP provider is stored before any function output is emitted; ALIEN_COMMANDS_TOKEN and ALIEN_RUNTIME_SECRETS are stripped from the child process environment. |
| crates/alien-core/src/resources/aws_open_search.rs | Adds AwsOpenSearchCapacity/CapacityRange structs with validate_capacity() enforcing AWS OCU increment rules; collectionType immutability guard moved to apply_update. |
| crates/alien-cli/src/commands/deploy.rs | DG-token deployment path now passes resolved input_values through to_sdk_stack_input_values so deployer inputs are preserved; adds string-list JSON array parsing for --input. |
Sequence Diagram
sequenceDiagram
participant CLI as alien CLI
participant Runtime as Worker Runtime
participant Vault as Secret Vault
participant OTLP as OTLP Endpoint
participant Lambda as Lambda Runtime API
participant App as App Process
CLI->>Lambda: Deploy (CloudFormation stack with CollectionGroup/CORS/SES permissions)
Lambda->>Runtime: Cold start
Note over Runtime: init_otlp_logging()<br/>ALIEN_RUNTIME_SECRETS present?
alt vault-backed secrets present
Runtime-->>Runtime: Defer OTLP bridge (return None)
else no vault secrets
Runtime->>OTLP: Initialize tracing bridge (unauthenticated endpoint only)
end
Runtime->>Lambda: Register extension (pre-start)
Runtime->>Vault: load_vault("secrets") → OTEL_EXPORTER_OTLP_HEADERS
Vault-->>Runtime: auth header value
Runtime->>OTLP: init_otlp_logging_from_config (authenticated)
Runtime->>App: Start subprocess (ALIEN_RUNTIME_SECRETS stripped)
App-->>Runtime: stdout/stderr lines
Runtime->>OTLP: emit_log (reads OTLP_PROVIDER dynamically)
App->>Runtime: ses:PutEmailIdentityConfigurationSetAttributes
Note over Runtime: IAM Resource now includes<br/>configuration-set ARN ✅
Reviews (3): Last reviewed commit: "fix(aws): allow runtime identities to us..." | Re-trigger Greptile
| export const StorageSchema = z.object({ | ||
| "id": z.string().describe("Name of the the storage bucket.\nFor names with dots, each dot-separated label must be ≤ 63 characters."), | ||
| "corsAllowedOrigins": z.optional(z.array(z.string()).describe("Browser origins allowed to read objects through signed URLs.\n\nWhen non-empty, providers configure CORS for `GET` and `HEAD` requests.\nAn origin of `*` is appropriate for private buckets whose signed URLs\nare bearer credentials and do not use browser cookies.\nDefault: `[]` (CORS disabled).")), | ||
| "id": z.string().describe("Name of the the storage bucket.\nFor names with dots, each dot-separated label must be ≤ 63 characters."), |
There was a problem hiding this comment.
Generated file drops indentation for
id field
The newly added corsAllowedOrigins property is indented (4 spaces) but "id" and the remaining pre-existing properties ("publicRead", "versioning") have zero indentation. This is a generator artifact: the tool appears to emit consistent indentation only for the first alphabetical property. TypeScript and Zod parse the file correctly, so this has no runtime impact, but it points to an inconsistency in the code generator that may resurface as the schema grows.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/core/src/generated/zod/storage-schema.ts
Line: 14
Comment:
**Generated file drops indentation for `id` field**
The newly added `corsAllowedOrigins` property is indented (4 spaces) but `"id"` and the remaining pre-existing properties (`"publicRead"`, `"versioning"`) have zero indentation. This is a generator artifact: the tool appears to emit consistent indentation only for the first alphabetical property. TypeScript and Zod parse the file correctly, so this has no runtime impact, but it points to an inconsistency in the code generator that may resurface as the schema grows.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
f9e9801 to
d0e58d7
Compare
Refs ALIEN-320
d0e58d7 to
b1d404a
Compare
Refs ALIEN-320
|
Final AWS validation update:
|
Summary
Validation
Generation: NEXTGEN, zero minimum indexing/search OCU,on.awsendpointpnpm dev: TLS/health, send, asynchronous indexing, full-text search hit, and content retrievalLinear: ALIEN-320