Skip to content
Snippets Groups Projects

Added headers hash for http destinations

Merged Hitesh Raghuvanshi requested to merge 436607-http-headers into master

What does this MR do and why?

This MR adds a method for us to return headers_hash from any model that composes the ExternallyStreamable concern. It overwrites any attempt to write over X-Gitlab-Event-Streaming-Token which is set to the secret_token (generated or user provided)

This MR also updates the json schema file for HTTP categories, and uses the HTTP RFC-7230 to allow certain characters.

  • It is pretty permissive on what is allowed (USASCII, special characters, spaces, etc.)
  • An alternative is to use what Cloudflare defines as acceptable header keys and values format: Reference
  • It also disallows any 'custom' properties, so only value and active are passable

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Checkout the git branch
  2. Create new external streaming destinations using graphql with the category http
  3. Open rails console and query for streaming destinations [AuditEvents::Instance::ExternalStreamingDestination]
  4. Validate that headers_hash is returned for http category destinations
Example graphql query
mutation CreateInstanceAuditEventStreamingDestination {
  instanceAuditEventStreamingDestinationsCreate(
    input: {
      config: {
        url:"https://gitlab.com/test",
        headers: { key1: { value: "test", active: true } }
      },
      category: "http", 
      secretToken:"my-token-my-token-12345",
    }
  ) {
    externalAuditEventDestination {
      id
      name
      category
      config
    }
    errors
  }
}

Related to #436607 (closed)

Edited by Andrew Jung

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Andrew Jung added 1 commit

    added 1 commit

    • d8f8656b - Overwrite any changes to our header to normal, add better regex for headers, update spec tests

    Compare with previous version

  • Andrew Jung
  • Andrew Jung marked this merge request as ready

    marked this merge request as ready

  • Andrew Jung added 734 commits

    added 734 commits

    Compare with previous version

  • Andrew Jung changed the description

    changed the description

  • requested review from @hraghuvanshi and @Quintasan

  • Michał Zając approved this merge request

    approved this merge request

  • added pipelinetier-2 label and removed pipelinetier-1 label

  • Before you set this MR to auto-merge

    This merge request will progress on pipeline tiers until it reaches the last tier: pipelinetier-3. We will trigger a new pipeline for each transition to a higher tier.

    Before you set this MR to auto-merge, please check the following:

    • You are the last maintainer of this merge request
    • The latest pipeline for this merge request is pipelinetier-3 (You can find which tier it is in the pipeline name)
    • This pipeline is recent enough (created in the last 8 hours)

    If all the criteria above apply, please set auto-merge for this merge request.

    See pipeline tiers and merging a merge request for more details.

  • :tools: Generated by gitlab_quality-test_tooling.


    :snail: Slow tests detected in this merge request. These slow tests might be related to this merge request's changes.

    Click to expand
    Job File Name Duration Expected duration
    #8163335417 spec/lib/release_highlights/validator_spec.rb#L82 ReleaseHighlights::Validator when validating all files they should have no errors 82.63 s < 27.12 s
    #8176104629 spec/lib/release_highlights/validator_spec.rb#L82 ReleaseHighlights::Validator when validating all files they should have no errors 78.11 s < 27.12 s
    #8178116979 spec/lib/release_highlights/validator_spec.rb#L82 ReleaseHighlights::Validator when validating all files they should have no errors 90.78 s < 27.12 s
    #8181075891 spec/lib/release_highlights/validator_spec.rb#L82 ReleaseHighlights::Validator when validating all files they should have no errors 77.87 s < 27.12 s
    #8276900678 spec/lib/release_highlights/validator_spec.rb#L82 ReleaseHighlights::Validator when validating all files they should have no errors 78.12 s < 27.12 s
    #8277884525 spec/lib/release_highlights/validator_spec.rb#L82 ReleaseHighlights::Validator when validating all files they should have no errors 83.49 s < 27.12 s
    #8278349671 spec/lib/release_highlights/validator_spec.rb#L82 ReleaseHighlights::Validator when validating all files they should have no errors 87.77 s < 27.12 s
    #8295396781 spec/lib/release_highlights/validator_spec.rb#L82 ReleaseHighlights::Validator when validating all files they should have no errors 79.72 s < 27.12 s
  • A deleted user added rspec:slow test detected label
  • E2E Test Result Summary

    allure-report-publisher generated test report!

    e2e-test-on-gdk: :white_check_mark: test report for b4cf955d

    expand test summary
    +------------------------------------------------------------------+
    |                          suites summary                          |
    +-------------+--------+--------+---------+-------+-------+--------+
    |             | passed | failed | skipped | flaky | total | result |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Create      | 8      | 0      | 0       | 0     | 8     | ✅     |
    | Package     | 1      | 0      | 0       | 0     | 1     | ✅     |
    | Govern      | 4      | 0      | 0       | 0     | 4     | ✅     |
    | Data Stores | 2      | 0      | 0       | 0     | 2     | ✅     |
    | Verify      | 1      | 0      | 0       | 0     | 1     | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Total       | 16     | 0      | 0       | 0     | 16    | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+

    e2e-test-on-cng: :x: test report for b4cf955d

    expand test summary
    +------------------------------------------------------------------+
    |                          suites summary                          |
    +-------------+--------+--------+---------+-------+-------+--------+
    |             | passed | failed | skipped | flaky | total | result |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Plan        | 86     | 0      | 8       | 0     | 94    | ✅     |
    | Create      | 139    | 0      | 21      | 0     | 160   | ✅     |
    | Monitor     | 8      | 0      | 12      | 0     | 20    | ✅     |
    | Verify      | 50     | 0      | 15      | 0     | 65    | ✅     |
    | Govern      | 83     | 1      | 9       | 3     | 93    | ❌     |
    | Secure      | 1      | 0      | 6       | 0     | 7     | ✅     |
    | Package     | 24     | 0      | 14      | 0     | 38    | ✅     |
    | Analytics   | 2      | 0      | 0       | 0     | 2     | ✅     |
    | Fulfillment | 2      | 0      | 7       | 0     | 9     | ✅     |
    | Manage      | 1      | 0      | 9       | 0     | 10    | ✅     |
    | Configure   | 0      | 0      | 3       | 0     | 3     | ➖     |
    | Data Stores | 33     | 0      | 10      | 0     | 43    | ✅     |
    | Release     | 5      | 0      | 1       | 0     | 6     | ✅     |
    | ModelOps    | 0      | 0      | 1       | 0     | 1     | ➖     |
    | Ai-powered  | 0      | 0      | 2       | 0     | 2     | ➖     |
    | Growth      | 0      | 0      | 2       | 0     | 2     | ➖     |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Total       | 434    | 1      | 120     | 3     | 555   | ❌     |
    +-------------+--------+--------+---------+-------+-------+--------+
  • added workflowready for review label and removed workflowin dev label

  • Andrew Jung resolved all threads

    resolved all threads

  • Andrew Jung added 544 commits

    added 544 commits

    Compare with previous version

  • Hitesh Raghuvanshi
  • Andrew Jung added 1 commit

    added 1 commit

    • 5eead437 - Clean up headers_hash filter

    Compare with previous version

  • Andrew Jung reset approvals from @Quintasan by pushing to the branch

    reset approvals from @Quintasan by pushing to the branch

  • Andrew Jung added 31 commits

    added 31 commits

    Compare with previous version

  • Andrew Jung resolved all threads

    resolved all threads

  • Andrew Jung added 96 commits

    added 96 commits

    Compare with previous version

  • Michał Zając approved this merge request

    approved this merge request

  • Michał Zając enabled automatic add to merge train when checks pass

    enabled automatic add to merge train when checks pass

  • Andrew Jung resolved all threads

    resolved all threads

  • requested review from @alipniagov

  • Aleksei Lipniagov approved this merge request

    approved this merge request

  • Aleksei Lipniagov resolved all threads

    resolved all threads

  • Aleksei Lipniagov removed review request for @alipniagov

    removed review request for @alipniagov

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading