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

RawValues editor does not handle properly the YAML Multiline strings correctly #938

Closed
j-zimnowoda opened this issue Nov 9, 2022 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@j-zimnowoda
Copy link
Contributor

j-zimnowoda commented Nov 9, 2022

Describe the bug: (a clear and concise description of what the bug is)

This issue occurs while setting values with Multiline strings in the rawValues editor in otomi console.

The YAML syntax supports two kind of multi line stings

  • literal style, indicated by a pipe |
  • and block Style, right angle bracket >

We observe that the very first | from the user input in removed while submitting the form, thus breaking the whole formatting of the YAML file

To Reproduce
Steps to reproduce the behavior:

  1. Go to nginx-ingress app setting and select the rawValues tab
  2. Enter the following text and click submit
a:
  b: |
    cd

abcd:
  e.yaml: | 
    f.g:
      - i
        j: k
  1. Refresh the page and observe that formatting is broken:
a: b:| cd
abcd:
  e.yaml: |
    f.g:
      - i
        j: k

Expected behavior:
rawValues editor supports YAML Multiline strings

@j-zimnowoda j-zimnowoda added the bug Something isn't working label Nov 9, 2022
@dennisvankekem
Copy link
Contributor

@j-zimnowoda because you need to escape | with a whitespace like so:

image.png

@j-zimnowoda
Copy link
Contributor Author

Indeed there was missing white space.

Take a look on the following example:

controller:
  config:
    modsecurity-snippet: |
      SecRuleEngine DetectionOnly
      SecAuditEngine RelevantOnly
      # SecRequestBodyAccess Off
      SecAuditLogParts ABDEFHIJZ
      SecAuditLogFormat JSON
      SecAuditLogType Serial
      SecAuditLog /var/log/nginx/modsecurity/modsecurity_log.json
      # overrides for owasp go before inclusion of the defaults in nginx-modsecurity.conf
    aa.yml: |
      aa.inputs:
        - type: log
          paths:
            - /var/log/modsecurity/modsecurity_log.json

will produce

>
controller:
  config:
    modsecurity-snippet: >
      SecRuleEngine DetectionOnly

      SecAuditEngine RelevantOnly

      # SecRequestBodyAccess Off

      SecAuditLogParts ABDEFHIJZ

      SecAuditLogFormat JSON

      SecAuditLogType Serial

      SecAuditLog /var/log/nginx/modsecurity/modsecurity_log.json

      # overrides for owasp go before inclusion of the defaults in nginx-modsecurity.conf
    aa.yml:       aa.inputs:
        - type: log
          paths:
            - /var/log/modsecurity/modsecurity_log.json

@dennisvankekem
Copy link
Contributor

I can reproduce this, will look into it today

@dennisvankekem
Copy link
Contributor

From what I can see is that the problem does not lie with the | but rather with a wrong conversion from | to > that happens somewhere in code whenever a long string is present, I'll dive into the code to see where this is happening.

@j-zimnowoda
Copy link
Contributor Author

Introduction of a new editor in otomi-console solves the formatting issues.

However, there is an issue with multiline string syntax highlighting: uiwjs/react-monacoeditor#163. We are going to monitor the status of this issue and update the editor version

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

No branches or pull requests

2 participants