Skip to content

Commit 31ddf65

Browse files
committed
Add Cache-Control: private, no-store HTTP header to server endpoints that respond with sensitive info.
Fixes #793
1 parent fda0bdb commit 31ddf65

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

authority/admin/api/provisioner.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ func GetProvisioner(w http.ResponseWriter, r *http.Request) {
5555
render.Error(w, err)
5656
return
5757
}
58+
59+
w.Header().Set("Cache-Control", "private, no-store")
5860
render.ProtoJSON(w, prov)
5961
}
6062

@@ -72,6 +74,7 @@ func GetProvisioners(w http.ResponseWriter, r *http.Request) {
7274
render.Error(w, errs.InternalServerErr(err))
7375
return
7476
}
77+
7578
render.JSON(w, &GetProvisionersResponse{
7679
Provisioners: p,
7780
NextCursor: next,
@@ -102,6 +105,8 @@ func CreateProvisioner(w http.ResponseWriter, r *http.Request) {
102105
render.Error(w, admin.WrapErrorISE(err, "error storing provisioner %s", prov.Name))
103106
return
104107
}
108+
109+
w.Header().Set("Cache-Control", "private, no-store")
105110
render.ProtoJSONStatus(w, prov, http.StatusCreated)
106111
}
107112

@@ -198,6 +203,8 @@ func UpdateProvisioner(w http.ResponseWriter, r *http.Request) {
198203
render.Error(w, err)
199204
return
200205
}
206+
207+
w.Header().Set("Cache-Control", "private, no-store")
201208
render.ProtoJSON(w, nu)
202209
}
203210

authority/admin/api/webhook.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ func (war *webhookAdminResponder) CreateProvisionerWebhook(w http.ResponseWriter
127127
return
128128
}
129129

130+
w.Header().Set("Cache-Control", "private, no-store")
130131
render.ProtoJSONStatus(w, newWebhook, http.StatusCreated)
131132
}
132133

@@ -231,5 +232,7 @@ func (war *webhookAdminResponder) UpdateProvisionerWebhook(w http.ResponseWriter
231232
Auth: newWebhook.Auth,
232233
DisableTlsClientAuth: newWebhook.DisableTlsClientAuth,
233234
}
235+
236+
w.Header().Set("Cache-Control", "private, no-store")
234237
render.ProtoJSONStatus(w, whResponse, http.StatusCreated)
235238
}

0 commit comments

Comments
 (0)