Skip to content

Commit 75e7b2f

Browse files
Modify the timestamped_graph.md
1 parent d407174 commit 75e7b2f

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

timestamped_graph.md

+19-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,28 @@ The timestamped snapshot feature enables graphs to store their historical states
1010
- **Anomaly Detection in Secure Networks**: Helps in detecting unusual patterns in cryptographic protocols and secure transactions.
1111
- **Time-Series Graph Analysis**: Supports applications in secure financial transactions and privacy-preserving communications.
1212
- **Cryptographic Security (Future Enhancement)**: Can be extended to sign snapshots using HMAC for integrity verification and encrypted storage.
13+
- **Environment Variable-Based Secret Key**: Adds security by keeping cryptographic secrets out of the source code, reducing exposure to attacks.
1314

1415
## How It Works
1516

16-
### **Snapshot Storage**
17+
### **Snapshot Storage & Security Enhancements**
1718

1819
- When `add_snapshot()` is called, a deep copy of the graph is saved with a unique timestamp.
19-
- Snapshots are stored in an internal dictionary where timestamps serve as keys.
20+
- Each snapshot is **serialized and cryptographically signed** using an **HMAC signature**.
21+
- The system stores the HMAC signature alongside the snapshot to verify its integrity before retrieval.
22+
23+
### **Why We Use an Environment Variable for the Secret Key**
24+
To **prevent hardcoding secrets in the source code**, we store the **HMAC secret key in an environment variable** instead of defining it directly in the script. This offers:
25+
1. **Better Security**: Secrets stored in environment variables are not exposed in source code repositories.
26+
2. **Protection Against Attacks**: If an attacker gains access to the codebase, they **cannot retrieve the HMAC key** without environment access.
27+
3. **Separation of Concerns**: The cryptographic key can be changed without modifying the code, making key rotation easier.
28+
29+
## **Security Best Practices**
30+
To ensure maximum security when handling cryptographic keys, follow these best practices:
31+
32+
1. **Always set the HMAC key before running the program:**
33+
```bash
34+
export HMAC_SECRET_KEY=$(python3 -c "import secrets; print(secrets.token_hex(32))")
2035

2136
### **Retrieving Historical States**
2237

@@ -53,6 +68,8 @@ old_graph = graph.get_snapshot(graph.list_snapshots()[0])
5368
- **Encrypted Graph Storage for Privacy-Critical Applications**: Apply homomorphic encryption or privacy-preserving encryption to protect sensitive data, such as medical records, customer transactions, or identity graphs.
5469
- **Efficient Storage for Large-Scale Graphs**: Introduce optimized serialization techniques to store historical snapshots with minimal overhead, making it scalable for real-world enterprise applications.
5570
- **Integrity Verification for Regulatory Compliance**: Ensure snapshots cannot be altered without detection by integrating cryptographic hash functions. This is crucial for auditing in banking, supply chain security, and legal record-keeping.
71+
- **Regulatory Compliance and Auditing**: Extend integrity verification using Merkle trees for large-scale verification. Implement tamper-proof logging for financial transactions.
72+
- **Efficient storage for large graphs**: Introduce optimized serialization techniques to minimize storage costs.
5673

5774
## Conclusion
5875

0 commit comments

Comments
 (0)