Skip to content

Dangling space at end of message strings can cause issues for monitoring and parsing of output #117067

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

Open
vford-elastic opened this issue Nov 19, 2024 · 1 comment
Assignees
Labels
>bug :Security/Security Security issues without another label Team:Security Meta label for security team

Comments

@vford-elastic
Copy link

Elasticsearch Version

8.16.0

Installed Plugins

No response

Java Version

bundled

OS Version

Linux

Problem Description

Dangling space at end of message strings can cause issues for monitoring and parsing of logs. Users want to parse output using their tools and periodically they are finding messages with an unnecessary trailing space which can break some user parsers.

Steps to Reproduce

Examples of the messages with trailing extra space on last line of message.

https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStore.java#L477

                "Grants the minimum privileges required to view machine learning configuration, status, and work with results. "
                    + "This role grants monitor_ml cluster privileges, read access to the .ml-notifications and .ml-anomalies* indices "
                    + "(which store machine learning results), and write access to .ml-annotations* indices. "
                    + "Machine learning users also need index privileges for source and destination indices "
                    + "and roles that grant access to Kibana. "

https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStore.java#L582

"Grants monitor_data_frame_transforms cluster privileges, which enable you to use transforms. "
+ "This role also includes all Kibana privileges for the machine learning features. "

Most of the messages do not have a training space, for example the following doesn't have a trailing space:

https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStore.java#L218

"Grants the minimum privileges required for any user of X-Pack monitoring other than those required to use Kibana. "
+ "This role grants access to the monitoring indices and grants privileges necessary "
+ "for reading basic cluster information. "
+ "This role also includes all Kibana privileges for the Elastic Stack monitoring features. "
+ "Monitoring users should also be assigned the kibana_admin role, "
+ "or another role with access to the Kibana instance."

Logs (if relevant)

No response

@vford-elastic vford-elastic added >bug needs:triage Requires assignment of a team area label labels Nov 19, 2024
@AI-IshanBhatt AI-IshanBhatt added the :Security/Security Security issues without another label label Nov 20, 2024
@elasticsearchmachine elasticsearchmachine added Team:Security Meta label for security team and removed needs:triage Requires assignment of a team area label labels Nov 20, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

@ankit--sethi ankit--sethi self-assigned this Apr 28, 2025
ankit--sethi added a commit to ankit--sethi/elasticsearch that referenced this issue Apr 28, 2025
This PR addresses elastic#117067 , a report about unexpected spaces breaking message parsers built by customers. I used the regex `(\. \")(?![A-Z(a-z_0-9-;<%\/\.+ \t\n]+)` to detect such instances and clean up. In one case, a minor code improvement helps add optional spaces as necessary for a multi-sentence error message.
ankit--sethi added a commit that referenced this issue May 1, 2025
* Remove dandling spaces wherever found.

This PR addresses #117067 , a report about unexpected spaces breaking message parsers built by customers. I used the regex `(\. \")(?![A-Z(a-z_0-9-;<%\/\.+ \t\n]+)` to detect such instances and clean up. In one case, a minor code improvement helps add optional spaces as necessary for a multi-sentence error message.

* fix test

* Update docs/changelog/127475.yaml

* correct logic

* fix test

* fix tests

* fix tests

* fix tests

* Update docs/changelog/127475.yaml

* Update x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/action/TransportGetInferenceModelAction.java

Co-authored-by: Slobodan Adamović <[email protected]>

* Update libs/x-content/src/main/java/org/elasticsearch/xcontent/ObjectParser.java

Co-authored-by: Slobodan Adamović <[email protected]>

* correctly reference issue

* Update docs/changelog/127475.yaml

---------

Co-authored-by: Slobodan Adamović <[email protected]>
ankit--sethi added a commit to ankit--sethi/elasticsearch that referenced this issue May 1, 2025
* Remove dandling spaces wherever found.

This PR addresses elastic#117067 , a report about unexpected spaces breaking message parsers built by customers. I used the regex `(\. \")(?![A-Z(a-z_0-9-;<%\/\.+ \t\n]+)` to detect such instances and clean up. In one case, a minor code improvement helps add optional spaces as necessary for a multi-sentence error message.

* fix test

* Update docs/changelog/127475.yaml

* correct logic

* fix test

* fix tests

* fix tests

* fix tests

* Update docs/changelog/127475.yaml

* Update x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/action/TransportGetInferenceModelAction.java

Co-authored-by: Slobodan Adamović <[email protected]>

* Update libs/x-content/src/main/java/org/elasticsearch/xcontent/ObjectParser.java

Co-authored-by: Slobodan Adamović <[email protected]>

* correctly reference issue

* Update docs/changelog/127475.yaml

---------

Co-authored-by: Slobodan Adamović <[email protected]>

(cherry picked from commit 94854b3)
ankit--sethi added a commit to ankit--sethi/elasticsearch that referenced this issue May 1, 2025
* Remove dandling spaces wherever found.

This PR addresses elastic#117067 , a report about unexpected spaces breaking message parsers built by customers. I used the regex `(\. \")(?![A-Z(a-z_0-9-;<%\/\.+ \t\n]+)` to detect such instances and clean up. In one case, a minor code improvement helps add optional spaces as necessary for a multi-sentence error message.

* fix test

* Update docs/changelog/127475.yaml

* correct logic

* fix test

* fix tests

* fix tests

* fix tests

* Update docs/changelog/127475.yaml

* Update x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/action/TransportGetInferenceModelAction.java

Co-authored-by: Slobodan Adamović <[email protected]>

* Update libs/x-content/src/main/java/org/elasticsearch/xcontent/ObjectParser.java

Co-authored-by: Slobodan Adamović <[email protected]>

* correctly reference issue

* Update docs/changelog/127475.yaml

---------

Co-authored-by: Slobodan Adamović <[email protected]>

(cherry picked from commit 94854b3)
ankit--sethi added a commit that referenced this issue May 1, 2025
* Remove dandling spaces wherever found.

This PR addresses #117067 , a report about unexpected spaces breaking message parsers built by customers. I used the regex `(\. \")(?![A-Z(a-z_0-9-;<%\/\.+ \t\n]+)` to detect such instances and clean up. In one case, a minor code improvement helps add optional spaces as necessary for a multi-sentence error message.

* fix test

* Update docs/changelog/127475.yaml

* correct logic

* fix test

* fix tests

* fix tests

* fix tests

* Update docs/changelog/127475.yaml

* Update x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/action/TransportGetInferenceModelAction.java

Co-authored-by: Slobodan Adamović <[email protected]>

* Update libs/x-content/src/main/java/org/elasticsearch/xcontent/ObjectParser.java

Co-authored-by: Slobodan Adamović <[email protected]>

* correctly reference issue

* Update docs/changelog/127475.yaml

---------

Co-authored-by: Slobodan Adamović <[email protected]>

(cherry picked from commit 94854b3)
ankit--sethi added a commit to ankit--sethi/elasticsearch that referenced this issue May 1, 2025
* Remove dandling spaces wherever found.

This PR addresses elastic#117067 , a report about unexpected spaces breaking message parsers built by customers. I used the regex `(\. \")(?![A-Z(a-z_0-9-;<%\/\.+ \t\n]+)` to detect such instances and clean up. In one case, a minor code improvement helps add optional spaces as necessary for a multi-sentence error message.

* fix test

* Update docs/changelog/127475.yaml

* correct logic

* fix test

* fix tests

* fix tests

* fix tests

* Update docs/changelog/127475.yaml

* Update x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/action/TransportGetInferenceModelAction.java

Co-authored-by: Slobodan Adamović <[email protected]>

* Update libs/x-content/src/main/java/org/elasticsearch/xcontent/ObjectParser.java

Co-authored-by: Slobodan Adamović <[email protected]>

* correctly reference issue

* Update docs/changelog/127475.yaml

---------

Co-authored-by: Slobodan Adamović <[email protected]>

(cherry picked from commit 94854b3)
ankit--sethi added a commit that referenced this issue May 1, 2025
* Remove dandling spaces wherever found.

This PR addresses #117067 , a report about unexpected spaces breaking message parsers built by customers. I used the regex `(\. \")(?![A-Z(a-z_0-9-;<%\/\.+ \t\n]+)` to detect such instances and clean up. In one case, a minor code improvement helps add optional spaces as necessary for a multi-sentence error message.

* fix test

* Update docs/changelog/127475.yaml

* correct logic

* fix test

* fix tests

* fix tests

* fix tests

* Update docs/changelog/127475.yaml

* Update x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/action/TransportGetInferenceModelAction.java

Co-authored-by: Slobodan Adamović <[email protected]>

* Update libs/x-content/src/main/java/org/elasticsearch/xcontent/ObjectParser.java

Co-authored-by: Slobodan Adamović <[email protected]>

* correctly reference issue

* Update docs/changelog/127475.yaml

---------

Co-authored-by: Slobodan Adamović <[email protected]>

(cherry picked from commit 94854b3)
ankit--sethi added a commit to ankit--sethi/elasticsearch that referenced this issue May 1, 2025
* Remove dandling spaces wherever found.

This PR addresses elastic#117067 , a report about unexpected spaces breaking message parsers built by customers. I used the regex `(\. \")(?![A-Z(a-z_0-9-;<%\/\.+ \t\n]+)` to detect such instances and clean up. In one case, a minor code improvement helps add optional spaces as necessary for a multi-sentence error message.

* fix test

* Update docs/changelog/127475.yaml

* correct logic

* fix test

* fix tests

* fix tests

* fix tests

* Update docs/changelog/127475.yaml

* Update x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/action/TransportGetInferenceModelAction.java

Co-authored-by: Slobodan Adamović <[email protected]>

* Update libs/x-content/src/main/java/org/elasticsearch/xcontent/ObjectParser.java

Co-authored-by: Slobodan Adamović <[email protected]>

* correctly reference issue

* Update docs/changelog/127475.yaml

---------

Co-authored-by: Slobodan Adamović <[email protected]>

(cherry picked from commit 94854b3)
ankit--sethi added a commit that referenced this issue May 1, 2025
* Remove dandling spaces wherever found.

This PR addresses #117067 , a report about unexpected spaces breaking message parsers built by customers. I used the regex `(\. \")(?![A-Z(a-z_0-9-;<%\/\.+ \t\n]+)` to detect such instances and clean up. In one case, a minor code improvement helps add optional spaces as necessary for a multi-sentence error message.

* fix test

* Update docs/changelog/127475.yaml

* correct logic

* fix test

* fix tests

* fix tests

* fix tests

* Update docs/changelog/127475.yaml

* Update x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/action/TransportGetInferenceModelAction.java

Co-authored-by: Slobodan Adamović <[email protected]>

* Update libs/x-content/src/main/java/org/elasticsearch/xcontent/ObjectParser.java

Co-authored-by: Slobodan Adamović <[email protected]>

* correctly reference issue

* Update docs/changelog/127475.yaml

---------

Co-authored-by: Slobodan Adamović <[email protected]>

(cherry picked from commit 94854b3)
ankit--sethi added a commit that referenced this issue May 1, 2025
* Remove dandling spaces wherever found.

This PR addresses #117067 , a report about unexpected spaces breaking message parsers built by customers. I used the regex `(\. \")(?![A-Z(a-z_0-9-;<%\/\.+ \t\n]+)` to detect such instances and clean up. In one case, a minor code improvement helps add optional spaces as necessary for a multi-sentence error message.

* fix test

* Update docs/changelog/127475.yaml

* correct logic

* fix test

* fix tests

* fix tests

* fix tests

* Update docs/changelog/127475.yaml

* Update x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/action/TransportGetInferenceModelAction.java

Co-authored-by: Slobodan Adamović <[email protected]>

* Update libs/x-content/src/main/java/org/elasticsearch/xcontent/ObjectParser.java

Co-authored-by: Slobodan Adamović <[email protected]>

* correctly reference issue

* Update docs/changelog/127475.yaml

---------

Co-authored-by: Slobodan Adamović <[email protected]>

(cherry picked from commit 94854b3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Security/Security Security issues without another label Team:Security Meta label for security team
Projects
None yet
Development

No branches or pull requests

4 participants