The Simplest Way to Make AWS Secrets Manager and Gitea Work Like They Should
Integrating aws secrets manager and gitea lets build jobs fetch keys at run time. This workflow keeps raw passwords out of your code repos and runner files. Teams use Gitea to host source code and run build jobs. Those jobs need database passwords and API keys to test and ship apps. Storing those keys inside Gitea repo settings creates duplicate work for your team. Storing them in AWS Secrets Manager gives you one place to update keys. How aws secrets manager and gitea share keys and roles G
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Integrating aws secrets manager and gitea lets build jobs fetch keys at run time. This workflow keeps raw passwords out of your code repos and runner files.
Teams use Gitea to host source code and run build jobs. Those jobs need database passwords and API keys to test and ship apps. Storing those keys inside Gitea repo settings creates duplicate work for your team. Storing them in AWS Secrets Manager gives you one place to update keys.
How aws secrets manager and gitea share keys and roles
Gitea runners execute your build and deploy steps on cloud hosts or containers. During a job, the runner needs to read secrets from your AWS account. The safest way to log in uses short-lived tokens instead of static keys.
Your Gitea server can issue an identity token to each running build job. AWS checks this token against a trust rule that you set up. When the check passes, AWS gives the runner a temporary role. That role lets the job read only the specific secret it needs.
Data flows in one direction during the build run. The runner asks AWS Secrets Manager for a key value over an encrypted channel. AWS checks the role rules, logs the read event, and returns the secret. The runner holds the value in memory only while the job runs. When the job ends, the runner wipes its memory and drops the role.
Common failure modes and how to scope roles
Many teams start by making one shared AWS user for all Gitea runners. They put long-lived AWS keys into the global Gitea runner settings. This approach fails because every repo can now read every secret in AWS. If one test repo leaks its variables, the attacker gets all your keys.
Broad read rules create another major risk for your cloud setup. A team might grant a runner role permission to read all secrets. Then a staging build job can pull production database passwords by mistake. You can fix this by naming secrets clearly by app and stage. Then you write role rules that match one repo to one secret path.
AWS Secrets Manager + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Unlogged secret reads also hurt teams during security audits. If ten repos share one AWS role, your logs show one reader. You cannot tell which Gitea job pulled a key before an incident. Give each repo or branch its own scoped role in AWS. Then your cloud logs will show the exact repo that read each secret.
Network paths between Gitea runners and AWS also need clear limits. Runners inside your private network should use private cloud links to reach AWS. This setup keeps secret traffic off the public internet at all times. You should also block outbound network traffic from build steps that only compile code.
Managing secret rotation across build jobs
Static keys grow stale when teams must update Gitea settings by hand. When you rotate a database password in AWS, hardcoded Gitea variables break right away. Pulling secrets at run time fixes this problem for your whole team. AWS Secrets Manager can rotate the database password on a set schedule. The very next Gitea build job fetches the new password without human work.
You should also watch how build logs handle secret values. A failed script might print variables to the Gitea job log screen. Set up your runners to scrub secret strings from standard output streams. Also limit who can view build logs inside your Gitea project spaces.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
Should I store AWS access keys in Gitea repo settings?
No, static AWS keys in Gitea settings are hard to rotate and track. Use identity tokens from Gitea so runners assume temporary AWS roles instead.
How do I stop staging builds from reading production secrets?
Create separate AWS roles for your staging and production branches in Gitea. Scope each role rule so it only reads secrets with matching tags.
What happens if a Gitea build prints a secret in the logs?
Anyone with read rights to the Gitea repo might see that key. Rotate the secret in AWS right away and delete the exposed build log.
Related guides
In this post