Skip to content

Commit e0ab216

Browse files
committed
fix: assert perms for catalog routes
1 parent d47f04c commit e0ab216

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/routes/catalog/remove.js

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13+
import { assertAuthorization } from '../../utils/auth.js';
1314
import { errorResponse, errorWithResponse } from '../../utils/http.js';
1415
import StorageClient from './StorageClient.js';
1516

@@ -30,6 +31,8 @@ export default async function remove(ctx) {
3031
throw errorWithResponse(400, 'Helix API key is required to delete or unpublish products.');
3132
}
3233

34+
await assertAuthorization(ctx);
35+
3336
const storage = StorageClient.fromContext(ctx);
3437
const deleteResults = await storage.deleteProducts([sku]);
3538

src/routes/catalog/update.js

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import { assertValidProduct, hasUppercase } from '../../utils/product.js';
1414
import { errorResponse } from '../../utils/http.js';
1515
import StorageClient from './StorageClient.js';
16+
import { assertAuthorization } from '../../utils/auth.js';
1617

1718
/**
1819
* Handles a PUT request to update a product.
@@ -40,6 +41,8 @@ export default async function update(ctx) {
4041

4142
assertValidProduct(product);
4243

44+
await assertAuthorization(ctx);
45+
4346
const storage = StorageClient.fromContext(ctx);
4447
const saveResults = await storage.saveProducts([product]);
4548

0 commit comments

Comments
 (0)