How to keep a secret secret ;-) ?
Posted: Tue Sep 09, 2025 7:22 am
Hi SAP folks,
these days a SAP driven customer described the following concern - maybe someone from you can provide some advice how to tackle this?
these days a SAP driven customer described the following concern - maybe someone from you can provide some advice how to tackle this?
The answers I found within ChatGPT are:As we all know the secret token aka ApiKey has to be sent with each call as part of the header or the request URL.
Is there a standard mechanism in SAP that stores the token in a proper vault from which it can be retrieved by the C++ / the masquerading layer? I am afraid that someone with someone with sufficient access can gather the secret.
How do other customers ensure the privacy of a token?
- SAP Secure Store (SSFS/SECSTORE) is intended for SAP internal components (RFC credentials, SNC keys, etc.), not for custom applications.
- Exposing a secret directly in the C++ or masquerading layer makes it vulnerable (file system access, memory dumps, debugging).
- The goal should be to avoid storing long-lived secrets there at all.
- 1. Do not persist the secret in the C++ layer. This way, no permanent secret ever resides in the C++ environment.
- Use a token broker service pattern
- The broker is a small, privileged component that fetches or renews tokens from a secure backend (Vault, SAP Credential Store, etc.).
- The C++ layer authenticates to the broker via mTLS or Kerberos, not with stored credentials.
- The broker returns only short-lived tokens in-memory.
- Use a token broker service pattern
- 2. Use a proper Secret Store
- On-premise options: HashiCorp Vault, CyberArk, OS-native keystores (Windows DPAPI / Linux kernel keyring).
- SAP BTP option: SAP Credential Store service (if hybrid scenarios are allowed).
- The store manages lifecycle: rotation, auditing, policy-based access.
- 3. Harden Runtime Security
- Keep tokens in memory only; never in files, ENV variables, logs, or dumps.
- Apply memory zeroization after use.
- Run the C++ service under a dedicated OS account with minimal privileges.
- Enforce certificate-based authentication to the broker or vault.
- Enable auditing and anomaly detection for secret requests.
- Recommended Architecture
- C++ service → Token Broker (via mTLS).
- Broker → Vault/Keystore (fetches or rotates tokens).
- Token delivered in-memory only, with TTL (2–10 min).
- Broker/Vault manages refresh tokens or root secrets securely.
- Full audit trail on every fetch.
- Key Takeaways
- SAP’s own secure storage mechanisms are not for custom app secrets.
- The correct way is to externalize secret management into a vault/credential store and expose only ephemeral access tokens to the C++ layer.
- This removes the need to store a sensitive “secret” where any privileged user might access it.