Skip to content

Conversation

abiosoft
Copy link
Owner

@abiosoft abiosoft commented Aug 2, 2025

Potential fix for https://github.com/abiosoft/colima/security/code-scanning/7

To fix the problem, we should ensure that the value parsed from stats[1] is within the valid range for fs.FileMode (i.e., between 0 and math.MaxUint32) before converting it. We should also handle errors from strconv.Atoi to avoid using invalid values. The best way to do this is to use strconv.ParseUint with a bit size of 32, which will only succeed for valid, non-negative values within the range of a uint32. If parsing fails or the value is out of bounds, we should return an error or a default value. The changes are needed in the anonymous function assigned to info.mode in the newFileInfo function (lines 60-63). We also need to import the math package for the constant math.MaxUint32.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…n integer types

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@abiosoft abiosoft marked this pull request as ready for review August 2, 2025 21:38
@abiosoft abiosoft merged commit 7c671f5 into main Aug 2, 2025
14 checks passed
@abiosoft abiosoft deleted the alert-autofix-7 branch August 2, 2025 21:44
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Aug 6, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [abiosoft/colima](https://github.com/abiosoft/colima) | patch | `v0.8.2` -> `v0.8.3` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>abiosoft/colima (abiosoft/colima)</summary>

### [`v0.8.3`](https://github.com/abiosoft/colima/releases/tag/v0.8.3)

[Compare Source](abiosoft/colima@v0.8.2...v0.8.3)

#### Highlights

This is an hotfix release to address a regression that causes `exec /bin/sh: exec format error` when running a cross-architecture image.

#### Fixes

- Fix exec format error when running a cross-architecture image. Requires recreating instance if created with v0.8.2. Fixes [#&#8203;1367](abiosoft/colima#1367).
- Set default volume mount type to `virtiofs` when VZ is in use.

#### Other Updates

- Use containerd image store for Docker
- Mount containerd socket for Docker and Containerd runtimes
- Mount buildkitd socket for Containerd runtime.
- Add mounted socket path(s) to the output of `colima status` for all container runtimes.
- Allow overriding default k3s flags with `--k3s-arg` flag.

#### Commits

- Potential fix for code scanning alert no. 7: Incorrect conversion between integer types by [@&#8203;abiosoft](https://github.com/abiosoft) in abiosoft/colima#1357
- containerd: expose containerd and buildkit sockets by [@&#8203;abiosoft](https://github.com/abiosoft) in abiosoft/colima#1358
- cli: set default mount type to virtiofs for vz by [@&#8203;abiosoft](https://github.com/abiosoft) in abiosoft/colima#1359
- Docker improvements by [@&#8203;abiosoft](https://github.com/abiosoft) in abiosoft/colima#1360
- k3s: allow overriding default k3s args by [@&#8203;Nevon](https://github.com/Nevon) in abiosoft/colima#1365
- core: update disk images by [@&#8203;abiosoft](https://github.com/abiosoft) in abiosoft/colima#1368

#### New Contributors

- [@&#8203;Nevon](https://github.com/Nevon) made their first contribution in abiosoft/colima#1365

**Full Changelog**: abiosoft/colima@v0.8.2...v0.8.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS41Mi4yIiwidXBkYXRlZEluVmVyIjoiNDEuNTIuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
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.

1 participant