惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threatpost
WordPress大学
WordPress大学
Martin Fowler
Martin Fowler
博客园 - 聂微东
L
LangChain Blog
D
Docker
大猫的无限游戏
大猫的无限游戏
人人都是产品经理
人人都是产品经理
D
DataBreaches.Net
aimingoo的专栏
aimingoo的专栏
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
C
Cisco Blogs
L
LINUX DO - 热门话题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
C
Cybersecurity and Infrastructure Security Agency CISA
博客园 - 三生石上(FineUI控件)
S
Secure Thoughts
N
News and Events Feed by Topic
Latest news
Latest news
PCI Perspectives
PCI Perspectives
TaoSecurity Blog
TaoSecurity Blog
博客园 - 司徒正美
量子位
Stack Overflow Blog
Stack Overflow Blog
Know Your Adversary
Know Your Adversary
SecWiki News
SecWiki News
美团技术团队
C
CERT Recently Published Vulnerability Notes
Attack and Defense Labs
Attack and Defense Labs
AWS News Blog
AWS News Blog
C
Check Point Blog
S
Security Affairs
Vercel News
Vercel News
Google DeepMind News
Google DeepMind News
K
Kaspersky official blog
IT之家
IT之家
A
About on SuperTechFans
Help Net Security
Help Net Security
博客园 - 【当耐特】
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Recorded Future
Recorded Future
月光博客
月光博客
博客园_首页
小众软件
小众软件
H
Help Net Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Building a SHA-256 audit trail for emission factor provenance in WordPress
Jeremiah Say · 2026-05-11 · via DEV Community

Carbon accounting tools have a trust problem that most developers don't think about until it's too late.

A sustainability officer files a CSRD disclosure. An auditor asks: "Where does this emission factor come from?" The tool says 2.57 kg CO₂e/litre for diesel. The auditor wants the source workbook, the specific tab, the row number, and the date someone verified the cell against the published file. Without that, the number is a claim, not evidence.

Most carbon platforms can't answer that question. At GreenCalculus.com, I designed the data layer so every single emission factor carries a _provenance block that answers it — and the automated verification pipeline hashes every source workbook against the issuing body's published file to prove the data hasn't drifted.

Here's how the whole thing works.


The problem with emission factor databases

Emission factors go stale in predictable ways:

  1. Silent copy errors — a value gets transcribed from a source document with a rounding error or wrong unit and propagates for years
  2. Version drift — DEFRA, IEA, EPA publish annual updates; any hardcoded factor is wrong by the following June
  3. GWP basis ambiguity — the same gas has different CO₂e values depending on whether you use AR5 or AR6 GWP-100; most databases don't disclose which one
  4. No chain of custody — you know the number but not who extracted it, from which cell, on which date

All four of these are audit failures, not just data quality issues. Under CSRD and ISO 14064, an auditor can request the full methodology chain for any material emission category. If your platform can't produce it, you have a liability.


The _provenance block

Every fuel, grid, and refrigerant factor in the GreenCalculus Master Brain carries a _provenance subkey. Here's a real example — diesel:

'diesel' => [
    'factor'   => 2.57082,
    'unit'     => 'kg CO2e per litre',
    'scope'    => 1,
    'source'   => 'DEFRA_2025',
    'gwp'      => 'AR5_100',
    'name'     => 'Diesel (average biofuel blend)',

    '_provenance' => [
        'source'           => 'UK Government GHG Conversion Factors for Company Reporting, Year 2025 Version 1, DESNZ, June 2025',
        'tab'              => 'Fuels',
        'row_label'        => 'Diesel (average biofuel blend)',
        'row_number'       => 87,
        'column'           => 'D — kg CO2e (per litre)',
        'gwp_basis'        => 'IPCC AR5 GWP-100',
        'sourced_by'       => 'Jeremiah Say',
        'sourced_on'       => '2026-05-06',
        'verified'         => true,
        'verified_against' => 'ghg-conversion-factors-2025-full-set.xlsx',
        'verified_date'    => '2026-05-08',
    ],
],

Enter fullscreen mode Exit fullscreen mode

Every field is mandatory on Tier-1 sources (DEFRA, IEA, EPA). The row_number and column fields mean anyone with the source workbook can find the exact cell in under 30 seconds. sourced_by and sourced_on create a named, timestamped human record. verified_against points to the specific file that was hashed.


SHA-256 hashing the source workbooks

The verified_against field names a specific file. That file needs to be verifiably the same as what the issuing body published. This is where SHA-256 comes in.

When a new DEFRA or IEA release drops, the workflow is:

  1. Download the official workbook
  2. Hash it immediately before touching it
  3. Store the hash in the Master Brain metadata
  4. On every deploy, re-hash the stored file and compare

Here's the PHP that handles step 2–4:

/**
 * Hash a source workbook and return the hex digest.
 * Store this at intake. Re-run on deploy to verify no drift.
 *
 * @param  string $filepath  Absolute path to the workbook file.
 * @return string|false      SHA-256 hex digest, or false on failure.
 */
function gc_hash_source_workbook( string $filepath ) {
    if ( ! file_exists( $filepath ) || ! is_readable( $filepath ) ) {
        error_log( sprintf( '[GC Provenance] File not found or unreadable: %s', $filepath ) );
        return false;
    }

    return hash_file( 'sha256', $filepath );
}

/**
 * Verify a stored workbook hash against the live file on disk.
 * Run this in a deploy hook or WP-CLI command before publishing
 * any Master Brain update.
 *
 * @param  string $filepath       Absolute path to the workbook file.
 * @param  string $expected_hash  SHA-256 hex digest stored at intake.
 * @return bool                   True if file matches stored hash.
 */
function gc_verify_source_workbook( string $filepath, string $expected_hash ): bool {
    $live_hash = gc_hash_source_workbook( $filepath );

    if ( $live_hash === false ) {
        return false;
    }

    $match = hash_equals( $expected_hash, $live_hash );

    if ( ! $match ) {
        error_log( sprintf(
            '[GC Provenance] HASH MISMATCH: %s — expected %s, got %s',
            basename( $filepath ),
            $expected_hash,
            $live_hash
        ) );
    }

    return $match;
}

Enter fullscreen mode Exit fullscreen mode

hash_equals() is used instead of === to prevent timing attacks — a minor point for offline files, but a correct habit.

The stored hashes live in the Master Brain metadata block:

'meta' => [
    'version'    => '2025.6',
    'updated'    => '2026-05-09',
    'gwp_basis'  => 'AR5_100',

    'source_workbook_hashes' => [
        'DEFRA_2025' => [
            'filename' => 'ghg-conversion-factors-2025-full-set.xlsx',
            'sha256'   => 'a3f8c2...', // full 64-char hex digest
            'verified' => '2026-05-08',
        ],
        'EPA_2024' => [
            'filename' => 'egrid2022_summary_tables.pdf',
            'sha256'   => 'b91d47...',
            'verified' => '2026-05-09',
        ],
    ],
],

Enter fullscreen mode Exit fullscreen mode


Running the verification check on deploy

The verification runs as a WP-CLI command that blocks the deploy if any hash fails:

/**
 * WP-CLI command: verify all source workbook hashes.
 * Run before publishing any Master Brain version bump.
 *
 * Usage: wp gc verify-provenance
 */
if ( defined( 'WP_CLI' ) && WP_CLI ) {

    WP_CLI::add_command( 'gc verify-provenance', function () {

        $brain  = gc_get_master_brain_data();
        $hashes = $brain['meta']['source_workbook_hashes'] ?? [];
        $dir    = WP_CONTENT_DIR . '/gc-source-workbooks/';
        $passed = 0;
        $failed = 0;

        foreach ( $hashes as $source_id => $entry ) {
            $filepath = $dir . $entry['filename'];
            $ok       = gc_verify_source_workbook( $filepath, $entry['sha256'] );

            if ( $ok ) {
                WP_CLI::success( "{$source_id}: {$entry['filename']} — hash verified ✓" );
                $passed++;
            } else {
                WP_CLI::error( "{$source_id}: {$entry['filename']} — HASH MISMATCH ✗", false );
                $failed++;
            }
        }

        WP_CLI::line( "---" );
        WP_CLI::line( "Passed: {$passed} | Failed: {$failed}" );

        if ( $failed > 0 ) {
            WP_CLI::error( "Provenance check failed. Do not publish this Master Brain version." );
            exit( 1 );
        }

        WP_CLI::success( "All source workbooks verified. Safe to publish." );
    } );
}

Enter fullscreen mode Exit fullscreen mode

exit(1) means a CI pipeline that runs wp gc verify-provenance will block the deploy automatically if any workbook has drifted.


The _provenance enforcement check

Hash verification proves the workbook is intact. But it doesn't prove every factor in the Master Brain was actually extracted from it. For that, there's a second check that scans every entry and flags any that are missing _provenance:

/**
 * WP-CLI command: audit all Master Brain factor entries for _provenance.
 *
 * Usage: wp gc audit-provenance
 */
if ( defined( 'WP_CLI' ) && WP_CLI ) {

    WP_CLI::add_command( 'gc audit-provenance', function () {

        $brain    = gc_get_master_brain_data();
        $sections = [ 'fuels', 'fuels_wtt', 'grid', 'refrigerants', 'agriculture' ];
        $missing  = [];

        foreach ( $sections as $section ) {
            $entries = $brain[ $section ] ?? [];

            foreach ( $entries as $key => $entry ) {
                // Skip non-array entries and nested subgroups
                if ( ! is_array( $entry ) || ! isset( $entry['factor'] ) ) {
                    continue;
                }

                if ( empty( $entry['_provenance'] ) ) {
                    $missing[] = "{$section}.{$key}";
                } elseif ( empty( $entry['_provenance']['verified'] ) || $entry['_provenance']['verified'] !== true ) {
                    $missing[] = "{$section}.{$key} (unverified)";
                }
            }
        }

        if ( empty( $missing ) ) {
            WP_CLI::success( "All factors carry verified _provenance blocks." );
            return;
        }

        WP_CLI::warning( count( $missing ) . " factor(s) missing or unverified provenance:" );
        foreach ( $missing as $key ) {
            WP_CLI::line( "  — {$key}" );
        }

        exit( 1 );
    } );
}

Enter fullscreen mode Exit fullscreen mode


How this surfaces in the schema graph

The verification pipeline isn't just internal tooling. It's represented in the site's Schema.org entity graph as a SoftwareApplication node:

function gc_get_engineering_node(): array {
    return [
        '@type'          => 'SoftwareApplication',
        '@id'            => home_url( '/#engineering' ),
        'name'           => 'GreenCalculus Engineering',
        'description'    => 'Automated verification pipeline. Performs SHA-256 hash verification of source workbooks against the issuing body\'s published files, enforces cell-by-cell provenance attribution on every emission factor, and cross-checks methodology prose against the data layer before publication.',
        'featureList'    => 'SHA-256 hash verification of source workbooks; cell-by-cell _provenance enforcement; dual GWP basis disclosure (AR5/AR6); 30-day Tier-1 update SLA; prose-vs-data cross-validation; public changelog audit graph',
        'softwareVersion' => '2026.05',
    ];
}

Enter fullscreen mode Exit fullscreen mode

Every calculator and methodology page then references this entity as reviewedBy:

$schema['reviewedBy'] = [ '@id' => home_url( '/#engineering' ) ];

Enter fullscreen mode Exit fullscreen mode

This is Schema.org's explicit signal for "who fact-checked this content." It's backed by real machinery — not a fabricated review board. An auditor who follows the @id to /governance/ will find the full description of what the pipeline actually does. The schema points to real code, not a badge.


The discipline this enforces

The whole system only works if it's enforced at authorship time, not patched in later. The rule at GreenCalculus is:

No factor enters the Master Brain without a complete _provenance block. verified: true means a human has opened the source workbook, found the cell, confirmed the value, and signed it with their name and date.

When the DEFRA 2025 release dropped the UK grid factor from 0.207 to 0.177 — a 15% change — the update produced a new _provenance block with a new sourced_on date, a new verified_date, and a public changelog entry stating the old and new values explicitly. The SHA-256 hash of the new workbook replaced the old one in the metadata. The CI pipeline re-ran the hash check on the next deploy and passed.

That's the full chain: source document → hash → cell reference → human verification → named attribution → public changelog. Every link is traceable. Every link is automated where possible and named where it requires human judgment.

For CSRD filers who need to point an auditor at a methodology chain, that's not optional infrastructure. It's the product.


The full GreenCalculus Master Brain data layer, verification pipeline, and public changelog are at greencalculus.com.