Bug: hmac module used before import, causing NameError crash
Severity: Medium (Crash)
File: src/mutator_oracle/multi_arch_oracles.py, generate_mutation_seed() (lines 288-292)
Description:
Line 288 calls hmac.new() but hmac is only imported inside the demo function on line 481 (import hmac # Import for ring signature). When generate_mutation_seed() is called in production, it crashes with NameError: name 'hmac' is not defined.
The fallback on line 292 (if 'hmac' in dir()) never executes because the NameError is thrown on line 288 first.
Reproduction:
# Call generate_mutation_seed() → NameError: name 'hmac' is not defined
Impact:
- Multi-architecture oracle seed generation crashes in production
- Ring signature never works — always falls through to broken code path
- If somehow fixed, the fallback
sha256(final_seed) is not a proper HMAC ring signature
Expected Fix:
- Import
hmac at module level (with other imports)
- Remove the
if 'hmac' in dir() fallback — it's dead code that masks the real issue
Bug: hmac module used before import, causing NameError crash
Severity: Medium (Crash)
File:
src/mutator_oracle/multi_arch_oracles.py,generate_mutation_seed()(lines 288-292)Description:
Line 288 calls
hmac.new()buthmacis only imported inside the demo function on line 481 (import hmac # Import for ring signature). Whengenerate_mutation_seed()is called in production, it crashes withNameError: name 'hmac' is not defined.The fallback on line 292 (
if 'hmac' in dir()) never executes because the NameError is thrown on line 288 first.Reproduction:
# Call generate_mutation_seed() → NameError: name 'hmac' is not definedImpact:
sha256(final_seed)is not a proper HMAC ring signatureExpected Fix:
hmacat module level (with other imports)if 'hmac' in dir()fallback — it's dead code that masks the real issue