Skip to content

Potential fix for code scanning alert no. 52: Incorrect conversion between integer types#782

Merged
marle3003 merged 3 commits intomainfrom
alert-autofix-52
Dec 15, 2025
Merged

Potential fix for code scanning alert no. 52: Incorrect conversion between integer types#782
marle3003 merged 3 commits intomainfrom
alert-autofix-52

Conversation

@marle3003
Copy link
Copy Markdown
Owner

Potential fix for https://github.com/marle3003/mokapi/security/code-scanning/52

To fix this issue, ensure that authId is within the valid range for a byte (0–255) before the conversion is performed. If not, return an error with a useful message. The change should be made in sidToBytes in providers/directory/search.go, specifically on and around lines 572–576. Importantly, we should insert the check immediately after parsing the value from the string, before casting to byte and appending to result. No other functionality should be changed. No new imports are needed, as constants for min/max are well known.


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

…tween integer types

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.88%. Comparing base (0bd50c0) to head (1c8daf8).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #782      +/-   ##
==========================================
- Coverage   70.91%   70.88%   -0.04%     
==========================================
  Files         457      457              
  Lines       41296    41302       +6     
==========================================
- Hits        29285    29275      -10     
- Misses       9851     9863      +12     
- Partials     2160     2164       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@marle3003 marle3003 marked this pull request as ready for review December 15, 2025 11:43
@marle3003 marle3003 merged commit 539168e into main Dec 15, 2025
10 of 11 checks passed
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