Skip to content

Bug: multi_arch_oracles.py crashes with NameError — hmac used before import #4852

@508704820

Description

@508704820

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions