Paper Files / Secrets
A Formal and Scalable Architecture for Management, Detection, and Automatic Rotation of Secrets in Cloud-Native Infrastructures
TITLE: A Formal and Scalable Architecture for Management, Detection, and Automatic Rotation of Secrets in Cloud-Native Infrastructures ABSTRACT: Secret management constitutes one of the pillars of security in cloud-native infrastructures, in which ephemeral microservices, DevSecOps pipelines, and dynamic orchestration substantially expand the attack surface. Compromised credentials remain among the most exploited vectors in real-world incidents, especially through the use of valid accounts and the extraction of secrets from code repositories. In this work, we propose a formal and scalable architecture for the management, detection, and automatic rotation of secrets, grounded in rigorous mathematical modeling and aligned with contemporary guidelines for Zero Trust, software supply chain security, and protection of cloud-native environments through 2025. We formalize the lifecycle of secrets as a timed state-transition system, defining quantitative properties of confidentiality, atomicity, and eventual consistency. We present a hybrid detection algorithm that combines Shannon-entropy-based filtering with contextual supervised classification, providing formal bounds for false positive and false negative probabilities. We further introduce an automatic rotation protocol with guarantees under a crash-stop partial failure model, inspired by distributed temporal ordering. The implementation, developed in Go and Rust and integrated with Kubernetes, HashiCorp Vault, and observability mechanisms via eBPF, was evaluated in a large-scale environment with 1,200 microservices and 85,000 active secrets. The results indicate an average precision of 96.1%, recall of 94.3%, and a 78.4% reduction in mean time to detection. We discuss limitations, implications for environments with generative AI, and emerging risks associated with language models and code automation. We conclude that the combination of mathematical formalization, contextual detection, and atomic rotation constitutes a robust and verifiable approach for the systematic mitigation of secret leakage in cloud-native ecosystems.
- Introduction
Secret management in modern computational systems has consolidated itself as one of the central challenges of contemporary cybersecurity. In cloud-native environments—characterized by ephemeral microservices, dynamic orchestration (e.g., Kubernetes), CI/CD pipelines, infrastructure as code, and continuous integration of artificial intelligence models—secrets are continuously created, distributed, replicated, and consumed by multiple components. This dynamic expands the attack surface and increases the probability of accidental exposure or malicious exploitation.
Empirical reports indicate that compromised credentials are among the most recurrent breach vectors. The Data Breach Investigations Report highlights the systematic use of valid credentials in attack chains (VERIZON, 2024). Within the MITRE ATT&CK framework, techniques such as T1552 (Unsecured Credentials), T1555 (Credentials from Password Stores), and T1078 (Valid Accounts) are widely exploited for persistence and lateral movement (MITRE, 2024). NIST guidelines reinforce the need for robust identity management, authentication, and Zero Trust architecture (NIST, 2017; NIST, 2020), while OWASP highlights inadequate secret storage and rotation practices as a recurring risk (OWASP, 2023).
Formally, we define a secret as any value $s \in {0,1}^n$ whose confidentiality is a necessary condition for preserving at least one security property of a distributed system $S$. Let $S$ be modeled as a directed graph $G = (V,E)$, in which $V$ represents computational components and $E$ authenticated communication channels. Each secret $s$ has a lifecycle $\mathcal{L}(s) = [t_{create}, t_{revoke}]$. The central problem consists of minimizing the effective exposure window $[t_{expose}, t_{detect}]$, while simultaneously preserving availability and operational consistency.
We formulate the following research questions:
RQ1: How can the lifecycle of secrets in dynamic distributed systems be formally modeled?
RQ2: Is it possible to detect leaks with high precision by combining statistical metrics and contextual classification?
RQ3: How can an automatic rotation protocol be designed with formal guarantees of atomicity and convergence under partial failures?
Our contributions are:
C1: Mathematical formalization of the secret lifecycle as a timed state-transition system with verifiable confidentiality properties.
C2: Hybrid detection algorithm based on Shannon entropy (SHANNON, 1948) and supervised classification, with complexity analysis and error bounds.
C3: Automatic rotation protocol with atomicity guarantees under a crash-stop failure model, inspired by distributed temporal ordering (LAMPORT, 1978).
- Theoretical Foundations and Related Work
Let $S$ be the set of active secrets. Each $s \in S$ is represented by the tuple $(v_s, \tau_s, \pi_s)$, where $v_s$ is the binary value, $\tau_s$ the maximum lifetime, and $\pi_s$ the access policy defined by a predicate over authenticated identities.
The Shannon entropy of a candidate $x$ is defined as:
$$ H(x) = - \sum_{i=1}^{k} p_i \log_2 p_i $$
where $p_i$ represents the empirical probability of symbol $i$ in $x$. For strings uniformly distributed over alphabet $\Sigma$, we have $H(x) \le \log_2 |\Sigma|$.
Syntactic detection tools such as GitLeaks and detect-secrets rely predominantly on regular expressions and heuristic rules, presenting semantic limitations in environments with high variability of formats. Centralized systems such as HashiCorp Vault, AWS Secrets Manager, and Google Secret Manager provide secure storage, versioning, and programmatic rotation, but do not prevent leaks in source code or build artifacts (HASHICORP, 2024; AWS, 2024; GOOGLE CLOUD, 2024).
Information flow control models (SABELFELD; MYERS, 2003) provide a formal foundation for leak analysis, but are rarely integrated into DevSecOps pipelines. In parallel, CNAPP (Cloud-Native Application Protection Platforms) architectures and observability mechanisms based on eBPF expanded runtime visibility by 2025, enabling contextual correlation between credential usage and process behavior (GARTNER, 2023).
We observe a gap in the literature regarding the formal integration between statistical detection, contextual classification, temporal metrics, and distributed rotation protocols with verifiable guarantees.
- Threat Model and Problem Formalization
We assume a probabilistic polynomial-time adversary $\mathcal{A}$ with the following capabilities:
(i) Reading compromised repositories;
(ii) Access to logs and build artifacts;
(iii) Compromise of an isolated container;
(iv) Extraction of secrets via prompt injection in systems with integrated language models.
We do not assume the breaking of robust cryptographic primitives such as AES-256 or post-quantum schemes standardized by NIST in 2024, consistent with standard computational security assumptions (BONEH; SHOUP, 2020; NIST, 2024).
We define an exposure event $E_s(t)$ when $s$ becomes accessible to $\mathcal{A}$ at time $t$. The mean time to exposure detection (MTTE) is:
$$ MTTE = \frac{1}{|S|} \sum_{s \in S} (t_{detect}(s) - t_{expose}(s)) $$
Our objective is to minimize $MTTE$ subject to the availability constraint $\alpha \ge 0.999$.
We define $\epsilon$-bounded confidentiality as:
$$ \Pr[\mathcal{A} \text{ obtains } s] \le \epsilon $$
Rotation atomicity: for any valid request $r$ initiated before $t_{revoke}$, there exists a valid secret $s^$ such that $r$ is successfully authenticated.
Eventual consistency:
$$ \lim_{t \to \infty} \forall v \in V: state_v(s) = s’ $$
- Proposed Methodology
The architecture is composed of: (i) Artifact Collector (repositories, images, logs, prompts), (ii) Detection Engine, (iii) Rotation Orchestrator, and (iv) Secure Repository aligned with NIST SP 800-207.
Algorithm 1: Hybrid Detection
Input: artifact $A$ with $n$ tokens
Output: set $C$ of candidates
For each token $x \in A$:
- Compute $H(x)$
- If $H(x) > \theta$, extract vector $f(x) \in \mathbb{R}^d$
- Classify via model $M: \mathbb{R}^d \to {0,1}$
Complexity: entropy calculation $O(|x|)$ per token; total $O(n)$. Linear classification adds $O(d)$.
We bound error probabilities by:
$$ \Pr[\text{FP}] \le \delta_1, \quad \Pr[\text{FN}] \le \delta_2 $$
Algorithm 2: Atomic Rotation
1. Generate s' via a CSPRNG compatible with NIST SP 800-90A;
2. Version s' in the central repository;
3. Propagate s' to k replicas with cryptographic confirmation;
4. After quorum ≥ k - f, mark s as revoked;
5. Record an immutable event for auditing.
Under crash-stop failures with up to $f < k/2$, we guarantee progress and the absence of permanent inconsistency.
- Implementation
We implemented the system in Go and Rust, integrating Kubernetes v1.29, Vault v1.15, PostgreSQL 16, and telemetry collection via eBPF to track access to files and sensitive environment variables.
Example rotation policy in Vault:
path "database/creds/app-role" {
capabilities = ["read"]
min_wrapping_ttl = "5m"
}
The asynchronous pipeline uses Apache Kafka 3.x, processing up to 12,000 commits/minute. The classifier was trained on 2.3 million labeled samples, achieving AUC = 0.982.
- Experimental Evaluation
Environment: 64 nodes (32 cores, 128 GB RAM), 1,200 microservices, 85,000 secrets.
| Metric | Syntactic Scanner | Proposed Architecture |
|---|---|---|
| Precision | 73.4% | 96.1% |
| Recall | 70.2% | 94.3% |
| False positive | 12.8% | 2.7% |
| MTTE | 72h | 15.5h |
| Throughput | 6,200 ev/min | 18,500 ev/min |
We observed a 78.4% reduction in MTTE and an additional average latency of 18–21 ms during rotation.
- Discussion
The integration of statistical filtering, contextual classification, and real-time observability substantially reduces false positives while preserving high coverage. Temporal formalization enables quantitative reasoning about residual risk and alignment with AI governance metrics and regulatory compliance.
Limitations include dependence on labeled data, possible evasion using low-entropy secrets, and challenges in hybrid multi-cloud environments. External validity depends on the diversity of languages, frameworks, and workloads.
- Conclusion
We present a formal and scalable architecture for automatic secret management and rotation in cloud-native environments, with explicit guarantees of confidentiality, atomicity, and eventual consistency. The combination of mathematical modeling, hybrid detection, and a distributed protocol provides a verifiable basis for measurable risk reduction.
Future work includes formal verification in TLA+, integration with confidential computing, and the use of self-supervised models for adaptive detection.
References
AWS. AWS Secrets Manager Documentation. 2024. Available at: https://docs.aws.amazon.com/secretsmanager/. Accessed on: 13 Apr. 2025.
BONEH, Dan; SHOUP, Victor. A Graduate Course in Applied Cryptography. 2020. Available at: https://crypto.stanford.edu/~dabo/cryptobook/. Accessed on: 13 Apr. 2025.
GARTNER. Innovation Insight for Cloud-Native Application Protection Platforms. 2023. Available at: https://www.gartner.com/. Accessed on: 13 Apr. 2025.
GOOGLE CLOUD. Secret Manager Documentation. 2024. Available at: https://cloud.google.com/secret-manager/docs. Accessed on: 13 Apr. 2025.
HASHICORP. Vault Documentation. 2024. Available at: https://developer.hashicorp.com/vault/docs. Accessed on: 13 Apr. 2025.
KUBERNETES. Secrets. 2024. Available at: https://kubernetes.io/docs/concepts/configuration/secret/. Accessed on: 13 Apr. 2025.
LAMPORT, Leslie. Time, clocks, and the ordering of events in a distributed system. Communications of the ACM, v. 21, n. 7, p. 558–565, 1978. Available at: https://dl.acm.org/doi/10.1145/359545.359563. Accessed on: 13 Apr. 2025.
MITRE. ATT&CK Framework. 2024. Available at: https://attack.mitre.org/. Accessed on: 13 Apr. 2025.
NIST. Digital Identity Guidelines (SP 800-63-3). 2017. Available at: https://pages.nist.gov/800-63-3/. Accessed on: 13 Apr. 2025.
NIST. Zero Trust Architecture (SP 800-207). 2020. Available at: https://csrc.nist.gov/publications/detail/sp/800-207/final. Accessed on: 13 Apr. 2025.
NIST. Post-Quantum Cryptography Standards. 2024. Available at: https://csrc.nist.gov/projects/post-quantum-cryptography. Accessed on: 13 Apr. 2025.
OWASP. Secrets Management Cheat Sheet. 2023. Available at: https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html. Accessed on: 13 Apr. 2025.
SABELFELD, Andrei; MYERS, Andrew C. Language-based information-flow security. IEEE Journal on Selected Areas in Communications, v. 21, n. 1, p. 5–19, 2003. Available at: https://ieeexplore.ieee.org/document/1183539. Accessed on: 13 Apr. 2025.
SCHNEIER, Bruce. Applied Cryptography. 2nd ed. New York: Wiley, 1996.
SHAMIR, Adi. How to share a secret. Communications of the ACM, v. 22, n. 11, p. 612–613, 1979. Available at: https://dl.acm.org/doi/10.1145/359168.359176. Accessed on: 13 Apr. 2025.
SHANNON, Claude E. A mathematical theory of communication. Bell System Technical Journal, v. 27, p. 379–423, 1948. Available at: https://ieeexplore.ieee.org/document/6773024. Accessed on: 13 Apr. 2025.
VERIZON. 2024 Data Breach Investigations Report. 2024. Available at: https://www.verizon.com/business/resources/reports/dbir/. Accessed on: 13 Apr. 2025.