Skip to content

Conversation

@wistefan
Copy link

@wistefan wistefan commented Oct 8, 2024

Description

In order to make decisions based on the request body, the OPA-Plugin will also forward the body when configured to do so.

Fixes #11387

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. doc Documentation things enhancement New feature or request labels Oct 8, 2024
@wistefan
Copy link
Author

wistefan commented Nov 6, 2024

Is there anything I can do to get this PR forward?

@github-actions
Copy link

github-actions bot commented Jan 6, 2025

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 4 weeks if no further activity occurs. If you think that's incorrect or this pull request should instead be reviewed, please simply write any comment. Even if closed, you can still revive the PR at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jan 6, 2025
@moonming
Copy link
Member

moonming commented Jan 7, 2025

@wistefan Please synchronize the master code to trigger all CI

@wistefan
Copy link
Author

wistefan commented Jan 7, 2025

@wistefan Please synchronize the master code to trigger all CI

@moonming Thank you for the review, I updated.

@LuciaCabanillasRodriguez

Hello! If I want this new implementation with the request body, what should I do?

@Baoyuantop
Copy link
Contributor

Hi @wistefan, please synchronize the latest master branch code to trigger the test.

@Baoyuantop Baoyuantop moved this to 👀 In review in ⚡️ Apache APISIX Roadmap Mar 28, 2025
@Baoyuantop Baoyuantop moved this from 👀 In review to 🏗 In progress in ⚡️ Apache APISIX Roadmap Mar 28, 2025
@Baoyuantop Baoyuantop moved this from 🏗 In progress to 👀 In review in ⚡️ Apache APISIX Roadmap Mar 28, 2025
@LuciaCabanillasRodriguez

Hi, sorry I will take care as soon as I find time. @LuciaCabanillasRodriguez help would be very welcome, do you have the time to take a look at the test failures?

Hello! I tried to push a file to fix one of the issues, but I received a forbidden message. In any case, I solved it locally by running:

make lint
./utils/reindex t/plugin/opa3.t

@LuciaCabanillasRodriguez
Copy link

LuciaCabanillasRodriguez commented Jun 9, 2025

Regarding the error in t/discovery/consul_dump.t, I see that the test fails because the expected response from Consul isn’t being returned:
got: ''
expected: '{"service_a":[{"host":"127.0.0.1","port":30511,"weight":1}]}'

It seems like either the service_a isn’t being registered properly in Consul during the test, or the endpoint isn’t responding as expected.

As for the other warnings and errors like:
failed to do SSL handshake: certificate verify failed
http_init(): failed to load the configuration: connection refused

These appear to be related to missing services (like Consul or Etcd) or SSL verification issues, but I’m not entirely sure how to fix it with certainty.

@Baoyuantop Baoyuantop removed wait for update wait for the author's response in this issue/PR user responded labels Jun 13, 2025
@LuciaCabanillasRodriguez

Good! I could remove one issue, the other one remains! Any help?? I would need some guidance on how to fix it

@Baoyuantop
Copy link
Contributor

Maybe we can merge the master branch.

@LuciaCabanillasRodriguez

Maybe we can merge the master branch.
Is there any update here?

@@ -46,6 +46,7 @@ The `opa` Plugin can be used to integrate with [Open Policy Agent (OPA)](https:/
| with_route | boolean | False | false | | When set to true, sends information about the current Route. |
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to modify Chinese documents synchronously

Choose a reason for hiding this comment

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

Updated!

| with_route | boolean | False | false | | When set to true, sends information about the current Route. |
| with_service | boolean | False | false | | When set to true, sends information about the current Service. |
| with_consumer | boolean | False | false | | When set to true, sends information about the current Consumer. Note that this may send sensitive information like the API key. Make sure to turn it on only when you are sure it is safe. |
| with_body | boolean | False | false | | When set to true, sends the request body. |
Copy link
Contributor

Choose a reason for hiding this comment

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

The request body may contain sensitive information (passwords, API keys, etc.), so a security warning needs to be added.

Choose a reason for hiding this comment

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

I have just added a security warning

t/plugin/opa3.t Outdated
POST /hello
hello world
--- response_body
hello world
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to verify the body data received by OPA during the test.

Choose a reason for hiding this comment

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

Should I do something?

Copy link
Contributor

Choose a reason for hiding this comment

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

You need to add more tests to verify this scenario.

Choose a reason for hiding this comment

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

Hi @wistefan, could you please take a look? I’m running into some issues with Nginx and would appreciate your help. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @LuciaCabanillasRodriguez, do you need any help with this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Please submit additional fixes to ensure all CI tests pass.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @wistefan, is there still time to deal with these?

Choose a reason for hiding this comment

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

Is there any update here?

Copy link
Contributor

Choose a reason for hiding this comment

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

The author may be unable to continue processing this PR.

Choose a reason for hiding this comment

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

The logs for this run have expired and are no longer available.

@Baoyuantop Baoyuantop added the wait for update wait for the author's response in this issue/PR label Jul 7, 2025
@Baoyuantop Baoyuantop moved this from 👀 In review to 📋 Backlog in ⚡️ Apache APISIX Roadmap Jul 29, 2025
@github-actions
Copy link

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 4 weeks if no further activity occurs. If you think that's incorrect or this pull request should instead be reviewed, please simply write any comment. Even if closed, you can still revive the PR at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.

@github-actions github-actions bot added stale and removed stale labels Nov 15, 2025
Copy link
Contributor

@Baoyuantop Baoyuantop left a comment

Choose a reason for hiding this comment

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

The current integration test is not strict enough.

In ci/pod/opa/with_body.rego, the rule allow { request.method == "POST" } makes the policy allow any POST request, regardless of whether the body is successfully sent or matched. Since all your test cases in t/plugin/opa3.t use POST, they would pass even if the body was missing or corrupted.

To truly verify that the body is being transmitted and parsed correctly by OPA, please update the rego policy to check for a specific value in the body (e.g., input.request.body.hello == "world"), and add a negative test case (e.g., sending `{"hello": "wrong"}) to ensure it gets blocked.

@Baoyuantop Baoyuantop added awaiting review and removed wait for update wait for the author's response in this issue/PR labels Dec 24, 2025
@LuciaCabanillasRodriguez
Copy link

LuciaCabanillasRodriguez commented Jan 28, 2026

Could you please check the 2 failing checks? I think they are not related with opa

@LuciaCabanillasRodriguez

Could you check it? I think the failing checks are not related with opa

@Baoyuantop
Copy link
Contributor

I reran the failed test.

@Sharoek
Copy link

Sharoek commented Feb 12, 2026

Can three people with write access review this, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review doc Documentation things enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: 📋 Backlog

Development

Successfully merging this pull request may close these issues.

feat: As a user, I want to include the request body in the opa-input, so that I can reason about its contents

6 participants