fix: ip_utils -- float in create_mask (Lua 5.1), unsafe fallback IP #3
Labels
No labels
coordination/cross-repo
coordination/needed
effort
large
effort
medium
effort
small
meta/duplicate
meta/planning
meta/wontfix
priority
high
priority
low
priority
medium
session
blocker
session
handover
session
next
status
blocked
status
done
status
in-progress
status
review
status
to-go
type
admin
type
bug
type
config
type
deployment
type
docs
type
enhancement
type
feature
type
handover
type
infrastructure
type
installation
type
maintenance
type
migration
type
research
type
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
DAW/daw-lua-net#3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problems
create_mask uses 2^(31-i) which produces floats in Lua 5.1.
Bitwise operations on floats can give wrong results.
Use integer arithmetic instead.
get_client_ip returns hardcoded "127.0.0.1" as fallback.
If used for IP allowlisting this silently allows localhost
when no IP header is present -- security concern.
Should return nil, err instead.
Fixed as part of the daw-lua-common 2.0.0 migration (DAW/daw-lua-net#6, released as v2.0.0):
helper using integer multiplication)
requires request.remote_addr explicitly and returns nil, err when it is
missing or invalid, with an optional trusted_proxies parameter for
proxy-header handling
Refs: DAW/daw-lua-net#6