Repository navigation
feat: one object-store settings parser for the Action, gateway and backfill - #1883
Conversation
…S_REGION fallback
fro-bot
left a comment
There was a problem hiding this comment.
Verdict: PASS
Blocking issues
None
Non-blocking concerns
- P2 — Unused region fallback can prevent startup.
object-store-config.ts:50eagerly readsAWS_REGIONand its_FILEeven when validS3_REGIONwins. An embedded newline in the unused env value, or an unreadable/symlinked fallback file, therefore aborts gateway startup and backfill. Previously the daemon ignored these sources. ResolveS3_REGIONfirst and read the fallback only when needed. Confirmed with the focused probe below.
Missing tests
- Add precedence coverage with valid
S3_REGIONand malformedAWS_REGIONor rejectedAWS_REGION_FILE; assert the canonical region succeeds. Existing tests cover precedence only with valid fallback values. Retain rejection coverage when the fallback is actually needed.
Risk assessment (MED): likelihood of regression, security exposure, or blast radius
Stricter validation intentionally affects gateway startup and backfill destinations. The identified regression requires an invalid unused fallback. No blocking security or public-API defect found. Reviewed source and tests; no suites, builds, lint, or type checks run.
Run Summary
| Field | Value |
|---|---|
| Event | pull_request |
| Repository | fro-bot/agent |
| Run ID | 39370774313 |
| Cache | hit |
| Session | ses_ea861834dffeH2B1rL2nbCwI2R |
Focused probe tested whether an invalid, unused fallback overrides a valid canonical region. It exited 1 with the embedded-line-break error for AWS_REGION, confirming the regression:
bun -e 'process.env.S3_BUCKET="review-bucket"; process.env.S3_REGION="us-east-1"; process.env.AWS_REGION="unused\nregion"; const {loadObjectStoreSettings}=await import("./packages/gateway/src/object-store-config.ts"); try {console.info(loadObjectStoreSettings().region)} catch(error) {console.error(error instanceof Error ? error.message : String(error)); process.exitCode=1}'Review synthesis tooling was inaccessible under this run's filesystem permissions; findings were independently checked against source and the focused probe. Inline posting was unavailable through the response-file delivery contract.
fro-bot
left a comment
There was a problem hiding this comment.
Verdict: PASS
Re-reviewed ad933de. The unused-region-fallback issue is resolved. Added gateway and backfill tests cover ignored malformed fallbacks and rejection when the fallback is needed.
Blocking issues
None
Non-blocking concerns
None
Missing tests
None
Risk assessment (MED): likelihood of regression, security exposure, or blast radius
The overall PR intentionally tightens startup validation and changes backfill configuration handling. The follow-up fix is narrowly scoped, preserves fallback validation, and introduces no identified security or public-API regression.
Run Summary
| Field | Value |
|---|---|
| Event | pull_request |
| Repository | fro-bot/agent |
| Run ID | 39372744761 |
| Cache | hit |
| Session | ses_ea861834dffeH2B1rL2nbCwI2R |
Inspected the three-file delta from 1143d10 to ad933de, related secret readers, parser behavior, and test isolation. Prior concern and missing coverage are addressed. No tests, builds, lint, or type checks were run.
Problem
The Action, the gateway server and the gateway deny-key backfill each read object-store (S3) settings their own way:
S3_SSEwithout checking it.AWS_REGION,S3_BUCKETandS3_PREFIX, so on R2 or MinIO it silently targeted plain AWS.A KMS key that the effective encryption mode would ignore was dropped silently everywhere.
Change
There is now one runtime parser,
parseObjectStoreSettings, inpackages/runtime/src/object-store/settings.ts. It trims every value and treats an empty value as unset. It applies the endpoint rules from #1877, plus prefix, SSE mode, KMS and expected-owner validation. Errors name the setting and the rule, never the value.inputs.tsmaps thes3-*andaws-regioninputs onto the parser. Region stays optional.loadObjectStoreSettingsinobject-store-config.ts, serves both the server and the backfill.S3_REGIONis required and falls back toAWS_REGION._FILEform.S3_ALLOW_INSECURE_ENDPOINT,S3_EXPECTED_BUCKET_OWNERandS3_SSE_KMS_KEY_ID.secrets.ts. Only object-store settings treat a blank_FILEas unset and use the same-named env var, because compose always setsS3_REGION_FILEandS3_ENDPOINT_FILE. Every other secret keeps the existing rule, where a blank file is an opt-out.gateway config invalidand the rule it broke. Every other startup failure still logs onlygateway startup failed.getEffectiveEncryptionmoves to a pureobject-store/encryption.tsand is no longer exported from@fro-bot/runtime.Behaviour changes
s3-sse-kms-key-idis an error unless the effective mode isaws:kms. On a custom endpoint the default is AES256, so sets3-sse-encryption: aws:kms.s3-bucketands3-sse-encryptionerror text changed. Both now start with the input name.S3_EXPECTED_BUCKET_OWNER/s3-expected-bucket-ownermust be a 12-digit account ID.S3_ENDPOINT(http or a private address without the flag, or a metadata address), an invalidS3_PREFIX, an unknownS3_SSE, or a KMS key without effectiveaws:kms.S3_PREFIXuses the defaultfro-bot-state._FILEdefers to the env var. Other secrets are unchanged.S3_REGION(beforeAWS_REGION),S3_ENDPOINT,S3_SSE,S3_PREFIXand the other S3 settings. With an endpoint and noS3_SSE, it now derives AES256.S3_PREFIXnow usesfro-bot-state. Deny keys written at the bucket root by an earlier empty-prefix run are not read.deploy/README.mdhas a settings table and a rollout checklist:S3_REGION=autofor R2/MinIO;--apply;AWS_*env vars.Known, unchanged
A blank AWS key file on the daemon means no static credentials. The AWS SDK default chain then applies, and that chain still reads
AWS_*from the environment. This is how instance and role credentials work, and the behaviour was the same before this change.Verification
bun run check-types,bun run lintandbun run buildpass.dist/is rebuilt.