Skip to content

Commit ecf5bcd

Browse files
committed
Be verbose about fields a client might try to set
1 parent 71accc4 commit ecf5bcd

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

lib/endpoints/accesskeys.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,13 @@ function create(req, res, next) {
9393
// create a non-permanent key, make it obvious that it isn't supported.
9494
if (req.params.credentialtype &&
9595
req.params.credentialtype !== 'permanent') {
96-
next(new InternalError('credentialtype cannot be set via CloudAPI'));
96+
next(new ForbiddenError('credentialtype cannot be set via CloudAPI'));
97+
return;
98+
}
99+
100+
// Make it clear that expiration cannot be set.
101+
if (req.params.expiration) {
102+
next(new ForbiddenError('expiration cannot be set via CloudAPI'));
97103
return;
98104
}
99105

@@ -344,6 +350,17 @@ function update(req, res, next) {
344350
params.description = req.params.description;
345351
}
346352

353+
// Make it clear that credential type and expiration cannot be changed.
354+
if (req.params.credentialtype) {
355+
next(new ForbiddenError('credentialtype cannot be set via CloudAPI'));
356+
return;
357+
}
358+
359+
if (req.params.expiration) {
360+
next(new ForbiddenError('expiration cannot be set via CloudAPI'));
361+
return;
362+
}
363+
347364
try {
348365
ufds.updateAccessKey(user, account, params,
349366
function _updateAccessKeyCb(err, accesskey) {

0 commit comments

Comments
 (0)