Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions app/src/controllers/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ const {
mixedQueryToArray,
toLowerKeys,
getBucket,
renameObjectProperty,
hasOnlyPermittedKeys
renameObjectProperty
} = require('../components/utils');
const utils = require('../db/models/utils');

Expand Down Expand Up @@ -1062,12 +1061,9 @@ const controller = {

if (req.currentUser.authType === AuthType.NONE) {

const permittedPublicSearchParams = ['bucketId', 'objectId', 'public', 'page', 'limit', 'sort'];

// no-auth requests MUST have all of the following:
// (a) only the permitted search params; (b) ?public=true; (c) an object or bucket id
if (!hasOnlyPermittedKeys(req.query, permittedPublicSearchParams) || !params.public ||
!(params.bucketId || params.id)) {
// (a) an object or bucket id; (b) ?public=true; (c) not search by S3 path
if (!(params.bucketId || params.id) || !params.public || params.path) {
throw new Problem(403, {
detail: 'User lacks permission to complete this action',
instance: req.originalUrl
Expand Down
11 changes: 6 additions & 5 deletions app/src/docs/v1.api-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,12 @@ paths:
versions of objects. Search criteria on string attributes will match on
partial results and ignore case sensitivity.

This endpoint can be used without authentication. If so, some response attributes (`path`, `createdBy`, `updatedBy`, and
`lastSynceDate`) are redacted. The following restrictions also apply:
* Only the following query parameters are allowed: `bucketId`, `objectId`, `public`, `page`, `limit`, `sort`
This endpoint may be used without authentication. If so, some response attributes (`path`, `createdBy`, `updatedBy`, and
`lastSyncedDate`) are redacted. The following restrictions also apply:
* An `objectId` or `bucketId` must be provided
* `public` must be `true`
* An `objectId` or `publicId` must be provided
* The `path` parameter is not permitted

operationId: searchObjects
tags:
- Object
Expand Down Expand Up @@ -1836,7 +1837,7 @@ components:
example: ac246e31-c807-496c-bc93-cd8bc2f1b2b4
Query-BucketName:
in: query
name: displayName
name: bucketName
description: A display name given to the bucket on creation
schema:
type: string
Expand Down
Loading