fix(nix): harden update script with GitHub token auth and add .gitattributes#54
Merged
AmethystLiang merged 1 commit intomainfrom Mar 7, 2026
Merged
fix(nix): harden update script with GitHub token auth and add .gitattributes#54AmethystLiang merged 1 commit intomainfrom
AmethystLiang merged 1 commit intomainfrom
Conversation
…ributes - fix(nix): harden update script with GitHub token auth and add .gitattributes - fix(nix): harden update script with GitHub token auth and add .gitattributes - fix issues - fix issues - fix issues - fix issues
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The nix update script was vulnerable to GitHub API rate limits, and authentication code across multiple files contained duplicated logic for cookie decryption with hardcoded iteration counts that weren't suitable for all platforms. Temporary files in Windows DPAPI decryption used predictable names, and the action versions in CI weren't pinned.
Solution
Hardened the update script with GitHub token authentication, pinned GitHub action versions with full commit hashes, created reusable modules for shared utilities (cookie decryption, SQLite queries, type guards), made the decryption logic platform-aware with configurable iterations, and fixed security issues with temporary file handling by using UUIDs and proper permissions.
Key Changes
GITHUB_TOKENsupport to curl requests to reduce rate limit issueschromium-cookie.ts: Platform-aware cookie decryption with configurable iterationsfirefox-profile.ts: Shared SQLite query logicobject-type-guards.ts: Reusable type checking utilitiesrandomUUID()instead ofDate.now()for temp file names0o600for restricted access.gitattributesto markflake.lockas linguist-generated (collapsed in GitHub diffs)has_morecheck in Slack channel history pagination📋 Test Plan
GITHUB_TOKEN=... ./scripts/update-nix-sources.shlocally and verify it fetches the latest releaseflake.lockis collapsed by default in GitHub PR diffs