Skip to content

Commit

Permalink
Fixing exposed secret in webhook preview (#370)
Browse files Browse the repository at this point in the history
### Summary
Added `KeepSecrets` where it was missing in marshaling logic, to make
sure Webhook preview doesn't expose secrets.

### Testing
- Manually ran `pulumi up` -> details and verified it no longer shows up
  • Loading branch information
IaroslavTitov authored Aug 6, 2024
1 parent 27a9c1b commit 4c52bda
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Improvements

### Bug Fixes
- Fixing webhook exposing secret values bug [#371](https://github.com/pulumi/pulumi-pulumiservice/issues/371)

### Miscellaneous
8 changes: 4 additions & 4 deletions provider/pkg/provider/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (wh *PulumiServiceWebhookResource) Configure(config PulumiServiceConfig) {
}

func (wh *PulumiServiceWebhookResource) Check(req *pulumirpc.CheckRequest) (*pulumirpc.CheckResponse, error) {
news, err := plugin.UnmarshalProperties(req.GetNews(), plugin.MarshalOptions{KeepUnknowns: true, SkipNulls: true})
news, err := plugin.UnmarshalProperties(req.GetNews(), plugin.MarshalOptions{KeepUnknowns: true, SkipNulls: true, KeepSecrets: true})
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -170,7 +170,7 @@ func (wh *PulumiServiceWebhookResource) Check(req *pulumirpc.CheckRequest) (*pul

inputNews, err := plugin.MarshalProperties(
news,
plugin.MarshalOptions{},
plugin.MarshalOptions{KeepUnknowns: true, SkipNulls: true, KeepSecrets: true},
)
if err != nil {
return nil, err
Expand Down Expand Up @@ -397,15 +397,15 @@ func (wh *PulumiServiceWebhookResource) Read(req *pulumirpc.ReadRequest) (*pulum

outputs, err := plugin.MarshalProperties(
properties.ToPropertyMap(),
plugin.MarshalOptions{},
plugin.MarshalOptions{KeepUnknowns: true, SkipNulls: true, KeepSecrets: true},
)
if err != nil {
return nil, err
}

inputs, err := plugin.MarshalProperties(
properties.PulumiServiceWebhookInput.ToPropertyMap(),
plugin.MarshalOptions{},
plugin.MarshalOptions{KeepUnknowns: true, SkipNulls: true, KeepSecrets: true},
)
if err != nil {
return nil, err
Expand Down

0 comments on commit 4c52bda

Please sign in to comment.