Rename Resource/ResourceGroup via PutAsync + EntityPropertyWrite for safe hidden-field writes - #22
Rename Resource/ResourceGroup via PutAsync + EntityPropertyWrite for safe hidden-field writes#22davidnmbond wants to merge 2 commits into
Conversation
…afe hidden-field writes
PutAsync<T> already supports Resource and ResourceGroup (both IdentifiedItem +
IHasEndpoint), so rename works via a full-object PUT. Add integration tests
proving it, including that a uptimepingcheck rename must set BOTH Name and
DisplayName (a DisplayName-only change silently no-ops on those devices) while
the ping target Host is preserved.
Because LogicMonitor masks secret custom properties (snmp.community, *.pass,
*.key) as ******** on read, round-tripping a whole object would write the mask
back and clobber the real value. Add EntityPropertyWrite (the admin-gated,
config-as-code shape { type, id, name, value }) plus SetCustomPropertyAsync /
SetCustomPropertiesAsync, which write one field at a time and never send the
mask. Portal-free unit tests cover the config deserialisation and endpoint
mapping; an integration test writes snmp.community via EntityPropertyWrite.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 1 high |
| Complexity | 1 medium |
🟢 Metrics 18 complexity
Metric Results Complexity 18
AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
… Resource/ResourceGroup secrets Ran a live experiment on the panoramicdata portal: set a hidden custom property (test.pass), did a full-object GET->PUT round-trip (sending back the masked ********), then read the true stored value via a reveal PropertySource (with a fresh-run marker to rule out staleness). The value was preserved - LogicMonitor treats the ******** mask as "unchanged" on write. So PutAsync-based rename is secret-safe; the earlier "PUT clobbers" rationale was wrong for device/group properties (it originated from a NetScan credentials incident, a different path). EntityPropertyWrite remains the admin-gated, config-as-code way to set/rotate hidden fields (you supply the real value). Docs/comments corrected accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Empirical result: full PUT does not clobber Resource/ResourceGroup secretsRan the clobber experiment on a live portal to settle the masked-secret concern:
Conclusion: LogicMonitor treats the
|
Why
Surfaced while renaming ~294 LogicMonitor ping-check resources (PS-3019). Two things needed proving/adding:
Rename works via
PutAsync<T>.ResourceandResourceGroupare bothIdentifiedItem, IHasEndpoint, soPutAsyncalready supports them. This adds integration tests that prove it, and captures a real footgun: on uptimepingcheck devices a rename must set bothNameandDisplayName(a DisplayName-only change silently no-ops), while the ping target (Host) is preserved.Safe hidden-field writes. LogicMonitor masks secret custom properties (
snmp.community,*.pass,*.key) as********on read, so round-tripping a whole object via PUT would write the mask back and clobber the real value. This addsEntityPropertyWrite— the admin-gated, config-as-code shape:[ { "type": "resourceGroup", "id": 1234, "name": "snmp.community", "value": "public" } ]plus
SetCustomPropertyAsync(EntityPropertyWrite, …)/SetCustomPropertiesAsync(…), which write one field at a time and never send the mask.Changes
EntityPropertyWrite,EntityPropertyWriteTargetType(LogicMonitor.Api/Resources).LogicMonitorClient.SetCustomPropertyAsync(EntityPropertyWrite, SetPropertyMode, ct)andSetCustomPropertiesAsync(IEnumerable<EntityPropertyWrite>, …)— route to the existing per-field property setters.EntityPropertyWriteTests— config deserialisation + endpoint mapping (4 tests, passing).ResourceRenameTests— PutAsync renames a ResourceGroup; PutAsync renames an uptime ping check (Name+DisplayName, Host preserved, skips if Uptime not enabled); hidden field written via EntityPropertyWrite.Notes
🤖 Generated with Claude Code