developer security skill risk: medium
SHA-256 Log Integrity Chain Builder
The prompt provides step-by-step instructions to build an append-only log integrity chain using SHA-256 hash chaining, including ingesting log entries, computing chained hashes, st…
- Policy sensitive
- Human review
- External action: medium
SKILL 4 files · 2 folders
SKILL.md
---
name: implementing-log-integrity-with-blockchain
description: "Build an append-only log integrity chain using SHA-256 hash chaining for tamper detection. Each log entry is"
---
# Implementing Log Integrity with Blockchain
## When to Use
- When deploying or configuring implementing log integrity with blockchain capabilities in your environment
- When establishing security controls aligned to compliance requirements
- When building or improving security architecture for this domain
- When conducting security assessments that require this implementation
## Prerequisites
- Familiarity with security operations concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
## Instructions
1. Install dependencies: `pip install requests`
2. Ingest log entries from syslog, JSON, or plain text files.
3. For each entry, compute SHA-256 hash of: previous_hash + timestamp + log_content.
4. Store the chain as a JSON ledger with entry index, timestamp, content hash, previous hash, and chain hash.
5. Verify chain integrity by recomputing all hashes and detecting breaks.
6. Optionally anchor checkpoint hashes to an external timestamping service.
```bash
python scripts/agent.py --log-file /var/log/syslog --chain-file log_chain.json --verify --output integrity_report.json
```
## Examples
### Chain Entry Structure
```json
{"index": 42, "timestamp": "2024-01-15T10:30:00Z", "content_hash": "a1b2c3...",
"prev_hash": "d4e5f6...", "chain_hash": "SHA256(prev_hash + timestamp + content_hash)"}
```
### Tamper Detection
If entry 42 is modified, chain_hash[42] will not match SHA256(chain_hash[41] + ...), and all entries from 42 onward will be flagged as invalid.
REQUIRED CONTEXT
- log entries from syslog, JSON, or plain text files
- Python 3.8+ environment
OPTIONAL CONTEXT
- external timestamping service
EXPECTED OUTPUT
- Format
- json
- Constraints
-
- produce JSON ledger with index, timestamp, content_hash, prev_hash, chain_hash
- optionally produce integrity_report.json
EXAMPLES
Includes one JSON example of chain entry structure and a description of tamper detection.
CAVEATS
- Dependencies
-
- Familiarity with security operations concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
- Missing context
-
- Full source code for the implementation
- Exact log ingestion parsing rules
- Dependency versions beyond 'requests'
- Ambiguities
-
- Description sentence is truncated: 'Each log entry is'
QUALITY
- OVERALL
- 0.52
- CLARITY
- 0.72
- SPECIFICITY
- 0.68
- REUSABILITY
- 0.28
- COMPLETENESS
- 0.58
IMPROVEMENT SUGGESTIONS
- Complete the truncated description sentence.
- Convert the instructions into a reusable template with placeholders for log sources and output paths.
- Add explicit success criteria or verification test cases.
USAGE
Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.
MORE FOR DEVELOPER
- Python Security Code Auditor developer security
- Arcjet AI Endpoint Protection Implementer developer security
- Multi-Layer Data Validation Implementer developer security
- Git Diff Security Auditor developer security
- Cybersecurity Viral Tool Architect developer security
- LLM Security Vulnerability Analyzer developer security
- AI Agent Security Evaluation Checklist Creator developer security
- Cyberscam Survival Simulator Specification developer security
- AI Agent Permissions Updater for Claude Gemini developer security
- Prompt Injection Jailbreak Detector developer security
- Ethereum Smart Contract Vulnerability Analyzer developer security
- Python mTLS Certificate Generator for Zero Trust developer security
- Cloud Workload Protection Implementation developer security
- GHAS Alerts and Repo Vulnerability Analyzer developer security
- Codebase Security Fix and Test Writer developer security
- AI Vulnerability Analysis and Automation Accelerator developer security
- GHAS Vulnerability Triage and Upgrade Recommender developer security
- Context7 Library Documentation Expert developer coding
- Structured Python Production Code Generator developer coding
- Minimax Music API Generation Agent developer creative
- Angular Standalone Directive Generator developer coding
- Pytest Unit Test Suite Generator developer coding
- Unity Architecture Specialist developer coding
- iOS App Store Compliance Auditor developer analysis
- Reusable Enterprise Website Template Architect developer software_engineering