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

Azure Queue Storage EventSource fails to base64 decode messages containing HTML tags #3302

Closed
Stolz opened this issue Sep 25, 2024 · 1 comment · Fixed by #3366
Closed

Azure Queue Storage EventSource fails to base64 decode messages containing HTML tags #3302

Stolz opened this issue Sep 25, 2024 · 1 comment · Fixed by #3366
Labels
bug Something isn't working

Comments

@Stolz
Copy link

Stolz commented Sep 25, 2024

Describe the bug

When using Azure Queue Storage EventSource, if the queue contains a base64 encoded JSON message with HTML tags, the EventSource pod fails to base64 decode it.

Steps to reproduce the issue

  1. Send to the queue a base64 encoded JSON message that contains some HTML tags

     MESSAGE="`echo '{"html":"<p>test</p>"}' | base64`"
     az storage message put --account-name "$STORAGE_ACCOUNT_NAME" --account-key "$STORAGE_ACCOUNT_KEY" --queue-name example --content="$MESSAGE"
    
  2. Verify the queue message can indeed be base64 decoded

     az storage message peek --account-name "$STORAGE_ACCOUNT_NAME" --account-key "$STORAGE_ACCOUNT_KEY" --queue-name example -o tsv --query '[].{Message:content}' | base64 --decode
     {"html":"<p>test</p>"}
    
  3. Create a Secret with the connection string for the Storage Account that contains the queue

     kubectl create secret generic queue-access --from-literal='connectionString=...'
    
  4. Create an EventSource that listens on the Storage Account queue

apiVersion: argoproj.io/v1alpha1
kind: EventSource
metadata:
  name: example
spec:
  azureQueueStorage:
    example:
      connectionString:
        key: connectionstring
        name: queue-access
      decodeMessage: true
      jsonBody: true # Irrelevant since parsing body step is never reached

Expected behavior

The EventSource should be able to decode the base64 message and publish it to the EventBus.

Actual behavior

The EventSource pod shows this error in the logs:

{"level":"error","ts":1727263035.0298033,"logger":"argo-events.eventsource","caller":"azurequeuestorage/start.go:142","msg":"failed to base64 decode message...","eventSourceName":"example","eventSourceType":"azureQueueStorage","eventName":"example","error":"illegal base64 data at input byte 27","stacktrace":"github.com/argoproj/argo-events/eventsources/sources/azurequeuestorage.(*EventListener).processMessage\n\t/home/runner/work/argo-events/argo-events/eventsources/sources/azurequeuestorage/start.go:142\ngithub.com/argoproj/argo-events/eventsources/sources/azurequeuestorage.(*EventListener).StartListening\n\t/home/runner/work/argo-events/argo-events/eventsources/sources/azurequeuestorage/start.go:116\ngithub.com/argoproj/argo-events/eventsources.(*EventSourceAdaptor).run.func3.1\n\t/home/runner/work/argo-events/argo-events/eventsources/eventing.go:536\ngithub.com/argoproj/argo-events/common.DoWithRetry.func1\n\t/home/runner/work/argo-events/argo-events/common/retry.go:106\nk8s.io/apimachinery/pkg/util/wait.runConditionWithCrashProtection\n\t/home/runner/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:145\nk8s.io/apimachinery/pkg/util/wait.ExponentialBackoff\n\t/home/runner/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/backoff.go:461\ngithub.com/argoproj/argo-events/common.DoWithRetry\n\t/home/runner/work/argo-events/argo-events/common/retry.go:105\ngithub.com/argoproj/argo-events/eventsources.(*EventSourceAdaptor).run.func3\n\t/home/runner/work/argo-events/argo-events/eventsources/eventing.go:535"}

Environment:

  • Kubernetes Client version: 1.31.0
  • Kubernetes Server version: 1.30.3
  • Argo Events version: 1.9.2 (installed via Helm chart version 2.4.8)

Additional context

If the closing HTML tag is removed from the queue message everything works as expected. i.e:

MESSAGE="`echo '{"html":"<p>test<p>"}' | base64`"
az storage message put --account-name "$STORAGE_ACCOUNT_NAME" --account-key "$STORAGE_ACCOUNT_KEY" --queue-name example --content="$MESSAGE"

{"level":"info","ts":1727263167.2123094,"logger":"argo-events.eventsource","caller":"eventsources/eventing.go:591","msg":"Succeeded to publish an event","eventSourceName":"example","eventName":"example","eventSourceType":"azureQueueStorage","eventID":"31643435616434352d646433382d343862302d383061652d636630323563353838383434"}

Message from the maintainers:

If you wish to see this enhancement implemented please add a 👍 reaction to this issue! We often sort issues this way to know what to prioritize.

@Stolz Stolz added the bug Something isn't working label Sep 25, 2024
@Stolz Stolz changed the title Azure Queue Storage EventSource unable to decode base64 messages that contain HTML tags Azure Queue Storage EventSource fails to base64 decode messages containing HTML tags Sep 27, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has not had
any activity in the last 60 days. It will be closed if no further activity
occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants