• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mindersec / minder / 12160298943
58%

Build:
DEFAULT BRANCH: main
Ran 04 Dec 2024 01:12PM UTC
Jobs 1
Files 308
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

04 Dec 2024 01:01PM UTC coverage: 55.218% (-0.03%) from 55.244%
12160298943

push

github

web-flow
Allow REST data sources to form bodies from input (#5130)

This adds a new option to the REST data source driver to form a body
from input. This will be marshaled as JSON or interpreted as a string,
and will be used as the message body.

This allows us to dynamically form the body in order to better support
POST-based implementations like OSV.

the new field is called `body_from_field`. The field *must* exist in the
input parameters and must be marked as required or have an appropriate
default. The field must also be a top-level parameter.

Here's an example of a data source that uses it:

```yaml

---
version: v1
type: data-source
name: osv
context: {}
rest:
  def:
    query:
      # Supports templating based on RFC6570
      endpoint: 'https://api.osv.dev/v1/query'
      parse: json
      method: POST
      body_obj_from_field: query
      input_schema:
        type: object
        properties:
          query:
            type: object
            properties:
              version:
                type: string
              package:
                type: object
                properties:
                  ecosystem:
                    type: string
                    description: The ecosystem the dependency belongs to
                  name:
                    type: string
                    description: The name of the dependency
        required:
          - query
```

Note in this case we do validation of all parameters that can be passed
to the body.

usage within a rego evaluation policy would look as follows:

```
...

          reqparams := {
              "query": {
                "version": version,
                "package": {
                  "name": name,
                  "ecosystem": "PyPI"
                }
              }
            }

          out := minder.datasource.osv.query(reqparams)
	  ...
```

Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>

19 of 44 new or added lines in 1 file covered. (43.18%)

1 existing line in 1 file now uncovered.

16472 of 29831 relevant lines covered (55.22%)

38.91 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
25
68.79
-10.07% internal/datasources/rest/handler.go

Uncovered Existing Lines

Lines Coverage ∆ File
1
68.79
-10.07% internal/datasources/rest/handler.go
Jobs
ID Job ID Ran Files Coverage
1 12160298943.1 04 Dec 2024 01:12PM UTC 308
55.22
GitHub Action Run
Source Files on build 12160298943
  • Tree
  • List 308
  • Changed 11
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #12160298943
  • fd384124 on github
  • Prev Build on main (#12159819186)
  • Next Build on main (#12160307325)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc