Skip to content

server: validate ip address value on update config - #7415

Merged
yadvr merged 1 commit into
apache:4.18from
shapeblue:config-update-ipvalidation
Apr 28, 2023
Merged

yadvr merged 1 commit into
apache:4.18from
shapeblue:config-update-ipvalidation

Conversation

@shwstppr

@shwstppr shwstppr commented Apr 6, 2023 •

Copy link
Copy Markdown
Contributor

Description

Fixes #6958

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Using cmk passing valid and invalid IP range,

(local) 🍀 > list configurations name="remote.access.vpn.client.iprange"
{
  "configuration": [
    {
      "category": "Network",
      "component": "RemoteAccessVpnService",
      "defaultvalue": "10.1.2.1-10.1.2.8",
      "description": "The range of ips to be allocated to remote access vpn clients. The first ip in the range is used by the VPN server",
      "displaytext": "Remote access vpn client iprange",
      "group": "Miscellaneous",
      "isdynamic": false,
      "name": "remote.access.vpn.client.iprange",
      "subgroup": "Others",
      "type": "String",
      "value": "10.1.2.1-10.1.2.8"
    }
  ],
  "count": 1
}
(local) 🐃 > update configuration name="remote.access.vpn.client.iprange" value="10.1.2.1-10.1.2"
🙈 Error: (HTTP 431, error code 4350) Invalid IP address value(s) specified for the config value
(local) 🐘 > update configuration name="remote.access.vpn.client.iprange" value="10.1.2.1-10.1.2.10"
{
  "configuration": {
    "category": "Network",
    "component": "RemoteAccessVpnService",
    "defaultvalue": "10.1.2.1-10.1.2.8",
    "description": "The range of ips to be allocated to remote access vpn clients. The first ip in the range is used by the VPN server",
    "displaytext": "Remote access vpn client iprange",
    "group": "Miscellaneous",
    "isdynamic": false,
    "name": "remote.access.vpn.client.iprange",
    "subgroup": "Others",
    "type": "String",
    "value": "10.1.2.1-10.1.2.10"
  }
}

@codecov

codecov Bot commented Apr 6, 2023 •

Copy link
Copy Markdown

Codecov Report

Merging #7415 (51d9592) into 4.18 (2a68259) will increase coverage by 0.00%.
The diff coverage is 72.22%.

@@            Coverage Diff            @@
##               4.18    #7415   +/-   ##
=========================================
  Coverage     12.70%   12.70%           
- Complexity     8673     8684   +11     
=========================================
  Files          2717     2717           
  Lines        256184   256202   +18     
  Branches      39929    39936    +7     
=========================================
+ Hits          32541    32554   +13     
- Misses       219505   219506    +1     
- Partials       4138     4142    +4     
Impacted Files Coverage Δ
.../cloud/configuration/ConfigurationManagerImpl.java 15.50% <72.22%> (+0.25%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@shwstppr shwstppr changed the title ui,api: update config ip validation ui: update config ip validation Apr 10, 2023
@shwstppr

Copy link
Copy Markdown
Contributor Author

@weizhouapache @rohityadavcloud @DaanHoogland cc @xuanyuanaosheng do you think we need a check in backend code or is it okay to check and show error in UI only?

Fixes apache#6958

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr
shwstppr force-pushed the config-update-ipvalidation branch from 4adb59a to 51d9592 Compare April 17, 2023 08:16
@shwstppr shwstppr changed the title ui: update config ip validation server: validate ip address value on update config Apr 17, 2023
@weizhouapache

Copy link
Copy Markdown
Member

@weizhouapache @rohityadavcloud @DaanHoogland cc @xuanyuanaosheng do you think we need a check in backend code or is it okay to check and show error in UI only?

@shwstppr
it would be better to check in the backend when update config or start mgmt server, IMHO.

@shwstppr

Copy link
Copy Markdown
Contributor Author

@weizhouapache thanks. I updated PR to add check in the backend

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

67.6% 67.6% Coverage
0.0% 0.0% Duplication

@shwstppr
shwstppr marked this pull request as ready for review April 19, 2023 08:08
@shwstppr

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@shwstppr a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 5938

@yadvr yadvr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, didn't test it

@yadvr

yadvr commented Apr 20, 2023

Copy link
Copy Markdown
Member

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@rohityadavcloud a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-6439)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 42845 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7415-t6439-kvm-centos7.zip
Smoke tests completed. 108 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

@DaanHoogland DaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, For pollish/user friendly purposes we might in addition add a check in the UI on input but I think it is out of scope for this bug fix.

@yadvr yadvr added this to the 4.18.1.0 milestone Apr 28, 2023
@yadvr
yadvr merged commit b84744d into apache:4.18 Apr 28, 2023
@yadvr
yadvr deleted the config-update-ipvalidation branch April 28, 2023 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants