
Security News
NVD Quietly Sweeps 100K+ CVEs Into a “Deferred” Black Hole
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
A library for validating data at the edges of data systems.
pip install horkos
Detailed documentation can be found on Read the Docs.
First define the data schema:
# http-requests-schema.yaml
name: "http_requests"
description: >-
This is the http request event data set, it is all about http requests we
receive. It's important to include as much information about it
as is reasonable. The hardest thing about data is understanding it after
the fact.
fields:
path:
type: string
description: >-
The path of the url that was hit. This will be everything after the
host portion of the url.
params:
type: string
nullable: true
checks:
- json
description: >-
The parameters of the http request. If the method is a `GET` these come
from the url otherwise they are the JSON from the request body.
method:
type: string
checks:
- name: choice
args:
options:
- DELETE
- GET
- HEAD
- OPTIONS
- PATCH
- POST
- PUT
description: >-
The http method of the request. Must be one of:
`DELETE`, `GET`, `HEAD`, `OPTIONS`, `PATCH`, `POST`, or `PUT`.
response_code:
type: integer
description: The http response code of the request
timestamp:
type: string
checks:
- iso_timestamp
description: The time at which the http request was received.
To use this schema to validate records:
import horkos
schema = horkos.load_schema('http-requests-schema.yaml')
schema.process({'path': '/foo/bar'})
# RecordValidationError: Casting errors - params is required, method is required, ...
schema.process({
'path': '/foo/bar',
'params': '{"foo": "bar"}',
'method': 'BAD',
'response_code': '200',
'timestamp': '2020-06-15T12:34:56',
})
# RecordValidationError: Check errors - "BAD" in method did not pass choice check, ...
schema.process({
'path': '/foo/bar',
'params': '{"foo": "bar"}',
'method': 'GET',
'response_code': '200',
'timestamp': '2020-06-15T12:34:56',
})
# {..., 'response_code': 200, ...}
It's also possible to use horkos
via cli to validate csv
and json
files.
path,params,method,response_code,timestamp
/foo/bar,,GET,200,2020-06-15T12:34:56
/fizbuz,{"param":"value"},POST,200,2020-12-15T12:34:56
/fizbuz,,ERROR,500,2020-12-15T12:34:56
/fizbuz,,GET,BAD,2020-12-15T12:34:56
To validate the csv run:
$ horkos check -s http-requests-schema.yaml data.csv
[Row 2]: Check errors - value of "ERROR" for method did not pass choice check
[Row 3]: Casting errors - value of "BAD" for response_code could not be cast to integer
2 errors found
FAQs
A library for validating data at the edges of data systems.
We found that horkos demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Research
Security News
Lazarus-linked threat actors expand their npm malware campaign with new RAT loaders, hex obfuscation, and over 5,600 downloads across 11 packages.
Security News
Safari 18.4 adds support for Iterator Helpers and two other TC39 JavaScript features, bringing full cross-browser coverage to key parts of the ECMAScript spec.