Skip to content

chore(security): Pin pre-commit hooks by SHA, as it is immutable#902

Merged
MaxymVlasov merged 3 commits intomasterfrom
commot_over_tag
Jun 5, 2025
Merged

chore(security): Pin pre-commit hooks by SHA, as it is immutable#902
MaxymVlasov merged 3 commits intomasterfrom
commot_over_tag

Conversation

@MaxymVlasov
Copy link
Copy Markdown
Collaborator

@MaxymVlasov MaxymVlasov commented Jun 5, 2025

Pinned by pre-commit autoupdate --freeze as pre-commit in Renovate currently does not support freezing style used by pre-commit

Copilot AI review requested due to automatic review settings June 5, 2025 18:13
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 5, 2025

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Disabled Renovate's built-in pre-commit integration in the configuration.
    • Updated pre-commit hook versions to use exact commit hashes ("frozen" versions) instead of version tags, with annotations for reference.

Summary by CodeRabbit

  • Chores
    • Disabled Renovate's built-in pre-commit integration.
    • Updated pre-commit hook versions to use specific commit hashes for improved reproducibility.

Walkthrough

The Renovate configuration was updated to disable its pre-commit integration in favor of using pre-commit.ci freeze. Additionally, the .pre-commit-config.yaml file was modified to replace version tags with exact commit hashes for all hooks, effectively freezing their versions to specific commits.

Changes

File(s) Change Summary
.github/renovate.json5 Added "pre-commit": { "enabled": false } to disable Renovate's pre-commit integration with a comment.
.pre-commit-config.yaml Updated all hook rev fields from version tags to commit hashes, annotating each with the original tag.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Renovate
    participant pre-commit.ci

    User->>Renovate: Runs Renovate (pre-commit integration disabled)
    Renovate--xpre-commit.ci: Does not manage pre-commit hooks
    User->>pre-commit.ci: Uses pre-commit.ci freeze to lock hook versions
    pre-commit.ci-->>User: Updates .pre-commit-config.yaml with frozen SHAs
Loading

Suggested reviewers

  • antonbabenko
  • yermulnik

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce93db5 and 34cbd0a.

📒 Files selected for processing (1)
  • .pre-commit-config.yaml (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .pre-commit-config.yaml
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: 🧪 Tests / pytest@🐍3.9@windows-2025
  • GitHub Check: 🧪 Tests / pytest@🐍3.13@windows-2025
  • GitHub Check: 🧪 Tests / pytest@🐍3.13@macos-14
  • GitHub Check: 🧪 Tests / pytest@🐍3.12@windows-2025
  • GitHub Check: 🧪 Tests / pytest@🐍3.12@macos-13
  • GitHub Check: 🧪 Tests / pytest@🐍3.11@windows-2025
  • GitHub Check: 🧪 Tests / pytest@🐍3.10@windows-2025
  • GitHub Check: 🧪 Tests / pytest@🐍3.10@macos-13
  • GitHub Check: 🧹 Linters / pre-commit@🐍3.13@ubuntu-latest
  • GitHub Check: pre-commit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR aims to enhance the security posture by pinning pre-commit hooks to immutable SHA revisions. Key changes include updating the hook revisions in .pre-commit-config.yaml to specific commit SHAs and disabling automated pre-commit updates in the Renovate configuration.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.pre-commit-config.yaml Updated hook revisions to SHA with frozen tags representing the intended versions.
.github/renovate.json5 Disabled automated updates for pre-commit hooks to rely on pre-commit.ci freeze.
Comments suppressed due to low confidence (2)

.pre-commit-config.yaml:46

  • The frozen comment indicates v8.27.0, which is a version bump from the previous v8.26.0. Please confirm that this upgrade is intentional and update the documentation if needed.
rev: a248f9279b38aeff5bbd4c85cc6f15b64d27e794  # frozen: v8.27.0

.github/renovate.json5:18

  • Disabling automated pre-commit updates here delegates control to pre-commit.ci freeze. Please ensure this aligns with the overall dependency update strategy.
"pre-commit": {

@MaxymVlasov MaxymVlasov marked this pull request as draft June 5, 2025 18:15
yermulnik
yermulnik previously approved these changes Jun 5, 2025
@MaxymVlasov MaxymVlasov marked this pull request as ready for review June 5, 2025 23:17
@MaxymVlasov MaxymVlasov requested a review from yermulnik June 5, 2025 23:17
@MaxymVlasov MaxymVlasov merged commit 9aa7be5 into master Jun 5, 2025
50 checks passed
@MaxymVlasov MaxymVlasov deleted the commot_over_tag branch June 5, 2025 23:22
@antonbabenko
Copy link
Copy Markdown
Owner

This PR is included in version 1.99.2 🎉

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.

4 participants