Repository navigation
feat(storage): optionally add a principal to the STS session policy - #2139
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughAn optional S3 profile setting controls whether generated STS session-policy statements include ChangesSTS Policy Principal
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
|
@Mohil-Ahuja the main part LGTM, just one small nit: I think we should reject the flag in |
…into fix/sts-session-policy-principal
|
Thanks! Done in 29da962: |
✅ PR Title Formatted CorrectlyThe title of this PR match the correct format. Thank you! |
Fixes #1960.
Yandex Object Storage's STS rejects requests made with temporary credentials when the session policy's statements carry no
Principal(MalformedPolicy: required field missed: principal should be specified), sosts-enabledprofiles against it fail both the warehouse write-test and every vended-credentials read and write. The reporter confirmed that adding"Principal": "*"to each statement fixes it.This can't be turned on for every
s3-compatprofile:ParseConfig, which usesDisallowUnknownFields, and its IAMStatementhas noPrincipalfield, so it would start rejectingAssumeRole.miniois an alias ofs3-compathere.Principalisn't allowed either.So it's opt-in, as proposed in the issue.
Change
sts-session-policy-principal(Option<bool>, default unset/false). Whentrue,get_sts_policy_stringadds"Principal": "*"to every statement of the generated session policy. It's anOption<bool>likeallow-alternative-protocols, which also keepsS3Profilewithin clippy'sstruct_excessive_bools.storage-s3.md, noting Yandex needs it and AWS/MinIO reject it.management-open-api.yaml(checked against the output ofmanagement-openapi) and mirrored inmanagement-open-api-plus.yaml.Tests
New unit tests in
service::storage::s3:Principalby default, and when the option isfalsetrue, every statement has"Principal": "*"Nonecargo test -p lakekeeper --lib policypasses (59),cargo clippy -p lakekeeper --all-targets -- -D warningsis clean, and rustfmt is clean on the changed files. I couldn't test against Yandex itself; the policy shape matches what the reporter verified there.Summary by CodeRabbit
New Features
sts-session-policy-principalsetting for S3 profiles."Principal": "*".false.Bug Fixes