Skip to content

feat: merge device on duplicate POST, Vault fallback for credentials - #1281

Closed
amarnath-ac wants to merge 1 commit into
mainfrom
console_rps_deployment
Closed

amarnath-ac wants to merge 1 commit into
mainfrom
console_rps_deployment

Conversation

@amarnath-ac

@amarnath-ac amarnath-ac commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor
  • Device POST upserts: on a duplicate GUID, merge the supplied fields
    into the stored device and return 200 instead of 409.
  • Read AMT_PASSWORD and MPS_PASSWORD from Vault at devices/{guid} when
    no password is stored, for device management, AMT Explorer, CIRA and
    redirection.
  • Do not write a Vault-only password back to the device row, so Vault
    stays the source of truth.

@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.66667% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.88%. Comparing base (6ab185c) to head (cfc2410).

Files with missing lines Patch % Lines
internal/mocks/devicemanagement_mocks.go 0.00% 3 Missing ⚠️
internal/usecase/devices/repo.go 86.95% 3 Missing ⚠️
internal/usecase/devices/redirection.go 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1281      +/-   ##
==========================================
+ Coverage   60.73%   60.88%   +0.14%     
==========================================
  Files         151      151              
  Lines       12632    12682      +50     
==========================================
+ Hits         7672     7721      +49     
- Misses       4959     4960       +1     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Copilot review overview

🟡 Changes recommended

Critical empty-password fallback failures and incomplete WSMAN path coverage remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 High severity · 2 Medium severity · 1 Low severity

Open (5)
What changed in this PR

This PR adds duplicate-device POST upserts and Vault-backed credential fallbacks for device operations.

Changes:

  • Merges duplicate GUID submissions and returns HTTP 200.
  • Adds Vault lookups for MPS_PASSWORD and AMT_PASSWORD.
  • Updates wiring, tests, and OpenAPI documentation.
File Summary
internal/​usecase/​usecase.go Wires shared certificate storage. Moderate (1 vote): Vault fallback is not shared with all WSMAN paths. Moderate (2 votes): AMT Explorer lacks the fallback. Moderate (2 votes): Redirector lacks the fallback.
internal/​usecase/​devices/​wsman/​message.go Adds AMT credential lookup. Critical (2 votes): Empty stored passwords fail decryption before the Vault fallback. Critical (2 votes): Empty-password handling must allow AMT_PASSWORD resolution.
internal/​usecase/​devices/​usecase.go Stores shared Vault/certificate access in the devices use case.
internal/​usecase/​devices/​repo.go Adds MPS fallback. Moderate (1 vote): Unrelated updates can persist Vault-only passwords and prevent future rotation. Critical (2 votes): Empty AMT passwords can fail duplicate upserts before the WSMAN fallback.
internal/​usecase/​devices/​repo_test.go Adds coverage for Vault-backed MPS retrieval.
internal/​controller/​openapi/​devices.go Documents the HTTP 200 upsert response. Nit (2 votes): The checked-in Postman collection lacks repeat-POST and 200-response coverage.
internal/​controller/​httpapi/​v1/​devices.go Implements duplicate POST upserts. Nit (1 vote): The Postman collection still lacks duplicate-POST coverage while retaining 201 assertions.
internal/​controller/​httpapi/​v1/​devices_test.go Adds upsert and error-path tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/usecase/devices/repo.go Outdated
Comment thread internal/usecase/devices/wsman/message.go Outdated
Comment thread internal/usecase/usecase.go Outdated
Comment thread internal/usecase/usecase.go Outdated
Comment thread internal/controller/openapi/devices.go
@amarnath-ac
amarnath-ac force-pushed the console_rps_deployment branch 4 times, most recently from 69f351b to 1dc23f6 Compare September 23, 2026 10:49
@amarnath-ac
amarnath-ac requested a lite review from Copilot September 23, 2026 10:51

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.

Copilot review overview

🟡 Changes recommended

Critical credential consistency and Vault source-of-truth issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 High severity

Open (2)
Resolved since last review (5)

Comment thread internal/usecase/devices/interceptor.go Outdated
Comment thread internal/usecase/devices/repo.go
…675) (#676)

- Device POST upserts: on a duplicate GUID, merge the supplied fields
  into the stored device and return 200 instead of 409.
- Read AMT_PASSWORD and MPS_PASSWORD from Vault at devices/{guid} when
  no password is stored, for device management, AMT Explorer, CIRA and
  redirection.
- Do not write a Vault-only password back to the device row, so Vault
  stays the source of truth.

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.

Copilot review overview

🟡 Changes recommended

Two unresolved findings remain: a critical WSMAN worker-blocking Vault lookup and a moderate persistence race.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (2)
Files not reviewed (1)
  • internal/mocks/devicemanagement_mocks.go: Generated file

device.Password = decryptedPassword
device.Password = password

device = g.creds.ApplyAMT(device)
@amarnath-ac

Copy link
Copy Markdown
Contributor Author

created separated PR for upsert (##1283) and vault (##1284).

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.

2 participants