プロジェクト

全般

プロフィール

Vote #78576

未完了

GET /attachments/download/:id/:filename should deny access

Admin Redmine さんが約2年前に追加. 約2年前に更新.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
Attachments_19
対象バージョン:
-
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
19
version_id:
0
issue_org_id:
26296
author_id:
155846
assigned_to_id:
0
comments:
6
status_id:
1
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
125
ステータス-->[New]

説明

GET /attachments/download/703/android_demo.zip HTTP/1.1
Host: redmine.company.org
Cache-Control: no-cache
X-Redmine-API-Key: INVALID

Returns HTTP Code 200 along with the login page.

It must return HTTP Code 401.
It is an API where login page does not have a relevance.

Redmine version: 3.1.0.stable


journals

It returns 302.

<pre>
$ curl --head http://localhost:3100/test-3.3-stable/attachments/download/7/new.txt -o /dev/null -w '%{http_code}\n' -s
302
$ curl --head --location http://localhost:3100/test-3.3-stable/attachments/download/7/new.txt -o /dev/null -w '%{http_code}\n' -s
200
</pre>
--------------------------------------------------------------------------------
Toshi MARUYAMA wrote:
> It returns 302.
>
> [...]

1
You are testing on a newer version.
2
It is still not the correct http code to return hence the HTTP response status
code 302 Found is a common way of performing URL redirection.
Signaling a 401 Unauthorized is exactly what is expected due to the fact
that you are not authenticated and you do not want a redirect
when you are accessing the API.

The correct code is 401

401 Unauthorized (RFC 7235)
Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet been provided.
The response must include a WWW-Authenticate header field containing a challenge applicable to the requested resource.
See Basic access authentication and Digest access authentication.[32]
401 semantically means "unauthenticated",[33] i.e. the user does not have the necessary credentials.
Note: Some sites issue HTTP 401 when an IP address is banned from the website (usually the website domain) and that
specific address is refused permission to access a website.

--------------------------------------------------------------------------------
Jess Nielsen wrote:
> Toshi MARUYAMA wrote:
> > It returns 302.
> >
> > [...]
>
> 1
> You are testing on a newer version.

source:tags/3.1.0/test/integration/api_test/attachments_test.rb#L72
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

Admin Redmine さんが約2年前に更新

  • カテゴリAttachments_19 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0