fix: move AWS Bedrock IAM credentials to secret installation parameters [AIS-296] - #11203
Open
Tyler Pina (tylerpina) wants to merge 15 commits into
Open
fix: move AWS Bedrock IAM credentials to secret installation parameters [AIS-296]#11203Tyler Pina (tylerpina) wants to merge 15 commits into
Tyler Pina (tylerpina) wants to merge 15 commits into
Conversation
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio. |
…rs [AIS-296] - Adds a Contentful Function (`functions/bedrock-proxy.ts`) that reads accessKeyId, secretAccessKey, and region server-side via `context.appInstallationParameters` and proxies InvokeModel requests to AWS Bedrock using SigV4 signing — credentials never touch browser-side code - Wires up `contentful-app-manifest.json` with an App Action (`bedrockProxyAction`) so the Dialog calls the function via `sdk.cma.appActionCall.createWithResponse` instead of instantiating BedrockRuntimeClient in the browser - Removes direct credential usage in `useAI.tsx`, `AccessKey.tsx`, and `Model.tsx`; config screen becomes write-only for credentials (admin can set new credentials but cannot read the current values back) - Model list becomes static — availability checks (which required live AWS calls with the plaintext key) are removed; all featured models display unconditionally - Upgrades `@contentful/app-scripts` to ^2.3.0 and adds `@contentful/node-apps-toolkit` for function types Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tyler Pina (tylerpina)
force-pushed
the
fix/bedrock-secret-param-ais-296
branch
from
July 31, 2026 15:00
33563f2 to
5ed3ec8
Compare
…ts [AIS-296] Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Retypes all five SDK mock files (and three caller specs that directly annotate the SDK generic) from AppInstallationParameters to PersistedInstallationParameters, removing the nested brandProfile field and making credentials (accessKeyId/secretAccessKey) optional top-level scalars per the flat persisted shape. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…-296] AWS Bedrock's SigV4 signing name is `bedrock`, not `bedrock-runtime`. The old credential scope `/bedrock-runtime/aws4_request` caused every invocation to fail with InvalidSignatureException. Fixes the credential scope string and the getSigningKey call site. Adds a focused unit test (bedrock-proxy.spec.ts) that would have failed on the old name. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Installation parameters are now flat (PersistedInstallationParameters) so the old destructuring of `brandProfile` yielded undefined at runtime, silently dropping all brand-voice fields from the system prompt. Retypes the SDK hook to PersistedInstallationParameters and passes the flat installation object directly to baseSystemPrompt, which accepts ProfileType (satisfied by PersistedInstallationParameters via intersection). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…296] Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
AIS-296
Summary
functions/bedrock-proxy.ts) that readsaccessKeyId,secretAccessKey, andregionserver-side viacontext.appInstallationParametersand proxies InvokeModel requests to AWS Bedrock using AWS SigV4 signing — credentials never touch browser-side codecontentful-app-manifest.jsonwith an App Action (bedrockProxyAction) so the Dialog location calls the function viasdk.cma.appActionCall.createWithResponseinstead of instantiatingBedrockClient/BedrockRuntimeClientin the browsersrc/utils/aiApiclient (the actual SAST finding) and removesaccessKeyId/secretAccessKeyfrom browser-readable state; the configAccessKeycomponent becomes write-only (admin can set new credentials but can't read stored values back);Modelbecomes a static list rather than live-validating against AWS with the credentialsSecret-typed param validates (aSecretopts the whole params object into strict scalar-only validation — nestedbrandProfileis flattened,enabledFeaturesis JSON-encoded into a Symbol string and rehydrated in the reducer/hooks)Notes
Secrettype declaration foraccessKeyIdandsecretAccessKeymust be applied separately before deploy — without it, the credentials are still plaintext in the browser even after this code lands.bedrock, notbedrock-runtime— the latter is only the endpoint host prefix. Signing with the wrong name yieldsInvalidSignatureExceptionon every call. Covered by a regression test infunctions/bedrock-proxy.spec.ts.ListFoundationModels+InvokeModelCommandusing the browser-side credentials) is removed. The model list is now static.Test plan
npx vitest runpasses (56/56)npm run lintpasses (0 errors, 0 warnings)npx tsc --noEmitcleannpm run build:functionsemitsbuild/functions/bedrock-proxy.jsaccessKeyIdandsecretAccessKeyas"type": "Secret"(and remaining installation fields asSymbol) via CMA or Contentful UI for the Bedrock app definitionsdk.parameters.installation.accessKeyIdreturns***in browser consolenpm run deploy:test) and confirm App Action invocation succeeds end-to-end in a test spaceGenerated with Claude Code