jenkinsci / poll-mailbox-trigger-plugin

A Jenkins plugin, to poll an email inbox, and trigger jobs based on new emails.
https://plugins.jenkins.io/poll-mailbox-trigger-plugin/
MIT License
40 stars 32 forks source link

Custom Job Parameters injection if parameter in mail has prefix #37

Closed huehnerlady closed 5 years ago

huehnerlady commented 6 years ago
We use the email plugin to provide mechanisms for our testers to approve the deployment of a new build on our test servers. basically they receive an email and have to answer to that email. In the email we put in the version which is to be deployed which we later use to kick off the deploy-jobs. But with some email configurations the reply gets prefixes added to every line of the original message, eg `FOO=bar` becomes `>FOO=bar`. This unfortunately does not get picked up by the plugin. ### Steps to reproduce How can we reproduce the issue 1. create job which polls an email inbox and injects a parameter calles "FOO" 2. send an email to that inbox with injects a parameter ">FOO=bar" 3. the parameter will not be injected ### Expected behaviour There should be some kind of mechanism where you can use a wildcard for the parameters so this would still be picked up as "FOO" ### Server configuration **Jenkins Version**: 2.56 **Plugin Version**: 1.026 **Mail Server**: imap.gmail.com
nickgrealy commented 6 years ago

Hi @huehnerlady, sounds great.

1) Only problem I could imagine, is inadvertently/accidentally picking up unintended properties, from within the email trail. Thoughts?

e.g.

Jenkins, please release this version:

version=1.23-RELEASE

Kind regards, Nick

> Jenkins build completed:
> version=1.23-BETA
> cleanWorkspace=false

2) Also, re: stripping invalid characters, is it enough to restrict to letters, digits, and underscore? (regex => [a-zA-Z_][a-zA-Z0-9_]*)

Environment variable names used by the utilities in the Shell and Utilities volume of IEEE Std 1003.1-2001 consist solely of uppercase letters, digits, and the '_' (underscore) from the characters defined in Portable Character Set and do not begin with a digit. Other characters may be permitted by an implementation; applications shall tolerate the presence of such names. Uppercase and lowercase letters shall retain their unique identities and shall not be folded together. The name space of environment variable names containing lowercase letters is reserved for applications. Applications can define any environment variables with names from this name space without modifying the behaviour of the standard utilities.

http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap08.html

huehnerlady commented 6 years ago

@nickgrealy thanks for your answer. I am not sure if it is that easy as other email programmes do not add anything in front of a reply - therefore you could end up with an email like this anyways:

Jenkins, please release this version:

version=1.23-RELEASE

Kind regards, Nick

Jenkins build completed:
version=1.23-BETA
cleanWorkspace=false

Maybe you could be able to specify a regex the emails are parsed with? But optional thing, not mandatory?

huehnerlady commented 5 years ago

as I moved team I am not using this functionality anymore, and nobody answered me anyways