Skip to content

Use PBKDF2-HMAC with device-specific salt for anonymization#116

Closed
Copilot wants to merge 3 commits intoissue1512from
copilot/sub-pr-113-another-one
Closed

Use PBKDF2-HMAC with device-specific salt for anonymization#116
Copilot wants to merge 3 commits intoissue1512from
copilot/sub-pr-113-another-one

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 11, 2026

The current anonymization uses truncated SHA1, which is vulnerable to dictionary/brute-force attacks on low-entropy inputs like IP addresses and hostnames.

Changes:

  • Replace SHA1 with PBKDF2-HMAC-SHA256 (100k iterations)
  • Add device-specific salt from /etc/machine-id with UUID fallback
  • Rename parameter inputvalue to avoid shadowing builtin

Implementation:

# Before: easily reversed via precomputation
h = hashlib.sha1(input.encode()).hexdigest()
return f"anon-{h[:16]}"

# After: computationally expensive, device-specific
salt = _get_device_salt()  # from /etc/machine-id or generated UUID
h = hashlib.pbkdf2_hmac('sha256', value.encode(), salt, PBKDF2_ITERATIONS, dklen=16)
return f"anon-{h.hex()}"

The device-specific salt prevents external precomputation attacks while maintaining deterministic output per device (required for analytics).


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 11, 2026 10:26
Co-authored-by: gsanchietti <804596+gsanchietti@users.noreply.github.com>
…ions

Co-authored-by: gsanchietti <804596+gsanchietti@users.noreply.github.com>
Copilot AI changed the title [WIP] Update inventory with additional information based on feedback Use PBKDF2-HMAC with device-specific salt for anonymization Feb 11, 2026
Copilot AI requested a review from gsanchietti February 11, 2026 10:29
@gsanchietti
Copy link
Copy Markdown
Member

Too complex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants