Skip to content

Commit c79452a

Browse files
authored
Merge branch 'opensearch-project:main' into main
2 parents 52c212b + 5fec579 commit c79452a

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

docs/plugin_development.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,7 @@ The Maven artifacts will then be available in your local Maven repository. In st
9191
they will be available at `${USER}/.m2/repository/org/opensearch/dataprepper/`.
9292

9393
Be sure to enable `mavenLocal()` as a repository in your plugin's build project.
94+
95+
## Other documentation for plugin developers
96+
97+
* [Security requirements for push-based sources](security_push.md)

docs/security_push.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Security requirements for push-based sources
2+
3+
Data Prepper supports push-based sources which open networking ports.
4+
This page documents security requirements for creating these sources.
5+
6+
### Framework
7+
8+
For consistency, push-based sources should use Armeria.
9+
10+
Additionally, they should use code for common server creation.
11+
For example, using the [CreateServer](https://github.com/opensearch-project/data-prepper/blob/main/data-prepper-plugins/http-common/src/main/java/org/opensearch/dataprepper/plugins/server/CreateServer.java)
12+
class to create a server.
13+
14+
### Authentication
15+
16+
Push-based sources mush use the existing authentication plugins for Armeria.
17+
18+
* [ArmeriaHttpAuthenticationProvider](https://github.com/opensearch-project/data-prepper/blob/main/data-prepper-plugins/armeria-common/src/main/java/org/opensearch/dataprepper/armeria/authentication/ArmeriaHttpAuthenticationProvider.java)
19+
* [GrpcAuthenticationProvider](https://github.com/opensearch-project/data-prepper/blob/main/data-prepper-plugins/armeria-common/src/main/java/org/opensearch/dataprepper/armeria/authentication/GrpcAuthenticationProvider.java)
20+
21+
### SSL
22+
23+
Endpoints must enable SSL by default. They should log a warning if SSL is disabled.
24+
25+
### Testing
26+
27+
All push-based sources must include automated tests for:
28+
29+
* **Unauthenticated Access**: Verify that requests without credentials are rejected with HTTP 401
30+
* **Unauthorized Access**: Verify that requests with valid credentials but insufficient permissions are rejected with HTTP 403
31+
* **Authenticated Access**: Verify that properly authenticated requests succeed
32+
33+
Additionally, the test must cover both gRPC and HTTP access.
34+
35+
Some examples:
36+
37+
* [`http` source](https://github.com/opensearch-project/data-prepper/blob/main/data-prepper-plugins/http-source/src/test/java/org/opensearch/dataprepper/plugins/source/loghttp/HTTPSourceTest.java)
38+
* [`otlp` source](https://github.com/opensearch-project/data-prepper/blob/5ad289dd00cfaa73509c7b0fdb757b73d0f18a0c/data-prepper-plugins/otlp-source/src/test/java/org/opensearch/dataprepper/plugins/source/otlp/OTLPSourceTest.java)
39+
40+
## Push request security checklist
41+
42+
All pull requests for push-based sources should include evaluation against this checklist.
43+
44+
* [ ] Does this PR add or modify an HTTP endpoint?
45+
* [ ] Is the source using an existing web framework within Data Prepper? If not, why not?
46+
* [ ] Does the source support Data Prepper authentication plugins?
47+
* [ ] Are there tests for unauthenticated access rejection?
48+
* [ ] Are there tests for unauthorized access rejection?
49+
* [ ] Are there tests for authenticated access?
50+
* [ ] Do the tests cover all supported protocols (e.g. HTTP and gRPC)?

0 commit comments

Comments
 (0)