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

[DO NOT MERGE YET] External Auth ~ish #92

Open
wants to merge 72 commits into
base: main
Choose a base branch
from
Open

Conversation

didierofrivia
Copy link
Contributor

@didierofrivia didierofrivia commented Oct 1, 2024

This huge PR addresses part of #58 ... However, all the previous PRs pointing to this branch were thoroughly reviewed (?).

Even if we are only certifying that Rate Limiting works, it's prepared for Auth too. We will close the issue when we provide documentation and deliver it along proper integration tests

List of the main PRs:

Config example

---
extensions:
  limitador:
    type: ratelimit
    endpoint: limitador-cluster
    failureMode: deny
policies:
  - name: rlp-ns-A/rlp-name-A
    hostnames:
      - '*.toystore.com'
      - example.com
    rules:
      - conditions:
          - allOf:
              - selector: request.path
                operator: eq
                value: /admin/toy
              - selector: request.method
                operator: eq
                value: POST
              - selector: request.host
                operator: eq
                value: cars.toystore.com
    actions:
      - extension: limitador
        scope: rlp-ns-A/rlp-name-A
        data:
          - static:
              key: rlp-ns-A/rlp-name-A
              value: "1"
          - selector:
              selector: auth.metadata.username

Verification:

Use the new guide in the README to verify multi-action setup:

make build && make local-setup

Port-forward envoy and watch the logs for all services:

kubectl port-forward --namespace default deployment/envoy 8000:8000
kubectl logs -f deployment/envoy
kubectl logs -f deployment/authorino
kubectl logs -f deployment/limitador

Test the authenticated rate limiting:

curl -H "Host: test.a.multi.com" http://127.0.0.1:8000/get -i
# HTTP/1.1 401 Unauthorized

Alice has 5 requests per 10 seconds:

while :; do curl --write-out '%{http_code}\n' --silent --output /dev/null -H "Authorization: APIKEY IAMALICE" -H "Host: test.a.multi.com" http://127.0.0.1:8000/get | grep -E --color "\b(429)\b|$"; sleep 1; done

Bob has 2 requests per 10 seconds:

while :; do curl --write-out '%{http_code}\n' --silent --output /dev/null -H "Authorization: APIKEY IAMBOB" -H "Host: test.a.multi.com" http://127.0.0.1:8000/get | grep -E --color "\b(429)\b|$"; sleep 1; done

adam-cattermole and others added 30 commits September 16, 2024 16:40
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: dd di cesare <didi@posteo.net>
* Could get confusing with proxy_wasm `Actions`
* Also with plugin configuration `Action`

Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: dd di cesare <didi@posteo.net>
* GrpcMessage type created

Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: dd di cesare <didi@posteo.net>
* Easier to test, mocking fn
* Assigned fn on creation, default hostcall and mock on tests

Signed-off-by: dd di cesare <didi@posteo.net>
* Bonus: Addressed review regarding testing and Fn types

Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
didierofrivia and others added 22 commits September 19, 2024 16:58
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Co-authored-by: dd di cesare <didi@posteo.net>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Signed-off-by: Adam Cattermole <acatterm@redhat.com>
Revert removal of allOf within conditions
* Operations store its status and result in RefCell for interior mut
* OperationDispatcher keeps a Vec of Rc<Operation>, then indexes cloning
  the Rc instead of cloning the entire object.

Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: dd di cesare <didi@posteo.net>
Signed-off-by: dd di cesare <didi@posteo.net>
…-bis

Simplifying Operation state transition and exec of req msg
@didierofrivia didierofrivia added the enhancement New feature or request label Oct 1, 2024
Copy link

gitguardian bot commented Oct 1, 2024

⚠️ GitGuardian has uncovered 4 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
13357796 Triggered Generic High Entropy Secret 40ce002 utils/deploy/authconfig.yaml View secret
13357796 Triggered Generic High Entropy Secret 8dd4c97 utils/deploy/authconfig.yaml View secret
13357796 Triggered Generic High Entropy Secret 91da443 utils/deploy/authconfig.yaml View secret
13357796 Triggered Generic High Entropy Secret 88cb14b utils/deploy/authconfig.yaml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@eguzki
Copy link
Contributor

eguzki commented Oct 1, 2024

Have you considered in squashing commits? Is it worth 72 commits? Up to you.

Following is a sample configuration used by the shim.

```yaml
failureMode: deny
rateLimitPolicies:
extensions:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example is outdated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Ready For Review
Development

Successfully merging this pull request may close these issues.

3 participants