Add IEF HUELLΔ tools: badge generator, passport assembler, and event templates#142
Add IEF HUELLΔ tools: badge generator, passport assembler, and event templates#142
Conversation
…templates Co-authored-by: Robbbo-T <164860269+Robbbo-T@users.noreply.github.com>
Co-authored-by: Robbbo-T <164860269+Robbbo-T@users.noreply.github.com>
| result = subprocess.run([ | ||
| sys.executable, "tools/ief_badges.py", | ||
| "--verify", str(verify_file), | ||
| "--root", str(tmppath), | ||
| "--out", str(badges_dir) | ||
| ], capture_output=True, text=True) |
There was a problem hiding this comment.
security (python.lang.security.audit.dangerous-subprocess-use-audit): Detected subprocess function 'run' without a static string. If this data can be controlled by a malicious actor, it may be an instance of command injection. Audit the use of this call to ensure it is not controllable by an external resource. You may consider using 'shlex.escape()'.
Source: opengrep
| result = subprocess.run([ | ||
| sys.executable, "tools/ief_assemble_passport.py", | ||
| "--verify", str(verify_file), | ||
| "--asset", "urn:ideale:test:asset:001", | ||
| "--family", "TEST", | ||
| "--model", "M1", | ||
| "--variant", "V1", | ||
| "--domain", "TEST", | ||
| "--ata", "ATA-00", | ||
| "--sbom", "sbom/test.spdx.json", | ||
| "--policy-sha", "sha256:test", | ||
| "--root", str(tmppath), | ||
| "--out-root", str(passport_dir), | ||
| "--badges-root", "badges" | ||
| ], capture_output=True, text=True) |
There was a problem hiding this comment.
security (python.lang.security.audit.dangerous-subprocess-use-audit): Detected subprocess function 'run' without a static string. If this data can be controlled by a malicious actor, it may be an instance of command injection. Audit the use of this call to ensure it is not controllable by an external resource. You may consider using 'shlex.escape()'.
Source: opengrep
| result = subprocess.run([ | ||
| sys.executable, "tools/ief_badges.py", | ||
| "--verify", str(verify_file), | ||
| "--root", str(tmppath), | ||
| "--out", str(badges_dir) | ||
| ], capture_output=True, text=True) |
There was a problem hiding this comment.
security (python.lang.security.audit.dangerous-subprocess-use-audit): Detected subprocess function 'run' without a static string. If this data can be controlled by a malicious actor, it may be an instance of command injection. Audit the use of this call to ensure it is not controllable by an external resource. You may consider using 'shlex.escape()'.
Source: opengrep
| result = subprocess.run([ | ||
| sys.executable, "tools/ief_assemble_passport.py", | ||
| "--verify", str(verify_file), | ||
| "--asset", "urn:ideale:test:asset:001", | ||
| "--family", "TEST", | ||
| "--model", "M1", | ||
| "--variant", "V1", | ||
| "--domain", "TEST", | ||
| "--ata", "ATA-00", | ||
| "--sbom", "sbom/test.spdx.json", | ||
| "--policy-sha", "sha256:test", | ||
| "--root", str(tmppath), | ||
| "--out-root", str(passport_dir), | ||
| "--badges-root", "badges" | ||
| ], capture_output=True, text=True) |
There was a problem hiding this comment.
security (python.lang.security.audit.dangerous-subprocess-use-audit): Detected subprocess function 'run' without a static string. If this data can be controlled by a malicious actor, it may be an instance of command injection. Audit the use of this call to ensure it is not controllable by an external resource. You may consider using 'shlex.escape()'.
Source: opengrep
This PR implements the complete IEF (IDEALE Evidence Framework) HUELLΔ system for traceability, material passports, and lifecycle event tracking. The implementation provides three core tools for managing digital product passports and generating visual badges from verification results.
Overview
The HUELLΔ system enables:
New Tools
1. Badge Generator (
tools/ief_badges.py)Generates visual badges from verification results, aggregating events by asset UID:
python tools/ief_badges.py \ --verify verification/verify-results.json \ --root . --out badges/Outputs 5 badge types:
trace.json- Traceability coverage across lifecycle stages (assemble, service, transport, handoff)risk.json- Maximum risk score with color-coded severity (low/mid/high/blocked)quality.json- Minimum quality score across all eventsimpact_energy.json- Total energy consumption (kWh)impact_co2.json- Total CO₂ emissions (kg)Each badge uses Shields.io-compatible JSON format for easy integration into READMEs and dashboards.
2. Passport Assembler (
tools/ief_assemble_passport.py)Creates digital material passports per asset from verified events:
python tools/ief_assemble_passport.py \ --verify verification/verify-results.json \ --asset "urn:ideale:component:AAA:BWQ1:FWD-SPAR:SN-000123" \ --family AMPEL360 --model BWB --variant Q100 \ --domain AAA --ata ATA-57 \ --sbom sbom/AMPEL360-BWQ1.spdx.json \ --policy-sha sha256:pinned \ --root . --out-root evidence/passports --badges-root badgesPassport includes:
3. Event Templates (
templates/)Ready-to-use JSON templates for rapid event capture:
event-inspect.json- Inspection events with photo inputsevent-transport.json- Transport/logistics eventsevent-assemble.json- Assembly/manufacturing eventsAll templates follow IEF v0.1 schema with signatures, context (geohash, environment, temperature), and calc metrics (energy, CO₂, risk, quality).
Key Features
✅ Zero external dependencies - Uses only Python standard library
✅ Shields.io integration - Badge JSON endpoints ready for display
✅ Flexible path handling - Supports various event directory structures
✅ Comprehensive metrics - Tracks energy, CO₂, risk, and quality across lifecycle
✅ Privacy-aware - Configurable geohash precision and PII tracking
✅ Test coverage - Automated smoke tests (5/5 passing)
✅ Complete documentation - Usage guide with examples in
tools/README_IEF.mdAlignment with Project Principles
CI Integration Example
Add to workflows after verification step:
Testing
All automated tests pass:
Files Changed
tools/ief_badges.py(8,079 bytes)tools/ief_assemble_passport.py(5,416 bytes)tools/test_ief_tools.py(7,697 bytes)tools/README_IEF.md(7,230 bytes)templates/event-inspect.json(805 bytes)templates/event-transport.json(645 bytes)templates/event-assemble.json(732 bytes).gitignore(addedevidence/passports/andverification/)Total: 6 new files, 1 modified, ~30KB of production code + documentation + tests
Original prompt
¡Vamos! Te dejo las piezas que faltaban para cerrar HUELLΔ en modo ejecutable:
1)
tools/ief_badges.py— genera endpoints Shields a partir de eventos/verificaciónasset_uid.calcsi existen en el evento (suma energía/CO₂,max(risk),min(quality)).Guárdalo como:
tools/ief_badges.py