Skip to content

feat(devices): default useTLS and allowSelfSigned checkbox to true on Add Device - #3480

Open
DevipriyaS17 wants to merge 3 commits into
mainfrom
CM-351
Open

feat(devices): default useTLS and allowSelfSigned checkbox to true on Add Device#3480
DevipriyaS17 wants to merge 3 commits into
mainfrom
CM-351

Conversation

@DevipriyaS17

@DevipriyaS17 DevipriyaS17 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

  • Unit Tests have been added for new changes
  • API tests have been updated if applicable
  • All commented code has been removed
  • If you've added a dependency, you've ensured license is compatible with Apache 2.0 and clearly outlined the added dependency.

What are you changing?

The "Use TLS" and allowSelfSigned checkbox in the Add Device dialog is now
checked by default, so new devices connect over HTTPS (port 16993)
unless the user explicitly unchecks it.

If the there are associated PRs in other repositories, please link them here

device-management-toolkit/console#1169

@DevipriyaS17 DevipriyaS17 changed the title fix(security): default useTLS checkbox to true on Add Device fix(devices): default useTLS checkbox to true on Add Device Jul 31, 2026
@madhavilosetty-intel

Copy link
Copy Markdown
Contributor

@DevipriyaS17 - it should go as feat not a bug fix. Also, set allowSelfSigned to true by default for better user experience.

@DevipriyaS17 DevipriyaS17 changed the title fix(devices): default useTLS checkbox to true on Add Device feat(devices): default useTLS checkbox to true on Add Device Aug 4, 2026
@DevipriyaS17
DevipriyaS17 requested a lite review from Copilot August 4, 2026 08:49

Copilot AI 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.

Pull request overview

Updates the enterprise “Add Device” dialog so new devices default to using TLS (HTTPS/16993) by checking the Use TLS checkbox by default, aligning initial device-connection defaults with secure transport expectations in the enterprise flow.

Changes:

  • Default useTLS form control value changed from falsetrue in AddDeviceEnterpriseComponent.
  • Unit test fixtures updated to expect useTLS: true in submitted device payloads.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/app/shared/add-device-enterprise/add-device-enterprise.component.ts Changes the reactive form default so useTLS starts enabled for new devices.
src/app/shared/add-device-enterprise/add-device-enterprise.component.spec.ts Updates test inputs/expectations to match the new useTLS default.

Copilot AI 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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (3)

src/app/shared/add-device-enterprise/add-device-enterprise.component.ts:120

  • The non-CIRA TLS checkbox state is only preserved when transitioning from non-CIRA → CIRA (via !wasCIRA). When a CIRA device is loaded initially (constructor sets useCIRA = true and calls onCIRAChange(true)), the current useTLS/allowSelfSigned values are overwritten to false without being captured, so toggling CIRA off later restores the hard-coded defaults instead of the device’s existing values.
      // Preserve non-CIRA checkbox state before enforcing CIRA constraints.
      if (!wasCIRA) {
        this.lastNonCIRAUseTLS = this.form.get('useTLS')?.value ?? true
        this.lastNonCIRAAllowSelfSigned = this.form.get('allowSelfSigned')?.value ?? true
      }

src/app/shared/add-device-enterprise/add-device-enterprise.component.ts:66

  • This PR is described as defaulting only the “Use TLS” checkbox to checked, but it also changes allowSelfSigned to default true. If that’s intentional, the PR title/description should call out the behavior change (it materially affects certificate validation); if it’s not intentional, keep allowSelfSigned defaulting to false.
    useTLS: [true],
    allowSelfSigned: [true],

proxy.conf.json:5

  • proxy.conf.json is added but is not referenced anywhere in repo configuration (no matches in angular.json/package scripts), and it’s also not mentioned in the PR description. If this file is required for local development, wire it into the relevant ng serve configuration/script and document it in the PR; otherwise it’s likely accidental and should be removed to avoid confusing contributors.
{
  "/api": {
    "target": "http://localhost:8181",
    "secure": false,
    "logLevel": "info"

@DevipriyaS17 DevipriyaS17 changed the title feat(devices): default useTLS checkbox to true on Add Device feat(devices): default useTLS and allowSelfSigned checkbox to true on Add Device Aug 4, 2026
@DevipriyaS17
DevipriyaS17 requested a lite review from Copilot August 4, 2026 09:06

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (2)

src/app/shared/add-device-enterprise/add-device-enterprise.component.ts:141

  • onCIRAChange(false) always patches useTLS/allowSelfSigned from lastNonCIRA*. Since the constructor calls onCIRAChange(this.useCIRA) after form.patchValue(device), editing/loading a non-CIRA device will overwrite any persisted TLS settings (e.g., a device saved with useTLS: false will be forced back to true). Only restore lastNonCIRA* when actually transitioning from CIRA → non-CIRA (i.e., the controls were disabled).
      this.form.patchValue({
        useTLS: this.lastNonCIRAUseTLS,
        allowSelfSigned: this.lastNonCIRAAllowSelfSigned,
        mpsusername: 'admin',
        mpspassword: ''

src/app/shared/add-device-enterprise/add-device-enterprise.component.spec.ts:179

  • The new toggle-restoration test covers CIRA on/off, but there’s no regression test for loading/editing an existing non-CIRA device whose saved TLS values are false. Given the constructor calls onCIRAChange(false) after patchValue(device), this is an important scenario to prevent accidentally flipping persisted settings during edit.
  it('should restore prior non-CIRA TLS values after toggling CIRA off', () => {
    component.form.patchValue({
      useTLS: false,
      allowSelfSigned: true
    })

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants