Skip to content

Add Debian API endpoint for Packages files

Mathieu Parent requested to merge sathieu/gitlab:debian_packages_endpoint into master

What does this MR do?

Item 3.3.2 of &6057 (comment 582697034).

Query plans

For groups

SELECT
    "packages_debian_group_component_files"."id" AS t0_r0,
    "packages_debian_group_component_files"."created_at" AS t0_r1,
    "packages_debian_group_component_files"."updated_at" AS t0_r2,
    "packages_debian_group_component_files"."component_id" AS t0_r3,
    "packages_debian_group_component_files"."architecture_id" AS t0_r4,
    "packages_debian_group_component_files"."size" AS t0_r5,
    "packages_debian_group_component_files"."file_type" AS t0_r6,
    "packages_debian_group_component_files"."compression_type" AS t0_r7,
    "packages_debian_group_component_files"."file_store" AS t0_r8,
    "packages_debian_group_component_files"."file" AS t0_r9,
    "packages_debian_group_component_files"."file_md5" AS t0_r10,
    "packages_debian_group_component_files"."file_sha256" AS t0_r11,
    "packages_debian_group_components"."id" AS t1_r0,
    "packages_debian_group_components"."created_at" AS t1_r1,
    "packages_debian_group_components"."updated_at" AS t1_r2,
    "packages_debian_group_components"."distribution_id" AS t1_r3,
    "packages_debian_group_components"."name" AS t1_r4,
    "packages_debian_group_distributions"."id" AS t2_r0,
    "packages_debian_group_distributions"."created_at" AS t2_r1,
    "packages_debian_group_distributions"."updated_at" AS t2_r2,
    "packages_debian_group_distributions"."group_id" AS t2_r3,
    "packages_debian_group_distributions"."creator_id" AS t2_r4,
    "packages_debian_group_distributions"."valid_time_duration_seconds" AS t2_r5,
    "packages_debian_group_distributions"."file_store" AS t2_r6,
    "packages_debian_group_distributions"."automatic" AS t2_r7,
    "packages_debian_group_distributions"."automatic_upgrades" AS t2_r8,
    "packages_debian_group_distributions"."codename" AS t2_r9,
    "packages_debian_group_distributions"."suite" AS t2_r10,
    "packages_debian_group_distributions"."origin" AS t2_r11,
    "packages_debian_group_distributions"."label" AS t2_r12,
    "packages_debian_group_distributions"."version" AS t2_r13,
    "packages_debian_group_distributions"."description" AS t2_r14,
    "packages_debian_group_distributions"."encrypted_signing_keys" AS t2_r15,
    "packages_debian_group_distributions"."encrypted_signing_keys_iv" AS t2_r16,
    "packages_debian_group_distributions"."file" AS t2_r17,
    "packages_debian_group_distributions"."file_signature" AS t2_r18
FROM
    "packages_debian_group_component_files"
    INNER JOIN "packages_debian_group_components" ON "packages_debian_group_components"."id" = "packages_debian_group_component_files"."component_id"
    INNER JOIN "packages_debian_group_distributions" ON "packages_debian_group_distributions"."id" = "packages_debian_group_components"."distribution_id"
    LEFT OUTER JOIN "packages_debian_group_architectures" ON "packages_debian_group_architectures"."id" = "packages_debian_group_component_files"."architecture_id"
WHERE
    "packages_debian_group_distributions"."group_id" = 2
    AND ("packages_debian_group_distributions"."codename" = 'existing-codename'
        OR "packages_debian_group_distributions"."suite" = 'existing-codename')
    AND "packages_debian_group_components"."name" = 'existing-component'
    AND "packages_debian_group_component_files"."file_type" = 1
    AND "packages_debian_group_architectures"."name" = 'existing-arch'
    AND "packages_debian_group_component_files"."compression_type" IS NULL
ORDER BY
    "packages_debian_group_component_files"."created_at" DESC
LIMIT 1

https://explain.depesz.com/s/Fnca

For projects

SELECT
    "packages_debian_project_component_files"."id" AS t0_r0,
    "packages_debian_project_component_files"."created_at" AS t0_r1,
    "packages_debian_project_component_files"."updated_at" AS t0_r2,
    "packages_debian_project_component_files"."component_id" AS t0_r3,
    "packages_debian_project_component_files"."architecture_id" AS t0_r4,
    "packages_debian_project_component_files"."size" AS t0_r5,
    "packages_debian_project_component_files"."file_type" AS t0_r6,
    "packages_debian_project_component_files"."compression_type" AS t0_r7,
    "packages_debian_project_component_files"."file_store" AS t0_r8,
    "packages_debian_project_component_files"."file" AS t0_r9,
    "packages_debian_project_component_files"."file_md5" AS t0_r10,
    "packages_debian_project_component_files"."file_sha256" AS t0_r11,
    "packages_debian_project_components"."id" AS t1_r0,
    "packages_debian_project_components"."created_at" AS t1_r1,
    "packages_debian_project_components"."updated_at" AS t1_r2,
    "packages_debian_project_components"."distribution_id" AS t1_r3,
    "packages_debian_project_components"."name" AS t1_r4,
    "packages_debian_project_distributions"."id" AS t2_r0,
    "packages_debian_project_distributions"."created_at" AS t2_r1,
    "packages_debian_project_distributions"."updated_at" AS t2_r2,
    "packages_debian_project_distributions"."project_id" AS t2_r3,
    "packages_debian_project_distributions"."creator_id" AS t2_r4,
    "packages_debian_project_distributions"."valid_time_duration_seconds" AS t2_r5,
    "packages_debian_project_distributions"."file_store" AS t2_r6,
    "packages_debian_project_distributions"."automatic" AS t2_r7,
    "packages_debian_project_distributions"."automatic_upgrades" AS t2_r8,
    "packages_debian_project_distributions"."codename" AS t2_r9,
    "packages_debian_project_distributions"."suite" AS t2_r10,
    "packages_debian_project_distributions"."origin" AS t2_r11,
    "packages_debian_project_distributions"."label" AS t2_r12,
    "packages_debian_project_distributions"."version" AS t2_r13,
    "packages_debian_project_distributions"."description" AS t2_r14,
    "packages_debian_project_distributions"."encrypted_signing_keys" AS t2_r15,
    "packages_debian_project_distributions"."encrypted_signing_keys_iv" AS t2_r16,
    "packages_debian_project_distributions"."file" AS t2_r17,
    "packages_debian_project_distributions"."file_signature" AS t2_r18
FROM
    "packages_debian_project_component_files"
    INNER JOIN "packages_debian_project_components" ON "packages_debian_project_components"."id" = "packages_debian_project_component_files"."component_id"
    INNER JOIN "packages_debian_project_distributions" ON "packages_debian_project_distributions"."id" = "packages_debian_project_components"."distribution_id"
    LEFT OUTER JOIN "packages_debian_project_architectures" ON "packages_debian_project_architectures"."id" = "packages_debian_project_component_files"."architecture_id"
WHERE
    "packages_debian_project_distributions"."project_id" = 2
    AND ("packages_debian_project_distributions"."codename" = 'existing-codename'
        OR "packages_debian_project_distributions"."suite" = 'existing-codename')
    AND "packages_debian_project_components"."name" = 'existing-component'
    AND "packages_debian_project_component_files"."file_type" = 1
    AND "packages_debian_project_architectures"."name" = 'existing-arch'
    AND "packages_debian_project_component_files"."compression_type" IS NULL
ORDER BY
    "packages_debian_project_component_files"."created_at" DESC
LIMIT 1

https://explain.depesz.com/s/Avgb

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Mathieu Parent

Merge request reports