49 Commits

Author SHA1 Message Date
Roman Donchenko 4aa0be3df5 Prevent source files from being modified by the Django user (#10575)
Currently, all source files are located in `/home/django`, and owned by
`django`. This means that if there's any vulnerability that lets an
attacker overwrite files in the server, they can replace source files
with their own code, and potentially get that code executed. That's
pretty bad, so I want to harden against that.

Make all source files owned by root, and move them to `/opt/cvat`. Add a
`manage.py` symlink in `/home/django` for backwards compatibility. It
happens that if a script is a symlink, Python does not add the symlink's
directory to `sys.path`, which is great for us, since that lets us avoid
a writable directory on there.

Still, even though `/home/django/manage.py` is owned by root, an
attacker could potentially be able to delete it and replace it with
their own malicious file. To be a bit more safe, replace `~/manage.py`
calls in backend scripts with `django-admin`.

To make sure CVAT can still find the data directory, add a new
environment variable, `CVAT_BASE_DIR` and set it in the Docker image.

This also fixes a minor bug: we no longer override the `HOME`
environment variable in the `Dockerfile`, so now it's automatically set
by `Docker` depending on the current user.
2026-07-23 13:22:24 +03:00
Maxim Zhiltsov 134a5dd92b Audio media access (#10560) 2026-05-18 21:33:21 +03:00
Maxim Zhiltsov bf75521e96 Make test DB dump output more stable (#10605) 2026-05-18 19:51:47 +03:00
Maxim Zhiltsov f03d039681 Audio task creation (#10551) 2026-05-13 22:21:04 +03:00
Maxim Zhiltsov 65c370bb57 Fix chapters for videos without manifest (#10152)
It's possible that some tasks with videos have no manifest. There are
several reasons for that, including manual playback speed manipulation
attepts. CVAT will generate no manifest for such videos, but the
chapters functionality will try to read the chapters from the manifest
regardless. It's technically possible to ignore bad keyframes, but it
can lead to invalid chapters.

- Fixed task access for tasks with videos with bad keyframes
2025-12-24 13:31:41 +02:00
Roman Donchenko 5e8de2e562 Use container.decode instead of container.demux (#10137)
This is a helper method that pretty much just wraps the double loop over
the packets and the frames in a packet. Using it makes the code simpler
and enables better type inference in IDEs, because the PyAV type stubs
are sufficient to infer that `container.decode(video_stream)` returns an
`Iterable[VideoFrame]` (whereas `packet.decode()` is declared to return
`list[SubtitleSet]` for some reason).

Also, add some imports and type annotations to ensure that the IDEs have
types to infer _from_.
2025-12-18 19:37:28 +02:00
Roman Donchenko f794d8254d tests: don't suppress failures in generate_manifest (#10116)
This just makes the failures harder to investigate.
2025-12-12 17:43:16 +02:00
MhhhxX 6b0c940dc5 Marks and navigation buttons for chapters of video files in the player navigation (#9924) 2025-12-10 12:43:02 +03:00
Roman Donchenko fdc3a24b83 tests: use PEP 604 syntax for optionals/unions (#10090)
This is a continuation of #10060.

I also added a couple of `TypeAlias` annotations where appropriate, and
changed the import style in `test_users.py` to be more consistent with
other files.
2025-12-09 13:51:52 +02:00
Roman Donchenko 56a4d22914 Remove imports that were deprecated in Python 3.10 (or earlier) (#10053)
Now that we've dropped Python 3.9 support, we can get rid of these. Some
of these were actually deprecated in Python 3.9 too, but they must've
slipped through after the last cleanup round.

Done with:

ruff check --select=UP006,UP035 --target-version=py310 --fix
--unsafe-fixes

plus a bit of manual cleanup.
2025-11-27 17:51:25 +02:00
Maxim Zhiltsov 650f2b204c Return only own tokens in api/auth/access_tokens (#9950) 2025-10-29 18:59:45 +03:00
Maxim Zhiltsov cf9ce57616 Support api access token auth in cli and sdk (#9563) 2025-10-22 14:29:34 +03:00
Maxim Zhiltsov 9427dc5ef8 API tokens (#9680) 2025-10-16 16:51:03 +03:00
Oleg Valiulin 0e789ecc25 Fix cloud storage tasks tests (#9826) 2025-09-17 15:14:38 +03:00
Maria Khrustaleva 55652ddbb1 Reusable requests functionality (#9230)
**API changes:**
- `POST /api/consensus/merges?rq_id=rq_id` returns 410 status code, this
endpoint no longer supports process status checking
- `GET /api/projects/id/dataset?action=import_status` returns 410 status
code, this endpoint no longer supports process status checking
- `POST /api/projects/backup?rq_id=rq_id` returns 410 status code, this
endpoint no longer supports process status checking
- `POST /api/tasks/backup?rq_id=rq_id` returns 410 status code, this
endpoint no longer supports process status checking
- `PUT /api/tasks/id/annotations?rq_id=rq_id&format=format` returns 410
status code, this endpoint no longer supports process status checking
- `PUT /api/jobs/id/annotations?rq_id=rq_id&format=format` returns 410
status code, this endpoint no longer supports process status checking
- `GET /api/events` is deprecated in favor of the following API:
  - [new] `POST /api/events/export` (returns 202 with Request ID)
  - GET /api/requests/rq_id
- [new] `GET /api/events/download?rq_id=rq_id` (private endpoint, should
be used only as result_url)
- `POST /api/quality/reports/rq_id=rq_id` is deprecated in favor of `GET
/api/requests/rq_id`

**Architecture visible changes:**
- Cache files containing events (created after using the API to export
events as a file) are stored in `/data/cache/export/` instead of
`/data/tmp/`. The `_clear_export_cache` function is deleted, since cache
files are deleted one day after creation (by default) by the
`cleanup_export_cache_directory` cron job.
 
**SDK backward-incompatible changes:**
- [requests_api.list] action/target/subresource filters now have string
type
- Several types were removed:
`DatasetWriteRequest`/`BackupWriteRequest`/`TaskAnnotationsWriteRequest`;
`JobAnnotationsUpdateRequest`/`TaskAnnotationsUpdateRequest`

---------

Co-authored-by: Roman Donchenko <roman@cvat.ai>
2025-05-20 18:01:23 +02:00
Roman Donchenko 9f46fa2e4a Make the dump_objects.py script easier to use in the private repo (#9152)
This involves two things:

1. Make the output directory configurable.
2. Instead of hardcoding resource types, rewrite every file that already
   exists.
2025-04-28 17:47:01 +03:00
Maria Khrustaleva 950f9b62d3 API to download export results (#9075)
This PR introduces the following changes:

- Several server API endpoints have been deprecated or no longer handle
  the process of exporting specific resources:
  - [API] **GET /api/projects/id/dataset?action=import_status** is
    deprecated
  - [API] **GET /api/projects/id/dataset**(no action parameter or action
    != import_status) returns 410 status code - API endpoint no longer used
    to handle export datasets flow
  - [API] **GET /api/projects/id/annotations** returns 410 status code -
    API endpoint no longer used to handle export annotations flow
  - [API] **GET /api/projects/id/backup** returns 410 status code - API
    endpoint no longer used to handle export backups flow
  - [API] **GET /api/tasks/id/backup** returns 410 status code - API
    endpoint no longer used to handle export backups flow
  - [API] **GET /api/tasks/id/annotations?format=<format>** returns 410
    status code - API endpoint no longer used to handle export annotations
    flow
  - [API] **GET /api/tasks/d/dataset** returns 410 status code - API
    endpoint no longer used to handle export datasets flow
  - [API] **GET /api/jobs/id/annotations?format=<format>** returns 410
    status code - API endpoint no longer used to handle export annotations
    flow
  - [API] **GET /api/jobs/id/dataset** returns 410 status code - API
    endpoint no longer used to handle export datasets flow

- Introduced new "private" endpoints to download prepared files (they
are hidden in the generated server schema):
  - [API] GET /api/projects/id/dataset/download?rq_id=rq_id
  - [API] GET /api/projects/id/backup/download?rq_id=rq_id
  - [API] GET /api/tasks/id/dataset/download?rq_id=rq_id
  - [API] GET /api/tasks/id/backup/download?rq_id=rq_id
  - [API] GET /api/jobs/id/dataset/download?rq_id=rq_id
- Changed permissions used when downloading a prepared file (now admin
  and RQ job owner have rights to download a prepared file related to a
  specific background job (it's a questionable topic whether should be
  resource access checked also))
- Added result filename saving to RQ metadata for export-related RQ
  jobs:
  ```
  {
      ...
      "result_filename": str // is used as the final filename when downloading files/uploading to cloud storage
  }
  ```
- Final file name is taken from meta when uploading a file to cloud
  storage (`key` and `key_pattern` args have been removed)
2025-03-13 15:50:29 +02:00
Maxim Zhiltsov 4d06ae1e34 Consensus simple merging (#8953)
- Added support for consensus task and consensus job merging (API and
UI)
- Added simple consensus settings
- Added server tests
- Added new `consensus` RQ queue and worker
- Updated skeleton comparisons: hidden points now also contribute to the
skeleton similarity. Only visibility is taken into account for invisible
points

Limitations:
- Merging is supported for all annotations except 2d and 3d cuboids. 3d
tasks are not supported
- Annotation groups are not supported (each annotation is considered
separate in a group)
- Polygons and masks are not interchangeable (each type is compared only
with the same type)

Co-authored-by: Kirill Lakhov <kirill.lakhov@cvat.ai>
2025-02-21 18:41:24 +02:00
Boris Sekachev 5a99e73efd Drop years from license headers associated to CVAT.ai Corporation (#8968) 2025-01-21 09:31:41 +02:00
Maxim Zhiltsov d7f49ef292 Automate date fixes in test assets (#8943) 2025-01-17 18:59:15 +03:00
Roman Donchenko a56e94b00d tests: remove imports that were deprecated in Python 3.9 (#8643)
And also `abstractstaticmethod`, which was deprecated in 3.3.

This is a continuation of #8626.
2024-11-06 15:51:53 +02:00
Maria Khrustaleva 49ec1d175d Fix task creation with gt_pool validation and cloud storage data (#8539) 2024-10-16 16:26:28 +02:00
Maxim Zhiltsov 12858584c8 Validation API core (#8348) 2024-10-03 12:07:39 +03:00
Maxim Zhiltsov c9754a9223 Per segment chunks (#8272)
<!-- Raise an issue to propose your change
(https://github.com/cvat-ai/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution guide](https://docs.cvat.ai/docs/contributing/).
-->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
<!-- Why is this change required? What problem does it solve? If it
fixes an open
issue, please link to the issue here. Describe your changes in detail,
add
screenshots. -->

- Changed chunk generation from per-task chunks to per-segment chunks
- Fixed a memory leak in video reading on the server side (only in
media_extractors, so there are several more left)
- Fixed a potential hang in `import` worker or the server process on
process shutdown
- Disabled multithreading in video reading in endpoints (not in static
chunk generation)
- Refactored static chunk generation code (moved after job creation)
- Refactored various server internal APIs for frame retrieval
- Updated UI logic to access chunks, added support for non-sequential
frames in chunks
- Added a new server configuration option `CVAT_ALLOW_STATIC_CACHE`
(boolean) to enable and disable static cache support. The option is
disabled by default (it's changed from the previous behavior)
- Added tests for the changes made
- Added missing original chunk type field in job responses
- Fixed invalid kvrocks cleanup in tests for Helm deployment
- Added a new 0-based `index` parameter in `GET
/api/jobs/{id}/data/?type=chunk` to simplify indexing
  - GT job chunks with non-sequential frames have no placeholders inside

When this update is applied to the server, there will be a data storage
setting migration for the tasks. Existing tasks using static chunks
(`task.data.storage_method == FILE_SYSTEM`) will be switched to the
dynamic cache (i.e. to `== CACHE)`). The remaining files should be
removed manually, there will be a list of such tasks in the migration
log file.

After this update, you'll have an option to enable or disable static
cache use during task creation. This allows, in particular, prohibit new
tasks using the static cache. With this option, any tasks using static
cache will use the dynamic cache instead on data access.

User-observable changes:
- Job chunk ids now start from 0 for each job instead of using parent
task ids
- The `use_cache = false` or `storage_method = filesystem` parameters in
task creation can be ignored by the server
- Task chunk access may be slower for some chunks (particularly, for
tasks with overlap configured, for chunks on segment boundaries, and for
tasks previously using static chunks)
- The last chunk in a job will contain only the frames from the current
job, even if there are more frames in the task

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [ ] I submit my changes into the `develop` branch
- [ ] I have created a changelog fragment <!-- see top comment in
CHANGELOG.md -->
- [ ] I have updated the documentation accordingly
- [ ] I have added tests to cover my changes
- [ ] I have linked related issues (see [GitHub docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))
- [ ] I have increased versions of npm packages if it is necessary

([cvat-canvas](https://github.com/cvat-ai/cvat/tree/develop/cvat-canvas#versioning),

[cvat-core](https://github.com/cvat-ai/cvat/tree/develop/cvat-core#versioning),

[cvat-data](https://github.com/cvat-ai/cvat/tree/develop/cvat-data#versioning)
and

[cvat-ui](https://github.com/cvat-ai/cvat/tree/develop/cvat-ui#versioning))

### License

- [ ] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

- **New Features**
- Introduced a new server setting to disable media chunks on the local
filesystem.
- Enhanced frame prefetching with a `startFrame` parameter for improved
chunk calculations.
- Added a new property, `data_original_chunk_type`, for enhanced job
differentiation in the metadata.

- **Bug Fixes**
- Resolved memory management issues to prevent leaks during video
processing.
	- Corrected naming inconsistencies related to the `prefetchAnalyzer`.

- **Documentation**
- Included configuration for code formatting tools to ensure consistent
code quality across the project.

- **Refactor**
- Restructured classes and methods for improved clarity and
maintainability, particularly in media handling and task processing.

- **Chores**
- Updated formatting scripts to include additional directories for
automated code formatting.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-09-24 17:44:15 +03:00
Maria Khrustaleva 878bb413b5 Update high-level SDK used for exporting project|task|job datasets|backups (#8255)
- Fixed exporting the same dataset or backup twice in a row using
high-level SDK (switched to new export API version) (related
https://github.com/cvat-ai/cvat/issues/8256)
- Fixed exporting a dataset or backup using high-level SDK when the
default project or task location refers to cloud storage
- Added ability to explicitly specify location when exporting datasets
and backups using high-level SDK

## Summary by CodeRabbit

- **New Features**
- Introduced mixins for exporting datasets and downloading backups,
enhancing functionality across multiple classes.
- Added a new fixture for testing tasks with specified target storage,
improving test coverage.

- **Bug Fixes**
- Improved error handling in the file download process to ensure
validity before proceeding.

- **Refactor**
- Restructured the downloading mechanism for better modularity and
maintainability.
- Removed outdated methods in favor of mixin functionality, streamlining
class design.

- **Tests**
- Enhanced the test suite with additional scenarios and flexibility for
task management and dataset downloading.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Maxim Zhiltsov <zhiltsov.max35@gmail.com>
2024-08-30 12:37:17 +02:00
Kirill Lakhov c9f1cff1c0 Requests page (#8095)
This PR introduces new page with information about data
processing(status and progress). For now it will support: task creation,
import/export.

For previous discussions refer to: #7537

Co-authored-by: Maria Khrustaleva <maria@cvat.ai>
Co-authored-by: Boris Sekachev <sekachev.bs@gmail.com>
2024-07-04 19:01:35 +03:00
Roman Donchenko 5d36d10e49 Merge pull request from GHSA-jpf9-646h-4px7
* Mitigate a CSRF vulnerability in export and backup-related endpoints

While Django has built-in CSRF protection (which we use), it does not cover
GET requests, and AFAICS, there is no way to force it to do that.
Unfortunately, the many endpoints that initiate dataset exports and backups
do accept GET requests _and_ initiate side effects, making them susceptible.

The proper fix for this issue would be to redesign those endpoints to use
POST requests, but a) that's more complicated, and b) we should still keep
the old endpoints for backwards compatibility.

So apply a less proper fix, which is to disable session authentication for
the affected endpoints. It's a bit complex, because in some cases
(particularly when `action=download`) we _need_ session authentication to
work, because the UI redirects the user to such endpoints.

In addition, modify the handling logic for these endpoints in order to
ensure that when `action=download`, no side effects are triggered.
Previously, `action=download` would still queue an RQ job if none existed.

Even after this, `action=download` will still have two small side effects:

* An existing RQ job will be deleted if its results are out of date.
  I don't think this is a problem, because such a job cannot be used anyway.

* A completed RQ job will be deleted too. This is a problematic design,
  but I don't think an attacker can achieve anything by exploiting this. If
  an attacker maliciously redirects the user to an `action=download` URL,
  then they'll just download the export/backup as usual.

Some tests were making export requests incorrectly, so fix them.

* Add test for the CSRF workaround
2024-06-13 15:17:13 +03:00
Roman Donchenko aec333db7d Fix two problems with the task segmentation algorithm (#7681)
1. When a task has non-zero overlap and exactly as many frames as needed
   to create 1 or more complete segments, the current algorithm generates a
   redundant segment at the end. For example, if size is 5, segment size is
   3, and overlap is 1, it generates segments (0, 2), (2, 4), and (4, 4).

   The algorithm attempts to compensate for this, but it only works in the
   case where the segment size is unspecified (and defaults to the total
   size).

   Update the algorithm to handle this correctly in the general case.

2. The algorithm selects a default overlap size of 5 if the media file
   is a video. However, this might not be a valid value if the task has a
   very small segment size. In this case, a range of undesirable behaviors
   may occur, depending on the segment size:

   * segments getting generated such that more than 2 segments cover a
     single frame;

   * task creation crashing with an exception;

   * a task being created with no segments at all.

   Fix this by clamping the default overlap size the same way as a
   user-specified one.

Fixes #7675.
2024-03-26 18:07:55 +02:00
Roman Donchenko 1bc77671e3 generate_image_file: don't hardcode the file format (#6538)
It doesn't make much sense to encode the image as JPEG if the given file
name is "image.png". Instead, let PIL select the format based on the
requested file name.
2023-07-23 22:59:28 +03:00
Maxim Zhiltsov 31f78d5a4b Fix file matching in annotation import for multiple dots in filenames (#6350)
<!-- Raise an issue to propose your change
(https://github.com/opencv/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution
guide](https://opencv.github.io/cvat/docs/contributing/). -->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
<!-- Why is this change required? What problem does it solve? If it
fixes an open
issue, please link to the issue here. Describe your changes in detail,
add
screenshots. -->

Fixes https://github.com/opencv/cvat/issues/6319

- Fixed invalid dataset root search, leading to invalid file matching
- Restored detailed dataset import error messages
- Added tests

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] I submit my changes into the `develop` branch
- [ ] I have added a description of my changes into the
[CHANGELOG](https://github.com/opencv/cvat/blob/develop/CHANGELOG.md)
file
- [ ] I have updated the documentation accordingly
- [ ] I have added tests to cover my changes
- [ ] I have linked related issues (see [GitHub docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))
- [ ] I have increased versions of npm packages if it is necessary

([cvat-canvas](https://github.com/opencv/cvat/tree/develop/cvat-canvas#versioning),

[cvat-core](https://github.com/opencv/cvat/tree/develop/cvat-core#versioning),

[cvat-data](https://github.com/opencv/cvat/tree/develop/cvat-data#versioning)
and

[cvat-ui](https://github.com/opencv/cvat/tree/develop/cvat-ui#versioning))

### License

- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/opencv/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.
2023-06-29 19:59:04 +03:00
Maxim Zhiltsov 9a600f3fa8 Honey pot server (#6204)
The server part of #6039 

- Added support for Ground Truth jobs in a task
- Added support for job creation and removal (only Ground Truth jobs can
  be created or removed in a task)
- Added a component to autocompute quality metrics for a task
- Added tests
- Fixed https://github.com/opencv/cvat/issues/5971 (both parts - the
  outside problem and the manifest problem, the manifest part fix is also
  available in #6216)

Co-authored-by: klakhov <kirill.9992@gmail.com>
Co-authored-by: Roman Donchenko <roman@cvat.ai>
Co-authored-by: Kirill Sizov <kirill.sizov@cvat.ai>
2023-06-12 14:57:14 +03:00
Maria Khrustaleva f7fd06c658 Fixed resources import (#5909)
Fixed:
- wrong location of tmp file when importing job annotations
- ```Traceback (most recent call last):
File
"/home/maya/Documents/cvat/.env/lib/python3.8/site-packages/rq/worker.py",
line 795, in work
      self.execute_job(job, queue)
File "/home/maya/Documents/cvat/cvat/rqworker.py", line 37, in
execute_job
      return self.perform_job(*args, **kwargs)
File
"/home/maya/Documents/cvat/.env/lib/python3.8/site-packages/rq/worker.py",
line 1389, in perform_job
      self.handle_exception(job, *exc_info)
File
"/home/maya/Documents/cvat/.env/lib/python3.8/site-packages/rq/worker.py",
line 1438, in handle_exception
      fallthrough = handler(job, *exc_info)
File "/home/maya/Documents/cvat/cvat/apps/engine/views.py", line 2233,
in rq_exception_handler
      rq_job.exc_info = "".join(
  AttributeError: can't set attribute
  ```

Resolves https://github.com/opencv/cvat/issues/5773
Resolves https://github.com/opencv/cvat/issues/5563

- root causes of the issues: 
  - the annotation file was uploaded to the server by tus protocol and
rq job was created but no one next requests for checking status were not
made. (e.g. user closed the browser tab)
  - the annotation file was uploaded to the server by tus protocol but
rq job has not yet been created (e.g cvat instance restarted)
  - tasks/projects creation from backups with the same name at the
same time by different users

Co-authored-by: Roman Donchenko <roman@cvat.ai>
Co-authored-by: Maxim Zhiltsov <zhiltsov.max35@gmail.com>
2023-06-02 11:54:07 +03:00
Maria Khrustaleva df31dc787d Improve task creation with cloud storage and share data (#6074)
### Motivation and context
Resolved #6037
Related https://github.com/opencv/cvat/issues/4400
Related https://github.com/opencv/cvat/issues/6028


![image](https://user-images.githubusercontent.com/49038720/236890662-c44b578e-5808-4fde-a216-2dcab6e95ab0.png)

Co-authored-by: Boris Sekachev <boris.sekachev@yandex.ru>
Co-authored-by: Boris Sekachev <sekachev.bs@gmail.com>
Co-authored-by: Roman Donchenko <roman@cvat.ai>
Co-authored-by: Nikita Manovich <nikita@cvat.ai>
2023-05-20 11:46:25 +03:00
Maxim Zhiltsov 2709802b7f Fix cloud storage permissions (#5956) 2023-04-05 01:59:25 +03:00
Maria Khrustaleva defb86c526 Refactor import/export tests (#5782) 2023-03-28 13:03:30 +03:00
Maria Khrustaleva 3066c6e540 [Social authentication] Remove server part && tests (#5691) 2023-02-22 21:37:32 +02:00
Maxim Zhiltsov 4fc494f4b8 Remove collections in endpoints (#5662)
This PR is focused on server performance optimization for requests with
collections.
- Collections with user-controlled size are removed from server output
and replaced
with structures providing links to the matching paginated endpoints and
summary info:
  - /api/projects/{id}.tasks -> /api/tasks?project_id={id}
- /api/tasks/{id}.segments -> /api/jobs?task_id={id}: .start_frame,
.stop_frame
  - /api/jobs/{id}.issues -> /api/issues?job_id={id}
  - /api/issues/{id}.comments -> /api/comments?issue_id={id}
- /api/projects | tasks | jobs/{id}.labels -> /api/labels?
project_id|task_id|job_id={id}
- Added Label-related endpoints:
  - /api/labels (GET)
  - /api/labels/{id} (GET, PATCH, DELETE)
    - PATCH and DELETE both cannot be used for sublabels
- Added and updated tests
  - Removed unused test server data
  - Added several new cases with skeletons and ownerships
- Fixed possible problems with duplicate labels appearing on renaming
2023-02-21 17:23:32 +02:00
ddx-day 0f0913c138 Django social account sso (#5059)
Issue: https://github.com/opencv/cvat/issues/1217

Currently there are a few proposals for SSO authentication to bypass the
current user/password login on the UI. By using Django social accounts
it is also possible to use SSO on the API, retrieving the security token
by passing the code from the OAuth2 workflow. This is an example using
Amazon Cognito, but any other social account could also be added.

### Motivation and context
Currently CVAT has no functionality to log in with SSO. Other current
proposals bypass the current Django framework to add SSO in the UI only,
but still use username and password for the API. Using Django social
accounts integrates SSO with the API as well, allowing it to be used as
an alternative to the username and password, but can also be used
together with other SSO frameworks that are UI only.

### How has this been tested?
Unit tests for SSO manager in cvat-core and integration test with
cvat-sdk for /auth/cognito endpoint.

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable by a reason then ~~explicitly
strikethrough~~ the whole
line. If you don't do that github will show an incorrect process for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] I submit my changes into the `develop` branch
- [ ] I have added a description of my changes into
[CHANGELOG](https://github.com/cvat-ai/cvat/blob/develop/CHANGELOG.md)
file
- [x] I have updated the [documentation](
https://github.com/cvat-ai/cvat/blob/develop/README.md#documentation)
accordingly
- [x] I have added tests to cover my changes
- [x] I have linked related issues ([read github docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))
- [ ] I have increased versions of npm packages if it is necessary
([cvat-canvas](https://github.com/cvat-ai/cvat/tree/develop/cvat-canvas#versioning),

[cvat-core](https://github.com/cvat-ai/cvat/tree/develop/cvat-core#versioning),
[cvat-data](https://github.com/cvat-ai/cvat/tree/develop/cvat-data#versioning)
and
[cvat-ui](https://github.com/cvat-ai/cvat/tree/develop/cvat-ui#versioning))

### License

- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.

Co-authored-by: Melanie Day <mday@EYEDIAGNOSIS.local>
Co-authored-by: Maria Khrustaleva <maria@cvat.ai>
Co-authored-by: Nikita Manovich <nikita@cvat.ai>
2023-01-18 16:34:00 +02:00
Maria Khrustaleva 47860c9d22 Remove previews downloading when task creating with cloud storage data (#5499)
PR removes previews downloading from CS when task creating (skipped in
PR #5478). In addition, I had to change the test to check for the file
name existing in the message when the specified file is not found in the
bucket, because now the preview is no longer downloaded at the stage of
creating a task.
2023-01-10 19:45:42 +02:00
Maria Khrustaleva e624c5b959 Simplify upload data for task (#5498)
It's possible to specify only the manifest file and filename pattern for
creating task with cloud storage data.
The special characters supported now for the pattern are `*`, `?`,
`[seq]`, `[!seq]`.
Please see
[here](https://github.com/opencv/cvat/blob/8898a8b2647514dd6f3f6ce83745b1ca8ef72bce/tests/python/rest_api/test_tasks.py#L686)
for some examples of how to use this functionality.

Co-authored-by: Maxim Zhiltsov <zhiltsov.max35@gmail.com>
2022-12-27 22:16:30 +02:00
Roman Donchenko 487c60ce2b SDK: Add an adapter layer that presents a CVAT task as a torchvision dataset (#5417) 2022-12-08 17:28:55 +02:00
Maxim Zhiltsov 82adde42aa Refactor resource import export tests (#5429)
Extracted some enhancements from
https://github.com/opencv/cvat/pull/4819

- Extracted common s3 manipulations in tests
- Refactored import/export tests to be more clear
2022-12-08 17:05:03 +02:00
Roman Donchenko 481630e719 Migrate tests/python to from os.path to pathlib (#5426)
`pathlib` improves code readability and type safety. It is already used
in some of the tests; convert all remaining `os.path` usage to `pathlib`
equivalents.
2022-12-05 21:43:09 +02:00
Maria Khrustaleva 9b0d963d1a Fix REST API tests (#5416)
Fixed REST API tests after merging #5408 and #5396 to develop

Co-authored-by: Boris Sekachev <sekachev.bs@gmail.com>
Co-authored-by: Nikita Manovich <nikita@cvat.ai>
2022-12-02 23:49:33 +02:00
Kirill Sizov bcb3f9bda8 Tests for Webhook sender (#5017)
* tests/rest_api/assets: update webhooks in testdb

* tests/rest_api/test_webhook_sender: add tests for project and ping events

* tests/rest_api/test_webhook_sender: add tests for webhook intersection case

* tests/rest_api/test_webhook_sender: add tests for task update events

* tests/rest_api/test_webhook_sender: add tests for task create and job update events

* tests/rest_api/test_webhook_sender: add tests for issue events

* tests/rest_api/test_webhook_sender: add tests for membership events

* tests/rest_api/test_webhook_sender: add tests for organization event

* Fix Pylint warnings

* apps/engine: get rid of sending `create` signals in views

* apps/organizations: get rid of sending `create` signals in views

* tests/rest_api/test_webhooks: fix typo

* apps/engine: get rid of sending  signals in task view

* tests/rest_api: remove debug prints

* apps/engine: fix pylint errors

* tests/rest_api/test_webhooks_sender: add tests for `redelivery` method

* tests: define tag for minio image

* apps/webhooks: remove owner_id from write serializer

* tests/rest_api/test_webhooks: fix code style

* tests/rest_api: added tests for webhook comment events

* tests/rest_api: fix typo

Co-authored-by: Anastasia Yasakova <yasakova_anastasiya@mail.ru>

* tests: fix warnings from black

Co-authored-by: Anastasia Yasakova <yasakova_anastasiya@mail.ru>
2022-10-05 13:01:53 +03:00
Maxim Zhiltsov 6654366021 Autoformat python tests (#5021) 2022-10-03 15:00:29 +03:00
Kirill Sizov bae7564968 Add webhooks (#4863)
Co-authored-by: “klakhov” <kirill.lakhov@cvat.ai>
Co-authored-by: Boris <sekachev.bs@gmail.com>
Co-authored-by: kirill-sizov <kirill.sizov@intel.com>
2022-09-28 22:56:50 +03:00
Maxim Zhiltsov 53697ecac5 SDK layer 2 - cover RC1 usecases (#4813) 2022-08-26 21:29:38 +03:00
Maxim Zhiltsov 5f58a0f7be Add 2nd layer of SDK (#19) 2022-08-16 11:52:15 +03:00