dify icon indicating copy to clipboard operation
dify copied to clipboard

Plugin Signature Verification Failed During Installation (PluginDaemonBadRequestError: bad signature)

Open jaguarliuu opened this issue 1 year ago • 12 comments

Self Checks

  • [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [x] Please do not modify this template :) and fill in all the required fields.

Dify version

1.0.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When attempting to install my locally developed Dify plugin (rookie_text2data) via the Dify platform, I encounter the following error:

PluginDaemonBadRequestError: plugin verification has been enabled, and the plugin you want to install has a bad signature

I have followed the official documentation to configure digital signatures, but the installation still fails. Disabling signature verification is not a viable solution for production use.

  1. What specific configurations are required for Dify to accept a custom plugin signature?
  2. How can I validate my signature file is correctly formatted?
  3. Are there any known issues with self-signed certificates in Dify's verification process?
  4. Is there a debug mode or verbose logging I can enable to trace the signature validation step?

Plugin source code: jaguarliuu/rookie_text2data

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

jaguarliuu avatar Mar 17 '25 14:03 jaguarliuu

I found a similar open issue regarding the "Plugin Signature Verification Failed During Installation" error. The suggested solution involves modifying the docker/docker-compose.yaml file or your .env configuration file by setting the FORCE_VERIFYING_SIGNATURE environment variable to false. This allows the installation of plugins that are not verified in the Dify Marketplace, but it is recommended to test in a sandbox environment first [1].

To validate that your plugin's signature file is correctly formatted, you can use the verify_plugin_file_signature function. This function checks if the provided signature matches the recalculated signature and ensures the timestamp is within the allowed access timeout [2].

Regarding self-signed certificates, I couldn't find specific requirements or known issues in the available documentation.

For tracing the signature validation process, you can enable debug mode by setting the DEBUG environment variable to true and the LOG_LEVEL to DEBUG in your configuration. This will provide more detailed logs [3].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar Mar 17 '25 14:03 dosubot[bot]

@dosu Despite exhausting all troubleshooting methods and enabling logging, I am unable to observe error logs for the endpoint /console/api/workspaces/current/plugin/upload/pkg in the backend. Disabling parameter validation is not a viable long-term solution as I need to distribute this plugin publicly. After comparing my plugin with others in the marketplace, no discrepancies were found. Could you please explain why my plugin fails to upload successfully?

jaguarliuu avatar Mar 17 '25 14:03 jaguarliuu

The failure of your plugin to upload successfully could be due to several factors, even if no discrepancies were found when comparing with other plugins. Here are some potential reasons and steps to consider:

  1. Manifest Requirements: Ensure that your plugin package meets all the manifest requirements. The manifest must include fields like version, type, author, label, created_at, icon, plugins, meta, version, arch, and runner. Any missing or incorrectly formatted fields could cause the upload to fail [1].

  2. Signature Verification: Double-check the digital signature of your plugin. The signature verification process involves recalculating the signature using HMAC with SHA-256 and comparing it with the provided signature. Ensure that the data string used for signing is correctly formatted and that the secret key is accurate [2].

  3. Timestamp Validity: Verify that the timestamp included in your signature is within the allowed timeout period. An invalid timestamp can cause the signature verification to fail [2].

  4. Debugging and Logging: Since enabling logging did not provide insights, ensure that the logging configuration is correctly set up to capture all relevant logs. Check if there are any additional logging settings specific to the plugin upload process that might need to be enabled.

  5. Error Codes and Messages: Although specific error codes or messages for the /console/api/workspaces/current/plugin/upload/pkg endpoint were not found, reviewing any available logs or console outputs for subtle error messages might provide clues.

If these steps do not resolve the issue, consider reviewing the plugin's code and configuration for any subtle errors or inconsistencies that might not be immediately apparent.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar Mar 17 '25 14:03 dosubot[bot]

@duso version: 0.0.1 type: plugin author: jaguarliuu name: rookie_text2data label: en_US: rookie_text2data ja_JP: rookie_text2data zh_Hans: rookie_text2data pt_BR: rookie_text2data description: en_US: Fetching data from the database using natural language. ja_JP: Fetching data from the database using natural language. zh_Hans: 自然语言查询 MySQL 数据. pt_BR: Fetching data from the database using natural language. icon: data-collection.svg resource: memory: 268435456 permission: tool: enabled: true model: enabled: true llm: true text_embedding: false rerank: false tts: false speech2text: false moderation: false app: enabled: true storage: enabled: true size: 1048576 plugins: tools: - provider/rookie_text2data.yaml meta: version: 0.0.1 arch: - amd64 - arm64 runner: language: python version: "3.12" entrypoint: main created_at: 2025-03-13T22:33:07.708063231+08:00 privacy: PRIVACY.md verified: false

My manifest.json file includes all required fields (version, type, author, label, created_at, icon, plugins, meta, arch, and runner). Regarding the second step of ​Signature Verification, how can I locally verify my plugin's signature? Additionally, the timestamp parameter is not mentioned in the official documentation; where does it originate from? The documentation only states to "write and package" the plugin without further guidance.

jaguarliuu avatar Mar 17 '25 14:03 jaguarliuu

Can you try the following things:

  • Upgrade the plugin_daemon
  • Upgrade the plugin_sdks
  • Upgrade to v1.0.1 instead

crazywoola avatar Mar 18 '25 01:03 crazywoola

@crazywoola I am getting same error.

This is my setup:

  • Mac on ARM 64
  • Dify v1.1.2 running on localhost via Docker
  • dify tool v0.0.6
  • plugin sdks v0.0.1b74 (added to requirements.txt as dify_plugin and installed via pip install -r requirements.txt )

Unable to install plugin on localhost after doing:

dify plugin package <my_plugin_folder>

The package gets created successfully but error shown:

Image

benjamin-mogensen avatar Mar 21 '25 21:03 benjamin-mogensen

@crazywoola I am confused about the versioning scheme of the dify_plugin.

Latest release on GitHub states: 0.0.1-beta.48

But toml file is set to version = "0.0.1-beta74".

So I am running the latest, it just seems there is something not aligned between the GitHub release process and the tool file.

benjamin-mogensen avatar Mar 21 '25 21:03 benjamin-mogensen

@jaguarliuu @benjamin-mogensen Could you please provide the the official documentation regarding digital signatures about plugins?

At this stage, I believe that there is no method provided for users to sign packages using arbitrary private keys, or for the daemon to be configured to verify signatures using arbitrary public keys, at least for community edition. Is there something provided for enterprise edition?

Related RFE: https://github.com/langgenius/dify-plugin-daemon/issues/120

kurokobo avatar Mar 22 '25 14:03 kurokobo

@kurokobo I am not aware of any official documentation for the signing of the plugins. If such exists I have not found it. I think we need the official Dify team to help us out here.

As for the enterprise edition I have not come across any other means of signing or installing plugins or the like.

I am a bit stuck here - in preparation for the enterprise edition that supports plugin I have bend working on some but as long as I am unable to package and sign correctly I can't really progress. I am unsure our infra team will allow the install of unsigned plugins at this point in time.

benjamin-mogensen avatar Mar 23 '25 12:03 benjamin-mogensen

@crazywoola I am confused about the versioning scheme of the dify_plugin.

Latest release on GitHub states: 0.0.1-beta.48

But toml file is set to version = "0.0.1-beta74".

So I am running the latest, it just seems there is something not aligned between the GitHub release process and the tool file.

@crazywoola any idea about what could be the issue here?

benjamin-mogensen avatar Mar 25 '25 20:03 benjamin-mogensen

i have same issue with dify-plugin 0.0.7 and dify 1.2.0

Lyeluo avatar Apr 11 '25 05:04 Lyeluo

If you want to install your own plugin with your own signature without disabling signature verification, third-party signature verification is available from version 0.0.7 onwards. Refer to the docs: https://docs.dify.ai/plugins/publish-plugins/signing-plugins-for-third-party-signature-verification

kurokobo avatar Apr 11 '25 05:04 kurokobo