Skip to content

Conversation

@abhupadh
Copy link
Collaborator

@abhupadh abhupadh commented Jun 23, 2022

Description

  • adds new module events_webhook which has the I/O Events webhook signature verification method

Related Issues

Motivation and Context

Helps I/O Events Customers to setup their webhook verification using this sdk feature.

How Has This Been Tested?

Has the test EventVerifierTest which tests the api for verifying signature.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

@francoisledroff
Copy link
Collaborator

@abhupadh thanks for the PR.
Let's make this simpler, let's get rid of the retrofit and caffeine dependencies.
we could implement in-memory cache with just a hash map.
for http related activites, please use either the plain java sdk (https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/package-summary.html) or eventually openFeign as it is already a dependency of this sdk.

@abhupadh
Copy link
Collaborator Author

okay, will make the changes

Copy link
Collaborator

@francoisledroff francoisledroff left a comment

Choose a reason for hiding this comment

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

Could we get rid of the caffeine dependency ?
and use a Hashmap instead if you strongly feel there is a need for a cache ?
could you also push your change your PR an push to a main remote https://github.com/adobe/aio-lib-java repo branch so the integration test can be ran ?

@abhupadh
Copy link
Collaborator Author

abhupadh commented Sep 2, 2022

Could we get rid of the caffeine dependency ? and use a Hashmap instead if you strongly feel there is a need for a cache ? could you also push your change your PR an push to a main remote https://github.com/adobe/aio-lib-java repo branch so the integration test can be ran ?

Yes, I removed the caffeine dependency and used a hashmap instead. Also, removed the retrofit with open feign. Check my latest commits. I have these tests failing which I need to fix. So, for that I think you mentioned to push this change to main branch?

@francoisledroff
Copy link
Collaborator

Could we get rid of the caffeine dependency ? and use a Hashmap instead if you strongly feel there is a need for a cache ? could you also push your change your PR an push to a main remote https://github.com/adobe/aio-lib-java repo branch so the integration test can be ran ?

Yes, I removed the caffeine dependency and used a hashmap instead. Also, removed the retrofit with open feign. Check my latest commits. I have these tests failing which I need to fix. So, for that I think you mentioned to push this change to main branch?

I guess you forgot to push, I still see caffeine Utils and dependencies ...
yes to be able to run the integration test you will need to have the PR branch pushed to this origin repo

@francoisledroff
Copy link
Collaborator

francoisledroff commented Sep 15, 2022

I submitted a PR against your branch abhupadh#1 showing you the way
please continue, polishing it and fixing the unit test

@francoisledroff francoisledroff changed the title event_webhook module for webhook sign verification GH-125 event_webhook module for webhook sign verification Nov 22, 2022

@Service
public class EventVerifier {

Copy link
Collaborator Author

@abhupadh abhupadh Dec 2, 2022

Choose a reason for hiding this comment

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

@Service / component annotation is required so that it can be auto injected in eg-auditor's -> EventServiceImpl as here in this PR

Copy link
Member

Choose a reason for hiding this comment

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

If this is the only reason that we need a @service/ @component annotation, I don't see it as a compelling reason to include the Spring framework dependency.
Why can't we simply create an instance of EventVerifier in eg-auditor?

@abhupadh
Copy link
Collaborator Author

abhupadh commented Dec 2, 2022

@francoisledroff : the integration tests are failing for the ims module. not sure why, as no changes are made there in this PR

@francoisledroff
Copy link
Collaborator

francoisledroff commented Dec 5, 2022

please use the PR I did against your branch see abhupadh#1
showing you the way, please continue, polishing it and fixing the unit test ...
Let's not have any spring dependency, nor cache,
IMHO it's up to the customer to decide how to implement cache and whether or not to use spring ....

@abhupadh
Copy link
Collaborator Author

abhupadh commented Dec 5, 2022

This is not only used by customers but our own eg-auditor as well.


<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
Copy link
Collaborator

Choose a reason for hiding this comment

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

we need to remove this

<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
</dependency>

Copy link
Collaborator

Choose a reason for hiding this comment

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

let's revert this unnecessary change of core/pom.xml


}

public EventVerifier() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

your current implementation is forcing the use of your cache .
I would rather just see in this PR just a fully reusable public static method that helps you verify the signature.
as documented here https://developer.adobe.com/events/docs/guides/#security-considerations

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public interface CacheService {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would really like to get rid of this cache.
our customer can easily use any cache service/framework they want.
this PR should only be about showing how to validate the message headers' signature and no more

<artifactId>feign-form</artifactId>
<version>${feign-form.version}</version>
</dependency>
<dependency>
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's remove these unwanted spring and findbugs dependencies

@abhupadh
Copy link
Collaborator Author

closing in favor of this enhanced PR #144

@francoisledroff
Copy link
Collaborator

closing this as it was replaced by #144

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants