Commit Graph

134 Commits

Author SHA1 Message Date
GitLab Bot 759bab0585 Add latest changes from gitlab-org/gitlab@master 2019-11-08 15:06:21 +00:00
GitLab Bot 1adb4373ba Add latest changes from gitlab-org/gitlab@master 2019-11-08 00:05:58 +00:00
GitLab Bot d8ccc7a00b Add latest changes from gitlab-org/gitlab@master 2019-11-07 18:06:21 +00:00
GitLab Release Tools Bot a7329f4372 Merge branch 'security-remove-leaky-401-responses-master' into 'master'
Private/internal repository enumeration via bruteforce on a vulnerable URL

See merge request gitlab/gitlabhq!3454
2019-10-29 15:58:14 +00:00
GitLab Bot b3f7042d06 Add latest changes from gitlab-org/gitlab@master 2019-10-23 15:06:29 +00:00
GitLab Bot 09ffaae132 Add latest changes from gitlab-org/gitlab@master 2019-10-23 12:06:18 +00:00
GitLab Bot 4682f5015a Add latest changes from gitlab-org/gitlab@master 2019-10-18 21:06:37 +00:00
GitLab Bot 308146dc39 Add latest changes from gitlab-org/gitlab@master 2019-10-10 00:06:44 +00:00
Kerri Miller 8395032721 Avoid #authenticate_user! in #route_not_found
This method, #route_not_found, is executed as the final fallback for
unrecognized routes (as the name might imply.) We want to avoid
`#authenticate_user!` when calling `#route_not_found`;
`#authenticate_user!` can, depending on the request format, return a 401
instead of redirecting to a login page. This opens a subtle security
exploit where anonymous users will receive a 401 response when
attempting to access a private repo, while a recognized user will
receive a 404, exposing the existence of the private, hidden repo.
2019-10-09 10:47:45 -07:00
GitLab Bot 4309992515 Add latest changes from gitlab-org/gitlab@master 2019-09-26 21:06:29 +00:00
GitLab Bot 5707f305f4 Add latest changes from gitlab-org/gitlab@master 2019-09-26 12:06:00 +00:00
GitLab Bot 1cfd8874ee Add latest changes from gitlab-org/gitlab@master 2019-09-25 09:06:04 +00:00
GitLab Bot f1a5755898 Add latest changes from gitlab-org/gitlab@master 2019-09-24 15:06:34 +00:00
GitLab Bot bd860c22f6 Add latest changes from gitlab-org/gitlab@master 2019-09-17 12:06:48 +00:00
GitLab Bot d2798d607e Add latest changes from gitlab-org/gitlab@master 2019-09-16 12:06:26 +00:00
George Koltsov 10b2383f02 Exclude json content type from workhorse interception 2019-08-14 12:07:42 +01:00
Peter Leitzen 7b87ed1499 Cleanup usages of `JSON.parse` in specs
Prefer `json_response` where applicable.
2019-07-16 08:03:49 +00:00
Kartikey Tanna 53af3e6b9e #57815 Password authentication disabled for UltraAuth users
Disabled password authentication for the users registered using
omniauth-ultraauth strategy
2019-06-18 16:18:14 +00:00
James Edwards-Jones 866f544c3e Avoid setting Gitlab::Session on sessionless requests 2019-06-05 19:07:20 +01:00
Kartikey Tanna fa3aa0c5a7 #61441 Allow user to set email ID before setting up 2FA 2019-05-22 07:59:15 +00:00
Andrew Newdigate 4f4de36cac Migrate correlation and tracing code to LabKit
This change is a fairly straightforward refactor to extract the tracing
and correlation-id code from the gitlab rails codebase into the new
LabKit-Ruby project.

The corresponding import into LabKit-Ruby was in
https://gitlab.com/gitlab-org/labkit-ruby/merge_requests/1

The code itself remains very similar for now.

Extracting it allows us to reuse it in other projects, such as
Gitaly-Ruby. This will give us the advantages of correlation-ids and
distributed tracing in that project too.
2019-04-18 09:57:16 +02:00
gfyoung 93a44e135b Add some frozen string to spec/**/*.rb
Adds frozen string to the following:

* spec/bin/**/*.rb
* spec/config/**/*.rb
* spec/controllers/**/*.rb

xref https://gitlab.com/gitlab-org/gitlab-ce/issues/59758
2019-04-15 10:17:05 +00:00
Rémy Coutable d193318338
Fix ETag caching not being used for AJAX requests
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-02-26 12:54:31 +01:00
Rémy Coutable 3a2abc1d50
Enable the Layout/ExtraSpacing cop
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-01-24 13:05:45 +01:00
Luke Bennett 3bd306ddfa
Show the correct error page when access is denied 2019-01-15 20:42:10 +00:00
blackst0ne b44a2c801a Update specs to rails5 format
Updates specs to use new rails5 format.

The old format:
`get :show, { some: params }, { some: headers }`

The new format:
`get :show, params: { some: params }, headers: { some: headers }`
2018-12-19 10:04:31 +11:00
Jasper Maes 56296f1eda Remove rails4 specific code 2018-12-16 10:48:41 +01:00
Kamil Trzciński ebb5d9f4db Revert "Prefer to use correlation-id in logs"
This reverts commit 3560b11922.
2018-12-06 21:46:31 +01:00
Kamil Trzciński 3560b11922 Prefer to use correlation-id in logs
This changes `correlation_id` to be `correlation-id` when passed via jobs
2018-12-06 20:49:31 +01:00
Kamil Trzciński 39c1731a53 Log and pass correlation-id between Unicorn, Sidekiq and Gitaly
The Correlation ID is taken or generated from received X-Request-ID.
Then it is being passed to all executed services (sidekiq workers
or gitaly calls).

The Correlation ID is logged in all structured logs as `correlation_id`.
2018-12-06 20:46:14 +01:00
Jasper Maes 1bb4ad9262 Fix deprecation: render :text is deprecated because it does not actually render a text/plain response 2018-11-29 08:05:13 +01:00
Cindy Pallares fe5f75930e
Merge branch 'security-fix-pat-web-access' into 'master'
[master] Resolve "Personal access token with only `read_user` scope can be used to authenticate any web request"

See merge request gitlab/gitlabhq!2583
2018-11-28 19:13:59 -05:00
Imre Farkas 02326fa4b1
Backport of ee/8120: Smartcard authentication 2018-11-18 21:00:28 +01:00
James Lopez 782badd0a2
Fix content caching for non auth users 2018-10-23 16:22:12 +02:00
Jan Provaznik c6a4c9231e Use InvalidUTF8ErrorHandler only for rails 4
In Rails 5 catches invalid UTF8 characters in querystring in a
params middleware, errors are handled by a params middleware and
raises a BadRequest exception. This means that these UTF8 errors
are not raised deeper in application stack and these can't also
be handled on application level.

If we would want to have custom handler for these errors, we would
have to create a new middleware and insert it before actionpack's
params middleware and rescue BadRequest exceptions there. But there
is no need to do this currently (see discussion on
https://gitlab.com/gitlab-org/gitlab-ce/issues/51908)
2018-10-13 19:45:27 +02:00
Zeger-Jan van de Weg 30b4ce940d
Remove Git circuit breaker
Was introduced in the time that GitLab still used NFS, which is not
required anymore in most cases. By removing this, the API it calls will
return empty responses. This interface has to be removed in the next
major release, expected to be 12.0.
2018-10-10 09:08:18 +02:00
David fea4efe42f Add custom header for error responses 2018-10-01 17:43:40 +00:00
Felipe Artur 1fcc7f9ba2 Render 412 for invalid UTF-8 parameters
Renders 412 error page when invalid UTF-8 is passed
as parameters in controllers.
2018-09-22 12:15:53 -03:00
Stan Hu a7e2f96b59 Fix logins via OAuth2 geting logged out in an hour
Users without GitLab 2FA enabled would be logged out after an hour
due to a regression in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/20700.

The OAuth2 controller sets the current_user after the controller is finished, so
we should only limit session times after this has been done.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/50210
2018-08-10 14:41:59 -07:00
Peter Leitzen ffcf50c872 Don't set gon variables in JSON requests 2018-08-07 21:28:57 +00:00
Sean McGivern e6dd3c5276 Merge branch 'feature/gb/login-activity-metrics' into 'master'
Add user authentication activity metrics

Closes #47789

See merge request gitlab-org/gitlab-ce!20668
2018-07-31 10:44:22 +00:00
Grzegorz Bizon 00e4d918a3 Add authentication metrics for sessionless sign in 2018-07-27 12:56:34 +02:00
Stan Hu c559c43daf Limit the TTL for anonymous sessions to 1 hour
By default, all sessions are given the same expiration time configured in the
session store (e.g. 1 week). However, unauthenticated users can generate a lot
of sessions, primarily for CSRF verification. It makes sense to reduce the TTL
for unauthenticated to something much lower than the default (e.g. 1 hour) to
limit Redis memory. In addition, Rails creates a new session after login,
so the short TTL doesn't even need to be extended.

Closes #48101
2018-07-18 12:39:51 -07:00
Rémy Coutable 8e0697dae3 Merge branch 'rails5-fix-47804' into 'master'
Rails5 fix stack level too deep

Closes #47804

See merge request gitlab-org/gitlab-ce!19762
2018-06-14 07:03:59 +00:00
Jasper Maes b6996837ea Rails5 fix stack level too deep 2018-06-13 17:45:26 +02:00
Bob Van Landuyt 7fe92d9981 Render access denied without message
The `errors/access_denied` page should not fail to render when no
message is provided.

When accessing something as a sessionless user, we should also display
the terms message if possible.
2018-06-13 17:03:48 +02:00
Stan Hu 5d3abdf9a7 Log response body to production_json.log when a controller responds with a 422 status
We have a number of import errors occurring with 422 errors, and
it's hard to determine why they are happening. This change will
surface the errors in the log lines.

Relates to #47365
2018-06-06 13:16:15 -07:00
Bob Van Landuyt 491e1fc905 Render a 403 when showing an access denied message
When we want to show an access denied message to a user, we don't have
to hide the resource's existence.

So in that case we render a 403, this 403 is not handled by nginx on
omnibus installs, making sure the message is visible to the user.
2018-06-05 10:29:27 +02:00
Imre Farkas 20dfe25c15 Export assigned issues in iCalendar feed 2018-05-31 14:01:04 +00:00
Bob Van Landuyt 7684217d68 Enforces terms in the web application
This enforces the terms in the web application. These cases are
specced:

- Logging in: When terms are enforced, and a user logs in that has not
  accepted the terms, they are presented with the screen. They get
  directed to their customized root path afterwards.
- Signing up: After signing up, the first screen the user is presented
  with the screen to accept the terms. After they accept they are
  directed to the dashboard.
- While a session is active:
  - For a GET: The user will be directed to the terms page first,
    after they accept the terms, they will be directed to the page
    they were going to
  - For any other request: They are directed to the terms, after they
    accept the terms, they are directed back to the page they came
    from to retry the request. Any information entered would be
    persisted in localstorage and available on the page.
2018-05-04 13:54:43 +02:00
Markus Koller 257fd57134 Allow password authentication to be disabled entirely 2017-11-23 13:16:14 +00:00
Tiago Botelho 053a198846 Impersonation no longer gets stuck on password change. 2017-11-20 18:02:41 +01:00
Douwe Maan 294fa6fcdc Remove authentication using user.private_token 2017-11-02 11:39:02 +01:00
Rémy Coutable d5e2f873db Merge branch '35644-refactor-have-http-status-into-have-gitlab-http-status' into 'master'
Refactor `have_http_status` into `have_gitlab_http_status` in the specs

Closes #35644

See merge request gitlab-org/gitlab-ce!14958
2017-10-23 14:55:57 +00:00
Toon Claes d8d7faf68c URI decode Page-Title header to preserve UTF-8 characters 2017-10-20 16:44:29 +00:00
Jacopo 2f40dac352 Refactor `have_http_status` into `have_gitlab_http_status` in the specs 2017-10-20 10:13:18 +02:00
Tiago Botelho 37383d9a9d Rollsback changes made to signing_enabled. 2017-09-01 10:51:40 +01:00
Bob Van Landuyt 3598e60bf2 Add a Circuitbreaker for storage paths 2017-08-04 15:38:48 +02:00
Robin Bobbitt 672a68d372 Fixes needed when GitLab sign-in is not enabled
When sign-in is disabled:
 - skip password expiration checks
 - prevent password reset requests
 - don’t show Password tab in User Settings
 - don’t allow login with username/password for Git over HTTP requests
 - render 404 on requests to Profiles::PasswordsController
2017-07-13 10:08:27 -04:00
Pawel Chojnacki 15b7b9ec41 Add rescue_from(ActionController::UnknownFormat) in Application Controller 2017-06-20 15:53:23 +02:00
Alexis Reigel dfc2542f55 use full caps RSS instead of rss 2017-05-24 22:29:59 +02:00
Alexis Reigel 6efe9c2f14 atom links with rss token instead of private token 2017-05-24 22:29:59 +02:00
Michael Kozono 7d02bcd2e0 Redirect from redirect routes to canonical routes 2017-05-05 12:11:57 -07:00
Robert Speicher d49768296c Auto-correct `RSpec/DescribedClass` violations 2017-05-01 11:13:33 -04:00
Alexis Reigel 1735ed6139 rename cache db column with `_cached` suffix 2017-04-06 10:01:14 +02:00
Markus Koller a49c5d1836 Rename skip_tfa session variable to skip_two_factor 2017-04-06 10:01:13 +02:00
Markus Koller 8e66514056 Rename check_2fa_requirement to check_two_factor_requirement 2017-04-06 10:01:13 +02:00
Markus Koller a3430f011f Support 2FA requirement per-group 2017-04-06 10:01:13 +02:00
Dmitriy Zaporozhets 6683fdcfb0
Add nested groups support to the routing
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-11-23 14:08:36 +02:00
tiagonbotelho 519275c110 fixes part1 of files to start using active tense 2016-08-09 15:06:23 +01:00
Grzegorz Bizon 9e211091a8 Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
Z.J. van de Weg abca19da8b Use HTTP matchers if possible 2016-06-27 20:10:42 +02:00
Timothy Andrew 0dff6fd714 Fix rubocop spec. 2016-06-03 10:11:36 +05:30
Timothy Andrew b4b0248577 Parts of spec names with "when" should be contexts. 2016-06-03 09:00:39 +05:30
Timothy Andrew 05b319b0b4 Perform private token and personal access token authentication in the same `before_action`.
- So that the check for valid personal access tokens happens only if
  private token auth fails.
2016-06-01 14:04:38 +05:30
Timothy Andrew d915e7d5ca Reuse the private token param and header for personal access tokens.
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3749#note_11626427
- Personal access tokens are still a separate entity as far as the
  codebase is concerned - they just happen to use the same entry point
  as private tokens.
- Update tests and documentation to reflect this change
2016-05-11 10:16:23 +05:30
Timothy Andrew bafbf22c6a Address @DouweM's feedback on !3749.
- Use `TokenAuthenticatable` to generate the personal access token
- Remove a check for `authenticity_token` in application controller;
  this should've been `authentication_token`, maybe, and doesn't make
  any sense now.
- Have the datepicker appear inline
2016-04-28 22:28:36 +05:30
Timothy Andrew ade40fdcd2 Authenticate non-API requests with personal access tokens.
- Rename the `authenticate_user_from_token!` filter to
  `authenticate_user_from_private_token!`
- Add a new `authenticate_user_from_personal_access_token!` filter
- Add tests for both.
2016-04-28 22:28:36 +05:30
Douwe Maan 7c51d5efec Fix some specs 2016-03-20 22:55:08 +01:00
Stan Hu 07efb17e10 Fix 403 Access Denied error messages when accessing Labels section in a project that has MRs disabled but issues enabled
Closes #1813
2015-06-18 03:15:05 -07:00
Jeroen van Baarsen 0c4a70a306 Updated rspec to rspec 3.x syntax
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2015-02-12 19:17:35 +01:00
Ciro Santilli a7e0ca9e83 Add trailing newline to all text files.
Present in the large majority of files of each respective type.
2014-06-21 11:20:22 +02:00
skv d89527839e fix most of warnings 2013-12-15 00:05:10 +04:00
Izaak Alpert ca1b67ce38 Don't show users password change page if ldap users 2013-09-17 22:38:08 -04:00