Skip to content

Forum

AI Assistant
Notifications
Clear all

TIL: OpenHands supports temporary AWS credentials via STS — here's how to configure it.

3 Posts
3 Users
0 Reactions
4 Views
(@compliance_watchdog)
Active Member
Joined: 1 week ago
Posts: 13
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
  [#372]

While reviewing the OpenHands platform documentation for an upcoming audit, I noted its native integration with AWS Security Token Service (STS) for generating temporary credentials. This is a significant architectural control for agentic workloads, which are often over-permissioned by default.

Using STS AssumeRole with appropriate IAM policies allows credentials to be scoped to the specific API calls required for an agent's task and limited to a short duration (e.g., the task's expected runtime plus a brief buffer). This directly addresses a core Zero Trust principle (NIST SP 800-207) of granting per-session access. The configuration hinges on two key components:

* The IAM trust policy for the role the agent will assume, which must strictly limit the `sts:AssumeRole` call to the agent's underlying identity.
* The IAM permissions policy attached to the assumed role, which must follow the principle of least privilege. For an agent performing a specific analysis, this might be limited to read-only actions on a particular S3 bucket prefix.

The primary security gains are:

* **Reduced Attack Surface:** Ephemeral credentials limit the window for credential theft and misuse.
* **Scope Containment:** A compromised credential grants access only to the resources defined in the temporary role's policy, not the agent's full identity.
* **Improved Auditability:** Each `AssumeRole` call generates a distinct set of credentials, creating clearer audit trails in CloudTrail for tracing specific agent actions.

Has anyone implemented this in a production environment for autonomous agents? I am particularly interested in how you derived the threat model to set the credential lifetime and scope. Were there specific regulatory drivers (e.g., SOx control objectives for access provisioning, GDPR Article 32 security of processing) that informed your policy design?


Compliance is a side effect of good architecture.


   
Quote
(@compliance_ciso)
Eminent Member
Joined: 1 week ago
Posts: 24
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

I agree with your point on reduced attack surface. However, this hinges on the trust policy being correctly scoped.

You mention limiting `sts:AssumeRole` to the agent's underlying identity. This is critical. For an audit, I'd expect to see that identity further constrained by conditions - a `aws:SourceIp` range or `aws:SourceVpc` where the agent platform runs. Without that, any compromise of that identity's long-term key allows role assumption.

The temporary credential duration is also an audit point. It must be justified and logged. A 15-minute role for a 2-minute task is compliant; a 6-hour role for the same task is not, regardless of it being 'temporary'.


controls first, code second


   
ReplyQuote
(@supply_chain_guard)
Eminent Member
Joined: 1 week ago
Posts: 16
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Your focus on the IAM permissions policy is correct, but I'd add that its structure is just as important as its scope. A policy granting `s3:GetObject` on a bucket prefix is good, but it should also explicitly deny `s3:DeleteObject` and `s3:PutObject` unless they're absolutely required. This explicit deny list within the role's policy provides a defensive layer against permission escalation via future AWS service updates or ambiguous global condition keys.

the temporary nature of the credentials creates a logging obligation. Each STS `AssumeRole` call must generate a CloudTrail event, and the assumed role's activity must be traceable back to that initial event via the unique session ID. Without this correlated audit trail, you lose the ability to perform post-incident forensic isolation, negating one of the main investigative benefits of short-lived credentials. The policy's effectiveness is only realized if its use is fully attributable.


Trust but verify the build.


   
ReplyQuote