fix: validate rechargingInfo format to prevent panic#61
Merged
Alonza0314 merged 2 commits intofree5gc:mainfrom Jan 14, 2026
Merged
fix: validate rechargingInfo format to prevent panic#61Alonza0314 merged 2 commits intofree5gc:mainfrom
Alonza0314 merged 2 commits intofree5gc:mainfrom
Conversation
| rechargingInfo := c.Param("rechargingInfo") | ||
| ueIdRatingGroup := strings.Split(rechargingInfo, "_") | ||
|
|
||
| if len(ueIdRatingGroup) < 2 { |
Contributor
There was a problem hiding this comment.
it can't block all the attack.
- Add length check before accessing split result index - Return HTTP 400 Bad Request with ProblemDetails for invalid format - Improve strconv.Atoi error handling to return 400 instead of continuing - Add proper error logging for security monitoring This fixes a Denial of Service vulnerability where malicious input without underscore delimiter would cause index out of range panic. Fixes: free5gc/free5gc#760 Signed-off-by: solar224 <cyc.cs14@nycu.edu.tw>
47f86be to
2c0938e
Compare
- Change route from /recharging/:rechargingInfo to /recharging/:ueId
- Use query parameter ?ratingGroup=N instead of underscore delimiter
- This follows REST best practices and avoids parsing issues
- Fixes potential issues when ueId contains underscores
Breaking change: API clients must update to new format
Old: PUT /recharging/{ueId}_{ratingGroup}
New: PUT /recharging/{ueId}?ratingGroup={ratingGroup}
Contributor
Author
|
@roundspring2003 PTAL |
Contributor
|
@Alonza0314 LGTM |
Contributor
|
@Alonza0314 |
Alonza0314
approved these changes
Jan 14, 2026
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.
@roundspring2003 PTAL
This fixes a Denial of Service vulnerability where malicious input without underscore delimiter would cause index out of range panic.
Fixes: free5gc/free5gc#760