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

WIP adding security resource sharing SPI and sample-extension-plugin #26

Open
wants to merge 86 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
9b4492b
WIP adding security resource sharing SPI and sample-extension-plugin
cwperks Aug 7, 2024
3fd702d
Also assert sample extension
cwperks Aug 7, 2024
69f6105
WIP on add create resource handler
cwperks Aug 7, 2024
c850f1d
WIP on Create Resource Transport action
cwperks Aug 8, 2024
334504b
Create index
cwperks Aug 8, 2024
cf52800
Example of usage of why threadContext.stashContext is needed
cwperks Aug 8, 2024
36455cc
Implement create resource
cwperks Aug 13, 2024
04232ff
Create SampleResource
cwperks Aug 14, 2024
a0e0386
Add list resource
cwperks Aug 14, 2024
2610ed0
Create Abstract resource
cwperks Aug 15, 2024
487e468
Remove cast
cwperks Aug 15, 2024
3361e93
Create abstract transport action
cwperks Aug 15, 2024
e14532f
Create ResourceSharingUtils
cwperks Aug 15, 2024
c0c8db1
Create .resource-sharing index
cwperks Aug 15, 2024
efb6937
Initialize ResourceSharingUtils
cwperks Aug 15, 2024
5cf0315
Create .resource-sharing entry
cwperks Aug 16, 2024
fb23e6b
Truly singleton
cwperks Aug 16, 2024
233f399
IndexOperationListener
cwperks Aug 16, 2024
7c44fac
WIP
cwperks Aug 19, 2024
60c735d
Merge branch 'main' into resource-sharing
cwperks Sep 20, 2024
db678cc
Fix build issues
cwperks Sep 20, 2024
b1ec493
Merge branch 'main' into resource-sharing
cwperks Oct 14, 2024
a57d283
WIP on ResourceSharingListener
cwperks Oct 14, 2024
56b0c36
Test create with 2 different users
cwperks Oct 14, 2024
90daa18
Add resourceUser to ResourceSharingEntry
cwperks Oct 14, 2024
e94cb68
WIP on ResourceSharingService and create default impl
cwperks Oct 15, 2024
8057cba
WIP on SecurityResourceSharingService
cwperks Oct 15, 2024
9577c32
WIP on list shared with resources
cwperks Oct 15, 2024
9dde4a6
Use mget in SecurityResourceSharingService to list all resources shar…
cwperks Oct 15, 2024
ff38103
WIP on update sharing endpoint
cwperks Oct 16, 2024
8779c8a
WIP on update sharing endpoint
cwperks Oct 16, 2024
c7dcef6
Demonstrate update sharing and re-run list after sharing info was upd…
cwperks Oct 16, 2024
37b197c
WIP on integ test
cwperks Oct 18, 2024
37ad3aa
Get integrationTest to run for sample plugin
cwperks Oct 22, 2024
c141a6f
Add integration test to verify plugin installed
cwperks Oct 22, 2024
37b0325
Merge branch 'resource-sharing-integ-test' into resource-sharing
cwperks Oct 22, 2024
87d9472
Simplify for merge
cwperks Nov 15, 2024
8802c60
Merge branch 'main' into resource-sharing
cwperks Nov 15, 2024
879afa7
Rebase with latest from main
cwperks Nov 15, 2024
631c031
Exclude bytebuddy
cwperks Nov 15, 2024
e361091
Limit dependencies
cwperks Nov 15, 2024
3cf01d9
Only assemble root project
cwperks Nov 15, 2024
ebeb92a
root project assemble
cwperks Nov 15, 2024
328b749
Only on root project
cwperks Nov 15, 2024
65190a1
uncomment
cwperks Dec 2, 2024
6772be8
Merge branch 'main' into resource-sharing
cwperks Dec 2, 2024
c01157d
Merge with main
cwperks Dec 2, 2024
25e946d
Add allowed_actions to share with entry
cwperks Dec 11, 2024
586d26c
Create UpdateResourceAction
cwperks Dec 12, 2024
fd49157
Return resourceId in created response
cwperks Dec 12, 2024
47a1921
Add integ tests where user creates a sample resource and updates it
cwperks Dec 12, 2024
f091617
Separate package
cwperks Dec 12, 2024
285dbbf
reorg
cwperks Dec 12, 2024
d015aa0
reorg
cwperks Dec 12, 2024
0d8eeed
Add Get action
cwperks Dec 12, 2024
d062a98
only instantiate if needed
cwperks Dec 12, 2024
99348d7
Implement get resource
cwperks Dec 12, 2024
d8f0f8a
Use provider pattern
cwperks Dec 13, 2024
c266a17
Use ResourceFactory pattern
cwperks Dec 13, 2024
a1e80b8
Use default constructor
cwperks Dec 13, 2024
b4aa892
Remove abstract sharing service
cwperks Dec 13, 2024
a3bd41d
WIP on secure get resource
cwperks Dec 13, 2024
20c24d0
WIP on securing get resource, integrationTest not using correct resou…
cwperks Dec 13, 2024
e676819
Enforce security on get resource
cwperks Dec 16, 2024
c33d42a
Reverse the order
cwperks Dec 16, 2024
4a0a8c3
Use action group
cwperks Dec 17, 2024
ff030cb
Create re-usable ActionRequest for ResourceRequests and create re-usa…
cwperks Dec 17, 2024
003b257
Remove now redundant classes
cwperks Dec 17, 2024
e25d28f
Reorganize
cwperks Dec 17, 2024
291d33d
WIP on general resource sharing rest action
cwperks Dec 17, 2024
2593663
WIP on share with rest action from security plugin
cwperks Dec 17, 2024
981446a
Use constructor directly
cwperks Dec 17, 2024
c9cf55f
Add ShareWithAction to security plugin
cwperks Dec 17, 2024
c00e1d0
Remove allowed_actions
cwperks Dec 20, 2024
7c90e88
Remove allowed_actions from sharing endpoint
cwperks Dec 22, 2024
0d7c1c5
Move security specific classes out of spi
cwperks Dec 23, 2024
d7cf362
Add ResourceParser
cwperks Dec 23, 2024
e280cf2
Simplify ResourceSharingService
cwperks Dec 23, 2024
e055847
Rename to isSharedWithCurrentUser
cwperks Dec 23, 2024
b1c02dd
Rename listener
cwperks Dec 23, 2024
cae65db
Briefly uncomment
cwperks Dec 30, 2024
c0afc37
Merge branch 'main' into resource-sharing
cwperks Dec 30, 2024
e066f6a
sync with main
cwperks Dec 30, 2024
1c51afd
Handle case where resource sharing service is null
cwperks Dec 30, 2024
c576870
Default resource parser
cwperks Dec 31, 2024
d642582
Rename to SharableResource
cwperks Jan 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/create-bwc-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ runs:
uses: gradle/gradle-build-action@v2
with:
cache-disabled: true
arguments: assemble
arguments: :assemble
build-root-directory: ${{ inputs.plugin-branch }}

- id: get-opensearch-version
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
with:
cache-disabled: true
arguments: |
integrationTest -Dbuild.snapshot=false --tests org.opensearch.security.ResourceFocusedTests
:integrationTest -Dbuild.snapshot=false --tests org.opensearch.security.ResourceFocusedTests

backward-compatibility-build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -208,7 +208,7 @@ jobs:
- uses: github/codeql-action/init@v3
with:
languages: java
- run: ./gradlew clean assemble
- run: ./gradlew clean :assemble
- uses: github/codeql-action/analyze@v3

build-artifact-names:
Expand Down Expand Up @@ -238,13 +238,13 @@ jobs:
echo ${{ env.SECURITY_PLUGIN_VERSION_ONLY_NUMBER }}
echo ${{ env.TEST_QUALIFIER }}

- run: ./gradlew clean assemble && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION }}.zip
- run: ./gradlew clean :assemble && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION }}.zip

- run: ./gradlew clean assemble -Dbuild.snapshot=false && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION_NO_SNAPSHOT }}.zip
- run: ./gradlew clean :assemble -Dbuild.snapshot=false && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION_NO_SNAPSHOT }}.zip

- run: ./gradlew clean assemble -Dbuild.snapshot=false -Dbuild.version_qualifier=${{ env.TEST_QUALIFIER }} && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION_ONLY_NUMBER }}-${{ env.TEST_QUALIFIER }}.zip
- run: ./gradlew clean :assemble -Dbuild.snapshot=false -Dbuild.version_qualifier=${{ env.TEST_QUALIFIER }} && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION_ONLY_NUMBER }}-${{ env.TEST_QUALIFIER }}.zip

- run: ./gradlew clean assemble -Dbuild.version_qualifier=${{ env.TEST_QUALIFIER }} && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION_ONLY_NUMBER }}-${{ env.TEST_QUALIFIER }}-SNAPSHOT.zip
- run: ./gradlew clean :assemble -Dbuild.version_qualifier=${{ env.TEST_QUALIFIER }} && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION_ONLY_NUMBER }}-${{ env.TEST_QUALIFIER }}-SNAPSHOT.zip

- run: ./gradlew clean publishPluginZipPublicationToZipStagingRepository && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION }}.zip && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION }}.pom

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/plugin_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: gradle/gradle-build-action@v3
with:
cache-disabled: true
arguments: assemble
arguments: :assemble

# Move and rename the plugin for installation
- name: Move and rename the plugin for installation
Expand Down
83 changes: 60 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ tasks.integrationTest.finalizedBy(jacocoTestReport) // report is always generate
check.dependsOn integrationTest

dependencies {
implementation project(path: ":${rootProject.name}-spi", configuration: 'shadow')
implementation "org.opensearch.plugin:transport-netty4-client:${opensearch_version}"
implementation "org.opensearch.client:opensearch-rest-high-level-client:${opensearch_version}"
implementation "org.apache.httpcomponents.client5:httpclient5-cache:${versions.httpclient5}"
Expand Down Expand Up @@ -724,36 +725,72 @@ dependencies {
compileOnly "org.opensearch:opensearch:${opensearch_version}"

//integration test framework:
integrationTestImplementation('com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.8.2') {
exclude(group: 'junit', module: 'junit')
}
integrationTestImplementation 'junit:junit:4.13.2'
integrationTestImplementation "org.opensearch.plugin:reindex-client:${opensearch_version}"
integrationTestImplementation "org.opensearch.plugin:percolator-client:${opensearch_version}"
integrationTestImplementation 'commons-io:commons-io:2.18.0'
integrationTestImplementation "org.apache.logging.log4j:log4j-core:${versions.log4j}"
integrationTestImplementation "org.apache.logging.log4j:log4j-jul:${versions.log4j}"
integrationTestImplementation 'org.hamcrest:hamcrest:2.2'
integrationTestImplementation "org.bouncycastle:bcpkix-jdk18on:${versions.bouncycastle}"
integrationTestImplementation "org.bouncycastle:bcutil-jdk18on:${versions.bouncycastle}"
integrationTestImplementation('org.awaitility:awaitility:4.2.2') {
exclude(group: 'org.hamcrest', module: 'hamcrest')
}
integrationTestImplementation 'com.unboundid:unboundid-ldapsdk:4.0.14'
integrationTestImplementation "org.opensearch.plugin:mapper-size:${opensearch_version}"
integrationTestImplementation "org.apache.httpcomponents:httpclient-cache:4.5.14"
integrationTestImplementation "org.apache.httpcomponents:httpclient:4.5.14"
integrationTestImplementation "org.apache.httpcomponents:fluent-hc:4.5.14"
integrationTestImplementation "org.apache.httpcomponents:httpcore:4.4.16"
integrationTestImplementation "org.apache.httpcomponents:httpasyncclient:4.1.5"
integrationTestImplementation "org.mockito:mockito-core:5.14.2"
// integrationTestImplementation('com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.8.2') {
// exclude(group: 'junit', module: 'junit')
// }
// integrationTestImplementation 'junit:junit:4.13.2'
// integrationTestImplementation "org.opensearch.plugin:reindex-client:${opensearch_version}"
// integrationTestImplementation "org.opensearch.plugin:percolator-client:${opensearch_version}"
// integrationTestImplementation 'commons-io:commons-io:2.18.0'
// integrationTestImplementation "org.apache.logging.log4j:log4j-core:${versions.log4j}"
// integrationTestImplementation "org.apache.logging.log4j:log4j-jul:${versions.log4j}"
// integrationTestImplementation 'org.hamcrest:hamcrest:2.2'
// integrationTestImplementation "org.bouncycastle:bcpkix-jdk18on:${versions.bouncycastle}"
// integrationTestImplementation "org.bouncycastle:bcutil-jdk18on:${versions.bouncycastle}"
// integrationTestImplementation('org.awaitility:awaitility:4.2.2') {
// exclude(group: 'org.hamcrest', module: 'hamcrest')
// }
// integrationTestImplementation 'com.unboundid:unboundid-ldapsdk:4.0.14'
// integrationTestImplementation "org.opensearch.plugin:mapper-size:${opensearch_version}"
// integrationTestImplementation "org.apache.httpcomponents:httpclient-cache:4.5.14"
// integrationTestImplementation "org.apache.httpcomponents:httpclient:4.5.14"
// integrationTestImplementation "org.apache.httpcomponents:fluent-hc:4.5.14"
// integrationTestImplementation "org.apache.httpcomponents:httpcore:4.4.16"
// integrationTestImplementation "org.apache.httpcomponents:httpasyncclient:4.1.5"
// integrationTestImplementation "org.mockito:mockito-core:5.14.2"

//spotless
implementation('com.google.googlejavaformat:google-java-format:1.25.2') {
exclude group: 'com.google.guava'
}
}

allprojects {
configurations {
integrationTestImplementation.extendsFrom implementation
integrationTestRuntimeOnly.extendsFrom runtimeOnly
}
dependencies {
//integration test framework:
integrationTestImplementation('com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.8.2') {
exclude(group: 'junit', module: 'junit')
}
integrationTestImplementation 'junit:junit:4.13.2'
integrationTestImplementation "org.opensearch.plugin:reindex-client:${opensearch_version}"
integrationTestImplementation "org.opensearch.plugin:percolator-client:${opensearch_version}"
integrationTestImplementation 'commons-io:commons-io:2.18.0'
integrationTestImplementation "org.apache.logging.log4j:log4j-core:${versions.log4j}"
integrationTestImplementation "org.apache.logging.log4j:log4j-jul:${versions.log4j}"
integrationTestImplementation 'org.hamcrest:hamcrest:2.2'
integrationTestImplementation "org.bouncycastle:bcpkix-jdk18on:${versions.bouncycastle}"
integrationTestImplementation "org.bouncycastle:bcutil-jdk18on:${versions.bouncycastle}"
integrationTestImplementation('org.awaitility:awaitility:4.2.2') {
exclude(group: 'org.hamcrest', module: 'hamcrest')
}
integrationTestImplementation 'com.unboundid:unboundid-ldapsdk:4.0.14'
integrationTestImplementation "org.opensearch.plugin:mapper-size:${opensearch_version}"
integrationTestImplementation "org.apache.httpcomponents:httpclient-cache:4.5.14"
integrationTestImplementation "org.apache.httpcomponents:httpclient:4.5.14"
integrationTestImplementation "org.apache.httpcomponents:fluent-hc:4.5.14"
integrationTestImplementation "org.apache.httpcomponents:httpcore:4.4.16"
integrationTestImplementation "org.apache.httpcomponents:httpasyncclient:4.1.5"
integrationTestImplementation("org.mockito:mockito-core:5.14.2") {
exclude(group: 'net.bytebuddy', module: 'byte-buddy')
}
integrationTestImplementation "net.bytebuddy:byte-buddy:${versions.bytebuddy}"
}
}

jar {
libsDirName = '.'
into '', {
Expand Down
24 changes: 12 additions & 12 deletions checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@
</module>

<!-- System.out.println -->
<module name="RegexpSinglelineJava">
<property name="format" value="System.out.println"/>
<property name="ignoreCase" value="true"/>
<property name="message" value="Do not use System.out.println" />
<property name="severity" value="error"/>
</module>
<!-- <module name="RegexpSinglelineJava">-->
<!-- <property name="format" value="System.out.println"/>-->
<!-- <property name="ignoreCase" value="true"/>-->
<!-- <property name="message" value="Do not use System.out.println" />-->
<!-- <property name="severity" value="error"/>-->
<!-- </module>-->

</module>

Expand All @@ -228,12 +228,12 @@
<property name="severity" value="error"/>
</module>

<module name="RegexpSingleline">
<property name="format" value="extension"/>
<property name="ignoreCase" value="true"/>
<property name="message" value="Extension should only be used sparingly to keep implementations as generic as possible" />
<property name="severity" value="error"/>
</module>
<!-- <module name="RegexpSingleline">-->
<!-- <property name="format" value="extension"/>-->
<!-- <property name="ignoreCase" value="true"/>-->
<!-- <property name="message" value="Extension should only be used sparingly to keep implementations as generic as possible" />-->
<!-- <property name="severity" value="error"/>-->
<!-- </module>-->

<module name="SuppressWithPlainTextCommentFilter">
<property name="offCommentFormat" value="CS-SUPPRESS-ALL: .+"/> <!-- Require an explaination after surpressing -->
Expand Down
Loading
Loading