Andrea Cosentino created CAMEL-28031:
----------------------------------------

             Summary: camel-aws2-sts: getSessionToken and getFederationToken 
ignore their inputs, and the component cannot use session credentials
                 Key: CAMEL-28031
                 URL: https://issues.apache.org/jira/browse/CAMEL-28031
             Project: Camel
          Issue Type: Bug
          Components: camel-aws2
            Reporter: Andrea Cosentino


Found during an audit of the cloud components (camel-aws, camel-azure, 
camel-google, camel-huawei) at commit 7c0644752e17. Every item below was 
verified against the source.

h4. 1. getSessionToken builds an empty request
{{STS2Producer.getSessionToken}} non-pojo branch calls 
{{GetSessionTokenRequest.builder().build()}} with nothing set: 
{{durationSeconds}}, {{serialNumber}} and {{tokenCode}} are never read, and no 
header constant exists for them. The operation therefore always returns a 
default-duration token and cannot be used at all against an MFA-enforcing 
policy, unless the user switches to pojoRequest=true. 
{{CamelAwsStsAssumeRoleDurationSeconds}} is read only in the assumeRole branch.
Proposed change: read duration, serial number and token code from headers, and 
add the constants.

h4. 2. getFederationToken ignores durationSeconds
Only {{name}} is set on the builder. The federated session always gets the STS 
default duration with no way to change it. The policy/policyArns gap is at 
least mentioned on FEDERATED_NAME; the duration gap is documented nowhere.

h4. 3. No sessionToken and no useSessionCredentials, so role chaining is 
impossible
{{STS2Configuration}} is the only one of the 38 AWS schemes that declares 
neither option; it stubs out the session half of {{AwsCommonConfiguration}} 
with {{getSessionToken()}} returning null and {{isUseSessionCredentials()}} 
returning false, commented "STS doesn't use session tokens - it provides them". 
But calling AssumeRole *with* temporary credentials (role chaining) is a normal 
STS use, and the component's own ASSUME_ROLE_DURATION_SECONDS description 
mentions it ("at most 3600 for role chaining").
Proposed change: expose sessionToken and useSessionCredentials like every 
sibling.

h4. 4. No getCallerIdentity
{{STS2Operations}} is assumeRole, getSessionToken, getFederationToken. 
{{getCallerIdentity}} is the most used STS call, needs no permissions, and 
would be the natural health-check probe. Also absent: 
assumeRoleWithWebIdentity, assumeRoleWithSAML, decodeAuthorizationMessage.

h4. 5. Smaller issues
{{STS2Component}} extends {{DefaultComponent}}, so there are no healthCheck* 
options and no producer health check.
{{@Metadata(required = true, defaultValue = "assumeRole")}} on a field already 
initialised to assumeRole is contradictory: an option with a default is not 
required.

_Claude Code on behalf of oscerd_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to