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

[FLINK-32176] Exclude snakeyaml from pulsar-client-all to mitigate CVE-2022-1471 #51

Closed
wants to merge 2 commits into from

Conversation

Samrat002
Copy link

@Samrat002 Samrat002 commented May 26, 2023

Purpose of the change

Mitigate the imapact of CVE in flink

Brief change log

Exclude snakeyaml from pulsar-client-all

Verifying this change

Significant changes

No significant changes

(Please check any boxes [x] if the answer is "yes". You can first publish the PR and check them afterwards, for
convenience.)

  • Dependencies have been added or upgraded
  • Public API has been changed (Public API is any class annotated with @Public(Evolving))
  • Serializers have been changed
  • New feature has been introduced
    • If yes, how is this documented? (not applicable / docs / JavaDocs / not documented)

@Samrat002 Samrat002 changed the title [FLINK-32176] Exclude snakeyaml from pulsar-client-all [FLINK-32176] Exclude snakeyaml from pulsar-client-all to mitigate CVE-2022-1471 May 27, 2023
@Samrat002
Copy link
Author

Samrat002 commented May 31, 2023

Can anyone Please help review the changes

@MartijnVisser MartijnVisser requested a review from tisonkun June 5, 2023 13:19
Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

IIRC CVE-2022-1471 is argued to be a false positive https://bitbucket.org/snakeyaml/snakeyaml/issues/561/cve-2022-1471-vulnerability-in.

You may suppress the warning instead of eagerly excluding libs.

I can see that this dependency is explicit included in pulsar-client-all:

<include>org.yaml:snakeyaml</include>

apache/pulsar#3662

May you provide evidence that "excluding snakeyaml doesn't effect the client usage in flink-connector-pulsar"?

If it should not be in the fat jar at all, you can submit a PR to Pulsar upstream and we reduce this dependency by upgrade pulsar version.

Copy link
Contributor

@syhily syhily left a comment

Choose a reason for hiding this comment

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

I don't think this PR fixes the CVE issues in pulsar-client-all.

@@ -81,6 +81,13 @@ under the License.
<dependency>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-client-all</artifactId>
<exclusions>
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need this exclusion.

flink-sql-connector-pulsar/pom.xml Outdated Show resolved Hide resolved
@@ -181,6 +181,10 @@ under the License.
<artifactId>pulsar-client-all</artifactId>
<version>${pulsar.version}</version>
<exclusions>
<exclusion>
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need this exclusion.

@syhily
Copy link
Contributor

syhily commented Jun 6, 2023

@Samrat002 IIUC, you want to remove the snakeyaml dependencies in the flink-connector-pulsar. But I don't think this PR works. All the snakeyaml classes has been shaded in the fat-jar of pulsar-client-all. You can't remove it from pulsar-client-all by simply using a <exclude> directive. BTW, Pulsar client didn't use snakeyaml internally. So the CVE you report on snakeyaml won't occur on flink-connector-pulsar.

Co-authored-by: Yufan Sheng <syhily@gmail.com>
@Samrat002
Copy link
Author

Thank you @tisonkun, @syhily taking time in reviewing the small change.

my intension was to exclude snakeyaml and mitigate vulnerablity, I missed to see the added unnecessary dependencies creating technical debt in future upgrades.

If it should not be in the fat jar at all, you can submit a PR to Pulsar upstream and we reduce this dependency by upgrade pulsar version.

Yes, i can submit a pr in pulsar upstream and reduce this dependency by upgrading the pulsar version. This would be cleaner way.

BTW, Pulsar client didn't use snakeyaml internally. So the CVE you report on snakeyaml won't occur on flink-connector-pulsar.

I have one query regarding this, Do we really need pulsar client all here in flink connector pulsar ?
Cant we just use the only pulsar client that is used , using pulsar client all will bring other client that is not required here .
Looking forward to hear your opinion on it

@syhily
Copy link
Contributor

syhily commented Jun 9, 2023

I have one query regarding this, Do we really need pulsar client all here in flink connector pulsar ? Cant we just use the only pulsar client that is used , using pulsar client all will bring other client that is not required here . Looking forward to hear your opinion on it

I'm quite willing to answer this question because a lot of people ask the same question while a lot of the hidden details is not well documented.

Pulsar has two kinds of the Java client, the admin API and the client API. pulsar-client only contains the client API while our connector highly relies on the admin API to solve some bugs in client API and fulfil the missing features in client API. So we can't use the pulsar-client separately. Since the pulsar-admin and pulsar-client are both depending on a lot of duplicated dependencies. The only way to avoid the class conflicting and to have a clean dependency tree is just using the pulsar-client-all.

We are planning to drop the admin API usage because it just exposes a lot of dangerous operations to the end users and a lot of permission issues occurred. But this takes a long time on accomplishing the pulsar client. We are still on the way.

@syhily
Copy link
Contributor

syhily commented Jun 9, 2023

I think we can just close this PR and wait an upstream client bumping. WDYT? @tisonkun @Samrat002

@Samrat002
Copy link
Author

Thank you @syhily, explanation answers my query 💯 , and gives insight why we are having pulsar-client-all dependency in the connector.

I am not familiar with Apache Pulsar and never explored but wish to do it soon and use it in production, it would be great if you want to fix it in Apache Pulsar.

I think we can just close this PR and wait for an upstream client bumping. WDYT? @tisonkun @Samrat002

Sure, I will close the PR as it is not relevant and doesn't solve the issue.

@Samrat002 Samrat002 closed this Jun 10, 2023
@rorynickolls-skyral
Copy link

rorynickolls-skyral commented Oct 11, 2024

It looks like pulsar is now on version 3.3.2 but this is still pinned to 2.11.0. Is there anything stopping this being upgraded now?

@syhily
Copy link
Contributor

syhily commented Oct 12, 2024

@rorynickolls-skyral We are planning to use the LTS version of the Pulsar client. But the ci can't be passed cause some strange test issues

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

Successfully merging this pull request may close these issues.

4 participants