
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
json_schema_experiments
Advanced tools
Some experiments to understand json schema features and how to better encode the data we need to deal with.
The following artifacts are generated automatically when you finish creating your Collection by running gitlab's CI pipeline. Links for staging
(development branch) and main
(currently deployed) branches are shown
main
) Collection Schemas - Final published collection of conventions and overlaysstaging
) Collection Schemas - Final published collection of conventions and overlaysmain
) Collection Schemas - Final published collection of conventions and overlaysmain
) Collection Documentation - Human Readable documetation for the Input Collectionstaging
) Collection Schemas - Final published collection of conventions and overlaysstaging
) Collection Documentation - Human Readable documetation for the Input CollectionThis repo centralizes several technical experiments OurSci and OpenTeam are performing to use JSON schemas to advance the Ag Data Wallet concept. Our aim is to make it easy to:
@octavio when we've completed the change to npm deployment... we can update this list, but basically:
git init
)npm init
).npm install conventionbuilder conventionschemapublisher
).staging
or main
will trigger the CI process, test that the examples are adequate, publish the validation code, publish the conventions and publish the wiki containing all documentation. The links will also be clearly exhibited for the user.@octavio after change to npm deployment, move this all to Documentation
You need a source for the FarmOS schemas, which are the base for all the conventions in this repo. There are two different ways to get them.
.env
file as NPM_AUTH_TOKEN.Both should be parametrized in the .env
file.
It only has two mandatory variables:
FARM_DOMAIN
: the url of a valid FarmOS instance known to be up to date with the expected data standards. A model instance.FARMOS_KEY
: The has key to your aggregator instance, which of course needs to have access to the target farm.SOURCE_REPO_PROJECT_ID
: The GitLab project id of a git repo hosting a set of conventions
with the format we expect here (typically, another fork of this same project). You can find this ID by navigating to the repo, it is shown right below the repo name in the main repo contents view as Project ID: XXXXX
.A third, non mandatory variable will be required if you want to publish your validators as an npm package:
PUBLISHED_PACKAGE_NAME
Publishing will also require you to configure a private CI variable with your NPM credentials for a valid target repo.
output/conventions
folderexamples
, in which two further paths should be correct
and incorrect
. These will be used to test is the schema is accepting the entitites we want it to accept and rejecting the entities we want it to reject. We will know if a schema is working properly if it accepts the corrent examples and rejects the incorrect examples.schema.json
should have a schema describing our convention. Typically, the convention will have several fields and each field should have atype/bundle from the parametrized farm, with a name unique to the schema. It is paired with an object.json
file, which contains our richer JavaScript object describing the convention, which is ideal if, for example, the user intends to take a preexisting convention and modify it further.scripts/getAllSchemas.js
will provide you with the source FarmOS entity schemata.scripts/compileAllValidators.js
.scripts/rebuildCollection.sh
(attention, this one is a BASH script, not node). Conventios are obtained from the definitions
folder.output/collection
, output/documentation
, output/validators
folders, write your definitions and run the scripts again.All your work should happen inside the definitions
folder. You can see how we use our schema_builder
library to define conventions in the definitions
folder of this repo. More details in the documentation for schenma_builder
.
Definitions describe how you intend your conventions to be. The conventions will be compiled based on your files and stored in the output/collection folder in a hierarchical folder structure.
./scripts/getAllSchemas.js
)../test/conventions_against_examples.test.js
).main
, it will publish the new version of the schemas as artifacts and it will publish validation code for all your schemas and conventions in a uniquely named package (./scripts/compileAllValidators.js
and ./scripts/transpilation.js
to get a browser compatible version of the code, also publised in the library).gitpods
interface to allow you to work with the needed libraries with 0 configuration and get acquainted with the whole process.We created a library which helps build a convention in the proposed style using high level commands and facilitating testing against examples, documenting, etc. Its functionality is contained in the convention_builder
module. See documentation here. A fairly detailed tutorial on how to use it shown here.
Experiments are documented in a further document inside the examples folder.
We explored several technical pathways we need to achieve the aims we stated above. Besides, we documented our explorations as much as possible, because we believe there will be a need to make JSON schema usage easy and immediate for developers of this spaces and the tool is simple enough, just lacking in documentation around the kind of usage we envision.
This repo incorporates a full CI/CD workflow that retrieves schemas from a model farm (chosen by the user with a parameter) and publishes each schema in a de drupalized form into folders structured by type and bundle. Besides it compiles autonomous schema validator functions using AJV, allowing to check if a file adheres to a schema in an as efortless way as possible. The schemas and validators are published into NPM to allow easy retrieval both in backend and frontend applications (via a node connected CDN). Besides we will offer a model Express endpoint to allow to share the schemas via any server with an easy model query using the type and bundle as parameters.
A CI/CD pipeline publishes both the schemas as static files and the validators as an NPM library. Schemas are store inside the output/schemata/reference_collection
archive structure.
FarmOS.js
.measure
field in quantity
shemas, which is currently listed as string
but is really constrained to a fixed list of possible values.We will store overlays next to the de drupalized schemas, containing the known implicit conventions. These will be applied when building the validator code.
Currently, the FarmOS community and the open Ag Wallet community are working on the concept of conventions
as constructs involving many entities
and several conditions around how they are filled and interconected.
We believe being able to express these conventions around a schema
would be fairly valuable as even filling one entity can be demanding when working out of the railguards of the FarmOS web interface. Also, having a strong validation tool would allow conventions
to be more precise, strict and specific without demanding more effort from users.
We already have propositions of functional convention schemas between the examples, as well as validators for these schemas.
We are working with data submitted primarily via SurveStack and adapting pre existing scripts in which conventions were mostly procedurally implied. A number of helper functions and structures are added to aid in this task.
experiments/usingExamplesImporter.js
file. It is heavily commented and intendede to be read and run linewise while looking at the effects of different steps in the code.API Compose
tab in the scripts section should be stored in the definitions/examples/raw
folder, using a meaningful name that clearly indicates the name of the convention. If several examples for a unique convention are used, a suffix index can be added. A valid path could look similar to definitions/examples/raw/log--activity--tillage_4.json
.exampleImporter
from the libraty stored in src/schemaUtilities
. It will read and sanitize the data into an array of valid entities. The user will need to structure it according to the convention and typically test and fix the convention until it works with the example. The script should have the same name as the example (but a .js
termination, as it is JavaScript code) and simply be stored together with it.definitinos/examples/processed
, with a meaningful name. This is the file that should be called in the definition for a convention.FAQs
Some experiments to understand json schema features and how to better encode the data we need to deal with.
We found that json_schema_experiments demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.