Repository navigation
Fix Security Hub findings at the source of every install - #557
Merged
Merged
Conversation
The chat stream's function URL takes only calls CloudFront signs (AWS_IAM and origin access control) on a single-origin install; the gateway reads the stream token from x-coderhelm-stream-token, else a bearer token. Every bucket is TLS-only with a lifecycle, and the data, dashboard and sandbox buckets and the distribution write access logs to a new log bucket. Every table has point-in-time recovery and deletion protection, the user pool has deletion protection and a password policy that needs a symbol, the MCP proxy runs on Node.js 22, SES sends only over TLS, and viewers on a domain need TLSv1.2_2025. docs/self-host/security.md lists each control and the ones accepted, with why.
CoderHelm/coderhelm a95516a sends the stream token in its own header and the body's SHA-256, which the AWS_IAM function URL behind origin access control needs.
Legacy standard logging delivers to no bucket in an opt-in region, and turning it on there would fail the update. A native release's one template decides by its region (a condition); any other install at synth.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AWS Security Hub flagged a self-hosted install. The most serious finding was Lambda.1 (critical): the streaming function's URL was open to the internet. This PR fixes each finding in the templates every install deploys, and documents the findings left as they are, with the reason (
docs/self-host/security.md, "Security Hub"). Every change applies as an in-place update, and no table, bucket, key or user pool is replaced.Changes
The chat stream (Lambda.1, CloudFront.16)
AWS_IAM. The publicFunctionUrlAuthType NONEpermissions are gone.FunctionUrlOrigin.withOriginAccessControl: always sign, SigV4). The function's policy allowscloudfront.amazonaws.comfor that one distribution, with bothlambda:InvokeFunctionUrlandlambda:InvokeFunction(InvokedViaFunctionUrl). The stream behaviours still forward every viewer header, cookie and query string, with no caching, and responses still stream.x-coderhelm-stream-token, and falls back toAuthorization: Bearer(auth::jwt::stream_token). CloudFront's signature now takes theAuthorizationheader. The function still checks the token on every request.x-amz-content-sha256, which Lambda requires of a signed POST (Send chat streams through the install's signed CloudFront path coderhelm#353, merged).selfhost/versions.jsonpins it (a95516a).Buckets (S3.5, S3.9, S3.13)
<prefix>-logs<suffix>, in the storage stack:s3/<name>/. Its policy lets S3 log delivery write for this account's<prefix>-*buckets.CloudFront (CloudFront.5, CloudFront.15)
cloudfront/, in the regions AWS enables by default (CLOUDFRONT_LOG_REGIONS). CloudFront delivers legacy logs to no bucket in an opt-in region, and turning them on there would fail the update. A native release's single template decides with a region condition (CloudFrontLogsRegion). Other installs decide at synth.TLSv1.2_2025.Tables and sign-in (DynamoDB.2, DynamoDB.6, Cognito.3, Cognito.6)
retainData, so it follows KeepDataOnDelete on a native install). Its password policy now needs a symbol, and temporary passwords last 7 days.password_fitschecks the same rules. The sign-up error text already asked for a symbol.Runtimes and email (Lambda.2, SES.3)
Uninstaller and docs
<prefix>-logs-<account>bucket.docs/self-host/security.md, "Security Hub", lists each control and how it is met, and gives a reason for each accepted one.uninstall.mdadds the log bucket.Verification
infra:npm test, 166 passed. The newtest/security-hub.test.tscovers the self-host, native and hosted templates. It checks:AWS_IAMand grants nothing public;cdk synthofconfig/selfhost.example.jsonwith the real CLI: 11 templates, none mentioning the hosted domain. cfn-lint 1.58.0 passes on a native release'scoderhelm.json,access.jsonand every part, and oninfra/cfn.Replicas(point-in-time recovery, deletion protection);DeletionProtectionandPolicies;LoggingConfigurationandLifecycleConfiguration;AuthType.No stateful resource is removed or replaced, and no create-only property changes. The two resources removed are the streaming URL's public
AWS::Lambda::Permissions.s3:*on<prefix>-*buckets, including the ACL CloudFront's logging sets;lambda:*on the install's functions;cargo fmt --all,cargo clippy -p common -p gateway -p worker --all-targets -- -D warnings, andcargo test -q -p common -p gateway -p worker(3,938 passed). New gateway tests coverstream_tokenand the symbol rule.npm test, 171 passed. The MCP proxy builds with--target=node22.