fortinet-ansible-dev / ansible-galaxy-fortimanager-collection

GNU General Public License v3.0
16 stars 15 forks source link

fmgr_user_group errors "The string contains XSS vulnerability characters" in 2.2.0 #65

Closed Pendion88 closed 1 year ago

Pendion88 commented 1 year ago

Hello, the following code works without issues in 2.1.7 however in version 2.2.0 it produces a "The string contains XSS vulnerability characters" error. It seems something escapes the characters wrong.

`########################################################################

ADD SSLVPN User group

########################################################################

- name: "Set radius group"
  fmgr_user_group:
    state: present
    adom: "{{ Customer_ADOM }}"
    user_group:
      name: "TEST"
      group-type: "firewall"
      member: RADIUS-AUTH
      match:
        -
          id: 1
          group-name: "TEST"
          server-name: 
          -
           "RADIUS-AUTH"`

fatal: [fgm.demo.nl]: FAILED! => { "changed": false, "invocation": { "module_args": { "access_token": null, "adom": "test-adom", "bypass_validation": false, "enable_log": false, "forticloud_access_token": null, "proposed_method": null, "rc_failed": null, "rc_succeeded": null, "state": "present", "user_group": { "auth-concurrent-override": null, "auth-concurrent-value": null, "authtimeout": null, "company": null, "dynamic_mapping": null, "email": null, "expire": null, "expire-type": null, "group-type": "firewall", "guest": null, "http-digest-realm": null, "id": null, "match": [ { "_gui_meta": null, "group-name": "test-group", "id": 1, "server-name": "['RADIUS-AUTH']" } ], "max-accounts": null, "member": [ "RADIUS-AUTH" ], "mobile-phone": null, "multiple-guest-add": null, "name": "test-group", "password": null, "sms-custom-server": null, "sms-server": null, "sponsor": null, "sso-attribute-value": null, "user-id": null, "user-name": null }, "workspace_locking_adom": null, "workspace_locking_timeout": 300 } }, "meta": { "request_url": "/pm/config/adom/test-adom/obj/user/group", "response_code": -9001, "response_data": [], "response_message": "match/1/server-name : The string contains XSS vulnerability characters - prop[server-name]: string([\\'RADIUS-AUTH\\'])", "system_information": { "Admin Domain Configuration": "Enabled", "BIOS version": "04000002", "Branch Point": "1405", "Build": "1405", "Current Time": "Thu Jul 20 17:04:27 CEST 2023", "Daylight Time Saving": "Yes", "FIPS Mode": "Disabled", "HA Mode": "Stand Alone", "Hostname": "FGM01", "License Status": "Valid", "Major": 7, "Max Number of Admin Domains": 130, "Max Number of Device Groups": 130, "Minor": 2, "Offline Mode": "Disabled", "Patch": 3, "Platform Full Name": "FortiManager-VM64", "Platform Type": "FMG-VM64", "Release Version Information": " (GA)", "Serial Number": "FMG-xxxxxxxx", "TZ": "xxxxxxxxx", "Time Zone": "xxxxxxxx.", "Version": "v7.2.3-build1405 230606 (GA)", "x86-64 Applications": "Yes" } }, "rc": -9001 }

dux-fortinet commented 1 year ago

Hi Pendion88, According to the definition, the type of parameter "server-name" is string, not a list of string.

So please try

- name: "Set radius group"
  fmgr_user_group:
    state: present
    adom: "{{ Customer_ADOM }}"
    user_group:
      name: "TEST"
      group-type: "firewall"
      member: RADIUS-AUTH
      match:
        -
          id: 1
          group-name: "TEST"
          server-name:  "RADIUS-AUTH"

And thanks for raising this issue. We will improve our code and make fortimanager Ansible Collection more fault-tolerant in the future versions.