Commit Graph

175 Commits

Author SHA1 Message Date
GitLab Bot 8a55c3263f Add latest changes from gitlab-org/gitlab@master 2020-11-04 21:08:43 +00:00
GitLab Bot 038366a093 Add latest changes from gitlab-org/gitlab@master 2020-10-30 15:08:59 +00:00
GitLab Bot db4ee69eb3 Add latest changes from gitlab-org/gitlab@master 2020-10-12 03:08:20 +00:00
GitLab Bot cf37ae7acd Add latest changes from gitlab-org/gitlab@master 2020-10-07 12:09:12 +00:00
GitLab Bot 6ab9cdec26 Add latest changes from gitlab-org/gitlab@master 2020-10-06 12:08:38 +00:00
GitLab Bot 2fe341d705 Add latest changes from gitlab-org/gitlab@master 2020-10-05 09:08:17 +00:00
GitLab Bot 895563036a Add latest changes from gitlab-org/gitlab@master 2020-10-02 03:08:28 +00:00
GitLab Bot d57e27ef35 Add latest changes from gitlab-org/gitlab@master 2020-10-01 15:10:05 +00:00
GitLab Bot 635d82b15d Add latest changes from gitlab-org/gitlab@master 2020-10-01 09:09:54 +00:00
GitLab Bot e6bcd6e738 Add latest changes from gitlab-org/gitlab@master 2020-09-25 09:09:40 +00:00
GitLab Bot 7a8d983c19 Add latest changes from gitlab-org/gitlab@master 2020-09-24 09:09:35 +00:00
GitLab Bot dc86d5615e Add latest changes from gitlab-org/gitlab@master 2020-09-18 12:09:50 +00:00
GitLab Bot 6b9b8a52ba Add latest changes from gitlab-org/gitlab@master 2020-09-16 06:09:24 +00:00
GitLab Bot 6b5f961bef Add latest changes from gitlab-org/gitlab@master 2020-09-11 09:08:44 +00:00
GitLab Bot a865379008 Add latest changes from gitlab-org/gitlab@master 2020-09-07 12:08:27 +00:00
GitLab Bot 58b9df24e6 Add latest changes from gitlab-org/gitlab@master 2020-09-05 03:08:31 +00:00
GitLab Bot 4b9ace6c1f Add latest changes from gitlab-org/gitlab@master 2020-09-02 09:10:23 +00:00
GitLab Bot a0b26c6df5 Add latest changes from gitlab-org/gitlab@master 2020-06-29 12:09:20 +00:00
GitLab Bot b7e512c897 Add latest changes from gitlab-org/gitlab@master 2020-06-23 12:09:20 +00:00
GitLab Bot a2dbe2a8d8 Add latest changes from gitlab-org/gitlab@master 2020-06-16 21:08:20 +00:00
GitLab Bot 6478698293 Add latest changes from gitlab-org/gitlab@master 2020-06-09 21:08:21 +00:00
GitLab Bot 3d04746954 Add latest changes from gitlab-org/gitlab@master 2020-06-09 18:08:28 +00:00
GitLab Bot 7258040618 Add latest changes from gitlab-org/gitlab@master 2020-06-09 00:08:47 +00:00
GitLab Bot 908a54b624 Add latest changes from gitlab-org/gitlab@master 2020-06-05 21:08:27 +00:00
GitLab Bot eea1fbf9f9 Add latest changes from gitlab-org/gitlab@master 2020-06-02 15:08:24 +00:00
GitLab Bot a78d7d5c66 Add latest changes from gitlab-org/gitlab@master 2020-05-27 00:08:11 +00:00
GitLab Bot 1cf95147ea Add latest changes from gitlab-org/gitlab@master 2020-05-22 18:08:21 +00:00
GitLab Bot 21539fe9ab Add latest changes from gitlab-org/gitlab@master 2020-05-22 00:08:07 +00:00
GitLab Bot e5731d5194 Add latest changes from gitlab-org/gitlab@master 2020-05-15 09:07:59 +00:00
GitLab Bot a5650b86b5 Add latest changes from gitlab-org/gitlab@master 2020-05-13 21:08:55 +00:00
GitLab Bot c7ba7b9976 Add latest changes from gitlab-org/gitlab@master 2020-05-11 09:09:45 +00:00
GitLab Bot 4279f24a19 Add latest changes from gitlab-org/gitlab@master 2020-05-06 12:09:36 +00:00
GitLab Bot 3795b229ab Add latest changes from gitlab-org/gitlab@master 2020-05-01 00:09:59 +00:00
GitLab Bot e2ee1eec50 Add latest changes from gitlab-org/gitlab@master 2020-04-08 03:09:31 +00:00
GitLab Bot 116d4e56e8 Add latest changes from gitlab-org/gitlab@master 2020-03-26 06:08:40 +00:00
GitLab Bot 0eb4fd2f32 Add latest changes from gitlab-org/gitlab@master 2020-03-19 18:09:17 +00:00
GitLab Bot 77d15aff0e Add latest changes from gitlab-org/gitlab@master 2020-03-19 00:09:27 +00:00
GitLab Bot aaf5961054 Add latest changes from gitlab-org/gitlab@master 2020-03-18 15:09:45 +00:00
GitLab Bot 47ebeef912 Add latest changes from gitlab-org/gitlab@master 2020-03-11 00:09:09 +00:00
GitLab Bot 988b28ec1a Add latest changes from gitlab-org/gitlab@master 2020-03-02 12:07:57 +00:00
GitLab Bot e0fa0638a4 Add latest changes from gitlab-org/gitlab@master 2020-02-27 18:09:21 +00:00
GitLab Bot 211a8c3361 Add latest changes from gitlab-org/gitlab@master 2020-02-07 12:09:13 +00:00
GitLab Bot 27a18afc7d Add latest changes from gitlab-org/gitlab@master 2020-02-04 00:09:04 +00:00
GitLab Bot d0356412df Add latest changes from gitlab-org/gitlab@master 2020-02-01 03:09:04 +00:00
GitLab Bot 6a7005feed Add latest changes from gitlab-org/gitlab@master 2020-01-31 06:08:59 +00:00
GitLab Bot 7cc6872401 Add latest changes from gitlab-org/gitlab@master 2020-01-29 12:09:08 +00:00
GitLab Bot 83a9f472b8 Add latest changes from gitlab-org/gitlab@master 2020-01-24 06:08:51 +00:00
GitLab Bot a5ab3467a7 Add latest changes from gitlab-org/gitlab@master 2020-01-13 15:07:53 +00:00
GitLab Bot afa0ab923d Add latest changes from gitlab-org/gitlab@master 2020-01-09 03:07:56 +00:00
GitLab Bot d203316c80 Add latest changes from gitlab-org/gitlab@master 2020-01-07 21:07:50 +00:00
GitLab Bot d10a462fed Add latest changes from gitlab-org/gitlab@master 2019-12-16 12:07:43 +00:00
GitLab Bot 8cc5f27909 Add latest changes from gitlab-org/gitlab@master 2019-12-13 12:07:41 +00:00
GitLab Bot 17b91a3c6a Add latest changes from gitlab-org/gitlab@master 2019-12-13 09:08:01 +00:00
GitLab Bot 801ced25ff Add latest changes from gitlab-org/gitlab@master 2019-11-25 18:06:04 +00:00
GitLab Bot 8f1f6b374b Add latest changes from gitlab-org/gitlab@master 2019-11-25 12:06:13 +00:00
GitLab Bot 3fc9a8e695 Add latest changes from gitlab-org/gitlab@master 2019-11-15 12:06:12 +00:00
GitLab Bot d8c06be498 Add latest changes from gitlab-org/gitlab@master 2019-11-14 12:06:30 +00:00
GitLab Bot bcdcff7495 Add latest changes from gitlab-org/gitlab@master 2019-11-06 18:06:29 +00:00
Yorick Peterse ad8eea3834
Merge dev.gitlab.org@master into GitLab.com@master 2019-10-30 15:22:45 +01:00
GitLab Bot d64e3a8b28 Add latest changes from gitlab-org/gitlab@master 2019-10-29 12:06:40 +00:00
charlieablett d08a78f4b0 Allow tests to ignore recursion 2019-10-23 15:35:33 +13:00
charlieablett 32cdfb9535 Check for recursion and fail if too recursive
- List all overly-recursive fields
- Reduce recursion threshold to 2
- Add test for not-recursive-enough query
- Use reusable methods in tests
- Add changelog
- Set changeable acceptable recursion level
- Add error check test helpers
2019-10-23 15:35:33 +13:00
GitLab Bot 8e45d25f7d Add latest changes from gitlab-org/gitlab@master 2019-10-16 18:08:01 +00:00
GitLab Bot 80f61b4035 Add latest changes from gitlab-org/gitlab@master 2019-09-18 14:02:45 +00:00
Brett Walker ec2b4bb65d Upgrade graphql gem to 1.9.10
- `edge_nodes` needs to get called on the object
- added `include GlobalID::Identification` in a couple places
- renamed `object` to `item` in spec due to conflict
2019-09-04 21:57:37 +00:00
Brett Walker aa7b1cfc5b Upgrade GraphQL gem to 1.8.17
- Due to https://github.com/exAspArk/batch-loader/pull/32,
we  changed BatchLoader.for into BatchLoader::GraphQL.for
- since our results are wrapped in a BatchLoader::GraphQL,
calling `sync` during authorization is required to get real object
- `graphql` now has it's own authorization system.  Our
`authorized?` method conflicted and required renaming
2019-09-04 17:42:48 +00:00
Brett Walker bdd5b5b695 Replace echo function with a resolver
The `GraphQL::Function` has been deprecated in
favor of resolvers.
2019-08-26 17:43:38 +00:00
Alessio Caiazza 606a1d2d31 Expose namespace storage statistics with GraphQL
Root namespaces have storage statistics.
This commit allows namespace owners to get those stats via GraphQL
queries like the following one

{
  namespace(fullPath: "a_namespace_path") {
    rootStorageStatistics {
      storageSize
      repositorySize
      lfsObjectsSize
      buildArtifactsSize
      packagesSize
      wikiSize
    }
  }
}
2019-08-22 22:08:28 +00:00
Igor 0f46886880 Added submodule links to Submodule type in GraphQL API
This is part of migration of Folder View to Vue
2019-07-17 13:06:19 +00:00
Felipe Artur f0683aab05 Improve Graphql Docs
Adds more friendly docs for GraphQl implementation
2019-07-11 08:06:35 +00:00
charlieablett 675c9b9f6b Address reviewer comments
- Remove Gitaly call check for fields that have a constant complexity
declared
- Add associated test
2019-07-05 10:18:50 +12:00
charlieablett cf1b0d10bc Address reviewer comments
- Add 1 for all fields that call Gitaly (with resolvers or without)
- Clarify comment regarding Gitaly call alert
- Expose predicate `calls_gitaly?` instead of ivar
2019-07-03 22:53:13 +12:00
charlieablett a11fe5de44 Wrap proc properly in gitaly call counts
- Add `calls_gitaly: true` to some fields missing (hey, it works!)
- Clarify proc wrapping
- Add kwargs argument to `mount_mutation`
2019-07-03 22:53:13 +12:00
charlieablett f4890d9078 Alert if `calls_gitaly` declaration missing
- Move `calls_gitaly_check` to public
- Add instrumentation for flagging missing CallsGitaly declarations
- Wrap resolver proc in before-and-after Gitaly counts to get the net
Gitaly call count for the resolver.
2019-07-03 22:53:13 +12:00
Marin Jankovski c20c9e2940
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce 2019-07-03 11:55:56 +02:00
Marin Jankovski 7eae0e9b52 Merge branch 'security-bvl-enforce-graphql-type-authorization' into 'master'
Fix type authorizations in GraphQL

See merge request gitlab/gitlabhq!3170
2019-07-02 06:22:09 +00:00
Nick Thomas 402255c290 Merge branch '9491-graphql-view-design-board-at-version-ce' into 'master'
CE backport for "Show design boards at previous versions in GraphQL"

See merge request gitlab-org/gitlab-ce!30151
2019-07-01 16:48:49 +00:00
Lin Jen-Shin 2321b337f1 Merge branch 'graphql-tree-last-commit' into 'master'
Added commit type to tree GraphQL type

See merge request gitlab-org/gitlab-ce!29412
2019-06-28 10:02:57 +00:00
Phil Hughes d78f7ceac9
Added commit type to tree GraphQL type 2019-06-28 08:30:29 +01:00
Luke Duncalfe dae02286ba CE backport for changes in EE MR 14292
EE MR https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/14292
https://gitlab.com/gitlab-org/gitlab-ee/issues/9491
2019-06-28 17:02:03 +12:00
Luke Duncalfe 4b9b2a43d0 GraphQL mutations for add, remove and toggle emoji
Adding new `AddAwardEmoji`, `RemoveAwardEmoji` and `ToggleAwardEmoji`
GraphQL mutations.

Adding new `#authorized_find_with_pre_checks!` and (unused, but for
completeness `#authorized_find_with_post_checks!`) authorization
methods. These allow us to perform an authorized find, and run our own
additional checks before or after the authorization runs.

https://gitlab.com/gitlab-org/gitlab-ce/issues/62826
2019-06-28 12:03:33 +12:00
Luke Duncalfe bbdcbd98ae Remove unused authorized_find method
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/29921#note_184713939
2019-06-26 10:15:14 +12:00
Luke Duncalfe b2a615c3c6 Sanity check for GraphQL authorized?
Raise an exception if a developer calls any of the GraphQL authorization
methods and a `authorize :permission` is missing from a mutation class.

Previously `authorized?` would return `true` in this situation, which
although technically is accurate is not what a developer is intending.
2019-06-26 10:12:35 +12:00
Bob Van Landuyt 967cbd0834 Enforce authorizations for non-nullable fields
This makes sure we also enforce authorizations for non-nullable
fields.

We are defining our authorizations on the unwrapped
types (Repository). But when a type like that is presented in a
non-nullable field, it's type is different (Repository!). The
non-nullable type would not have the authorization metadata.

This makes sure we check the metadata on the unwrapped type for
finding authorizations.
2019-06-21 13:00:50 +02:00
Bob Van Landuyt 406808583c Render GFM html in GraphQL
This adds a `markdown_field` to our types.

Using this helper will render a model's markdown field using the
existing `MarkupHelper` with the context of the GraphQL query
available to the helper.

Having the context available to the helper is needed for redacting
links to resources that the current user is not allowed to see.

Because rendering the HTML can cause queries, the complexity of a
these fields is raised by 5 above the default.

The markdown field helper can be used as follows:

      ```
      markdown_field :note_html, null: false
      ```

This would generate a field that will render the markdown field `note`
of the model. This could be overridden by adding the `method:`
argument. Passing a symbol for the method name:

      ```
      markdown_field :body_html, null: false, method: :note
      ```

It will have this description by default:

> The GitLab Flavored Markdown rendering of `note`

This could be overridden by passing a `description:` argument.

The type of a `markdown_field` is always `GraphQL::STRING_TYPE`.
2019-06-20 08:02:33 +00:00
Bob Van Landuyt c70f7ec77b Rename `BatchCommitLoader` to `BatchLfsOidLoader`
Since we're not actually  loading commits in that loader, but we're
loading blobs with LFS oids in batch and returning only the oids.
2019-06-11 16:11:21 +02:00
Phil Hughes 522c01972c
Add LFS blob ID to GraphQL blob type 2019-06-10 09:05:44 +01:00
Nick Thomas 327c7d5a07 Merge branch 'graphql-file-entry-url' into 'master'
Add web_url to tree entry in GraphQL API

See merge request gitlab-org/gitlab-ce!28646
2019-06-05 15:44:53 +00:00
Phil Hughes 4644a2daf5
Add web_url to tree entry in GraphQL API 2019-06-05 08:46:32 +01:00
Bob Van Landuyt ed503d51a3 Expose IDs in GraphQL as a GlobalID
This exposes all fields named `id` as GlobalIDs so they can be used
across our entire GraphQL implementation.

When the objects loaded are `ApplicationRecord`s. We'll use our
existing batchloading to find them. Otherwise, we'll fall back to the
default implementation of `GlobalID`: Calling the `.find` method on
the class.
2019-06-03 21:59:25 +02:00
Alessio Caiazza 83a8b77961 Add Namespace and ProjectStatistics to GraphQL API
We can query namespaces, and nested projects.

Projects now exposes statistics
2019-06-03 12:01:32 +02:00
charlie ablett 699532232c Apply reviewer feedback
- Comply doc with guidelines
- Improve tests for readability and completeness
- Separate out phases visually with newlines
- Add `format_message` test
- test readability
- code and test structure/styling
- static query analyzers
- call `as_json` on `provided_variables`
- add exception handling
2019-05-31 19:57:02 +12:00
charlieablett 5f0c230a18 Move complexity/depth to `final_value`
Tidy tests according to reviewer comments.
Move complexity and depth calls from `initial_value` to `final_value`
Log variables as json
2019-05-30 18:27:42 +12:00
charlieablett 184a5120dc Call analyzers from LoggerAnalyzer
- Add changelog file
- Fix failing tests
2019-05-30 18:27:28 +12:00
charlieablett b94a17e00e Add GraphQL logging feature flag 2019-05-30 18:27:28 +12:00
charlieablett 2a10064167 Restructure complexity analyzer
Remove instance variables for class re-use, test individual methods,
use `monotonic_time`
2019-05-30 18:27:28 +12:00
charlieablett 2c011cb5b4 Implement logger analyzer
- Modify GraphqlLogger to subclass JsonLogger
- Replace the single-line analyser with one that can log all the GraphQL
query related information in one place.
- Implement analyzer behavior with spec
2019-05-30 18:27:28 +12:00
charlieablett 1f37aed1c9 New logfile for graphql queries
Specify dedicated logfile and logger class for GraphQL queries. Move
complexity analyzer to a dedicated class.
2019-05-30 18:27:28 +12:00
Jan Provaznik 96750fac4c Add opentracing integration for graphql
Extends existing graphql's tracer with opentracing measurements. Because
it also adds Tracing::Graphql class (for opentracing), it also renames
Graphql::Tracing class to Graphql::GenericTracing to minimize confusion
with similar class names.
2019-05-02 07:01:14 +00:00
Brett Walker eff42d59bd Check for all scalar types 2019-04-22 18:57:45 -05:00