Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

advanced configuration for IP/CIDR allow-listing #6

Closed
dillonstreator opened this issue Dec 18, 2024 · 0 comments · Fixed by #9
Closed

advanced configuration for IP/CIDR allow-listing #6

dillonstreator opened this issue Dec 18, 2024 · 0 comments · Fixed by #9
Labels

Comments

@dillonstreator
Copy link
Contributor

dillonstreator commented Dec 18, 2024

Enable users to optionally configure an allow list of ip addresses or range(s) that can access the secret in the create form.

Unless a more generalized locking mechanism is employed, the check must happen within the redis lua script to maintain the burn after read contract regarding 1 recipient guarantee. If there is not an easy way to perform the comparison of an ip address against an ip range / CIDR, a more generalized locking mechanism may be required. Distributed mutual exclusion is important to the contract specifications of the system so we must opt for the highest consistency and fault tolerance guarantee, regardless of performance tradeoffs. https://www.perplexity.ai/search/is-redlock-a-guaranteed-mutual-tiRw1r.6RTKhMrp17gJkZg

const result = (await redis.eval(
// https://redis.io/docs/latest/develop/interact/programmability/lua-api/
// https://redis.io/docs/latest/develop/interact/programmability/lua-api/#cjson-library
`
local value = redis.call('get', KEYS[1])
if not value then

An alternate simplified approach here would be to execute a separate lua script that extracts just the ip range (if one exists) and compares against the incoming request ip address in server memory prior to the primary lua script being executed. This keeps the system guarantees without the need to introduce a more generalized locking pattern.

Apply validation to the ip address list.
Add configuration for max allowed list size with some sane default.

https://zod.dev/?id=ip-addresses
https://zod.dev/?id=ip-ranges-cidr

Related: #14

@dillonstreator dillonstreator changed the title Add optional advanced configuration for ip allow/deny-listing advanced configuration for ip allow/deny-listing Dec 18, 2024
@dillonstreator dillonstreator changed the title advanced configuration for ip allow/deny-listing advanced configuration for IP/CIDR allow-listing Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant