codeigniter4 / codeigniter4/shield

Dev: Add IP Restriction for Access Token and HMAC in Shield

Aperta
#1,255 1 commento 1 reazione 0 assegnatari Vedi su GitHub
dev enhancement
Lingua principale
PHP
Stelle
427
Fork
144
Merge medio
9h 19m
PR unite (30g)
6

Descrizione

**Why?**

If a token or HMAC key is leaked, it can only be used from specified IP addresses(Enhanced Security).
Requests from unknown IPs will be rejected(Prevents Unauthorized Access).
Many financial and payment services use this method(Industry Standard for Sensitive APIs).

**Demo:**

![Image](https://github.com/user-attachments/assets/42926823-cf31-4941-844a-e756d1c92a49)

1. Store `allowed_ips` in the **extra** field (as JSON) or add a dedicated `allowed_ips` column to **auth_identities**
2. Store allowed IPs when generating a token
3. Validate IP when using a token
4. Allow enabling/disabling this feature in **Config/AuthToken.php**
5. Support for multi IPs

**If you disagree or have suggestions for improvement, feel free to comment.**

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.