Skip to content

fix(aqua): improve security feature detection#7385

Merged
jdx merged 2 commits intomainfrom
fix/aqua-security-enabled-defaults
Dec 18, 2025
Merged

fix(aqua): improve security feature detection#7385
jdx merged 2 commits intomainfrom
fix/aqua-security-enabled-defaults

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Dec 18, 2025

Summary

  • Default security features (SLSA, cosign, minisign, github_attestations) to enabled when config is present, unless explicitly disabled with enabled: false
  • Check version_overrides for security features, not just the base package - many packages define security features only in version-specific overrides

Before this fix, mise tool aqua:suzuki-shunsuke/ghcp showed Security: [none] even though the package has SLSA, cosign, and checksum configured.

After:

{
  "security": [
    {"type": "checksum", "algorithm": "sha256"},
    {"type": "slsa"},
    {"type": "cosign"}
  ]
}

Test plan

  • Verified mise tool aqua:suzuki-shunsuke/ghcp now shows SLSA, cosign, and checksum
  • Verified mise tool aqua:cli/cli shows checksum and github_attestations

🤖 Generated with Claude Code


Note

Aggregate security features across base package and version_overrides, defaulting to enabled when present; expose version_overrides publicly.

  • Backend (src/backend/aqua.rs):
    • Security feature detection:
      • Aggregate checks across base package and version_overrides.
      • Treat checksum, slsa_provenance, minisign, and github_artifact_attestations (incl. nested cosign) as enabled by default when config exists unless explicitly disabled.
      • Populate details from first available config (e.g., checksum algorithm, attestation signer_workflow, minisign public_key).
  • Registry Types (crates/aqua-registry/src/types.rs):
    • Make AquaPackage.version_overrides public to enable backend access.

Written by Cursor Bugbot for commit d4c4d4f. This will update automatically on new commits. Configure here.

Two fixes for aqua security info:

1. Default security features to enabled when config is present
   (unless explicitly disabled with `enabled: false`). Previously
   used `unwrap_or(false)` which meant features weren't shown
   unless explicitly enabled.

2. Check version_overrides for security features, not just the
   base package. Many packages define security features (like SLSA,
   cosign, checksums) only in version-specific overrides.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copilot AI review requested due to automatic review settings December 18, 2025 14:54
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 improves security feature detection for Aqua packages by checking version-specific overrides in addition to base package configuration, and by defaulting security features to enabled when their configuration is present (unless explicitly set to enabled: false).

Key Changes:

  • Security feature detection now scans both base package and version overrides
  • Default behavior changed from opt-in (enabled: true) to opt-out (enabled: false)
  • Made version_overrides field public to enable this cross-version security feature checking

Reviewed changes

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

File Description
src/backend/aqua.rs Refactored security feature detection to check all package versions and default features to enabled
crates/aqua-registry/src/types.rs Made version_overrides field public to support checking security features across versions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/backend/aqua.rs Outdated
Comment on lines +69 to +70
let all_pkgs: Vec<&AquaPackage> =
std::iter::once(&pkg).chain(pkg.version_overrides.iter()).collect();
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The collection into a Vec is unnecessary since the iterator is only used for reading. Consider removing .collect() and using the iterator directly in the subsequent checks, or storing it as let all_pkgs = std::iter::once(&pkg).chain(pkg.version_overrides.iter()); if you need to reuse it multiple times.

Copilot uses AI. Check for mistakes.
Comment thread src/backend/aqua.rs
Comment on lines +88 to +92
if all_pkgs.iter().any(|p| {
p.github_artifact_attestations
.as_ref()
.is_some_and(|a| a.enabled.unwrap_or(true))
}) {
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The default behavior change from unwrap_or(false) to unwrap_or(true) is a significant semantic shift that could affect existing configurations. This means packages that previously had security features disabled by default will now have them enabled. Consider whether this breaking change aligns with security best practices and user expectations, especially for features that may have performance implications or require additional setup.

Copilot uses AI. Check for mistakes.
Comment thread src/backend/aqua.rs
let algorithm = all_pkgs
.iter()
.filter_map(|p| p.checksum.as_ref())
.find_map(|c| c.algorithm.as_ref().map(|a| a.to_string()));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Metadata extracted from disabled configurations

The code determines if a feature is enabled by checking if ANY configuration has it enabled, but extracts metadata (algorithm, signer_workflow, public_key) from the FIRST configuration that has the field, without filtering by enabled status. If the base package has a disabled config with metadata X and a version override has an enabled config with metadata Y, the displayed metadata will incorrectly show X from the disabled config. The filter_map chain needs to also filter by enabled status before extracting metadata.

Additional Locations (2)

Fix in Cursor Fix in Web

@jdx jdx enabled auto-merge (squash) December 18, 2025 15:02
@github-actions
Copy link
Copy Markdown

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.12.11 x -- echo 21.6 ± 0.7 20.0 27.0 1.00
mise x -- echo 22.2 ± 0.7 20.2 25.6 1.03 ± 0.05

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.12.11 env 21.0 ± 0.6 19.4 22.9 1.00
mise env 21.8 ± 1.1 19.4 39.8 1.04 ± 0.06

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.12.11 hook-env 21.1 ± 0.6 19.7 23.3 1.00
mise hook-env 22.0 ± 0.6 20.1 23.7 1.04 ± 0.04

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.12.11 ls 18.8 ± 0.6 17.3 20.7 1.00
mise ls 19.9 ± 0.8 17.4 24.1 1.06 ± 0.06

xtasks/test/perf

Command mise-2025.12.11 mise Variance
install (cached) 115ms 115ms +0%
ls (cached) 70ms 70ms +0%
bin-paths (cached) 76ms 77ms -1%
task-ls (cached) 293ms ⚠️ 2274ms -87%

⚠️ Warning: task-ls cached performance variance is -87%

@jdx jdx merged commit b9093f4 into main Dec 18, 2025
26 checks passed
@jdx jdx deleted the fix/aqua-security-enabled-defaults branch December 18, 2025 15:35
jekis913 added a commit to jekis913/mise that referenced this pull request Dec 19, 2025
* upstream/main:
  feat(backend): add version timestamps for spm, conda, and gem backends (jdx#7383)
  fix(aqua): improve security feature detection (jdx#7385)
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.

3 participants