
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
sinopia_acl
Advanced tools
node.js based code to interact with WebACL data on Sinopia server.
WebACL (https://www.w3.org/wiki/WebAccessControl) is how we will gate access to various LDP containers on the server.
The "copy of record" of group/webID mappings will be in the Sinopia server.
You will need to install the npm packages before running any of the code (which also requires that the npm package manager itself is installed)
$ npm install
This code may have a simple CLI for Sinopia Server admins to use to be developed in a future work cycle (as of April, 2019).
To spin up Trellis and its dependencies with the Sinopia container structure (root, repository, and group containers) and ACLs (declared on root container) pre-created, use the platformdata
docker-compose service:
# Add -d flag to run containers in background
$ docker-compose up platformdata
NOTE: In order for the above to work, you will need to set COGNITO_ADMIN_PASSWORD
, AWS_ACCESS_KEY_ID
, and AWS_SECRET_ACCESS_KEY
in a file named .env
in the sinopia_acl root.
To spin up Trellis and its dependencies without the container structure and ACLs pre-created, use the platform
docker-compose service:
# Add -d flag to run containers in background
$ docker-compose up platform
There is a script to populate a running Trellis LDP server with the Sinopia container structure (root, repository, and group containers) and ACLs (declared on root container).
This script can be run repeatedly
These env vars must be set:
If the desired AWS Cognito pool is not the Cognito Sinopia development pool, these env vars are also needed:
$ COGNITO_ADMIN_USER=hoohah COGNITO_ADMIN_PASSWORD=foobar AWS_PROFILE=barfoo bin/migrate
You can use the bin/authenticate
command-line tool to authenticate to an AWS Cognito instance. This command will create a new file called .cognitoToken
which contains a JSON Web Token, which you can use to authorize HTTP requests to the Sinopia server (Trellis). How to authenticate:
$ AWS_PROFILE=name_of_aws_profile_used_in_~/.aws/config_file COGNITO_USER_POOL_ID=us-west-2_ABC123XYZ COGNITO_CLIENT_ID=abc123xyz456etc AWS_COGNITO_DOMAIN=https://sinopia-{ENV}.auth.us-west-2.amazoncognito.com bin/authenticate
NOTE: If you provide none of the above environment variables, bin/authenticate
will default to the Sinopia development instance of Cognito and its sole user pool.
The JWT stored in .cognitoToken
will be valid for approximately an hour.
To use the JWT as stored in .cognitoToken
to make authorized requests to Trellis, you can pass it along in the HTTP request as follows:
$ curl -i -H "Authorization: Bearer $(cat .cognitoToken)" http://localhost:8080/?ext=acl
To run the linter:
$ npm run eslint
To run unit tests:
$ COGNITO_ADMIN_PASSWORD=foobar AWS_PROFILE=barfoo npm test
Note that you will need to replace the value of
COGNITO_ADMIN_PASSWORD
with the actual password of the Cognito testing account we have created. For that, see the Sinopia dev shared_configs
repository or ask a fellow Sinopia developer.AWS_PROFILE
with the value of your developer profile, e.g. 'dev' or 'my-id@sul-dlss-dev'If you're going to be doing active development, you'll most likely want to spin up docker-compose
services and run integration tests separately, since you will do this multiple times while getting the code right. If so, first spin up the integration environment—Trellis & its dependencies—in the background (via -d
) using docker-compose
:
$ docker-compose up -d platform
To run the integration tests, they must be invoked independent of the unit tests:
$ npm run jest-integration
To shut the containers down and clean up, run:
$ docker-compose down
Or if you just need to run the integration tests once (assuming you haven't already started up docker-compose
services), you can do the following to spin up containers, run integration tests, and then spin containers down. (This is how integration tests are run in CI.)
$ docker-compose run integration
$ docker-compose down
Any commands that are in the swagger spec (e.g. listing groups, creating group) should use the sinopia_client npm module rather than curl, if possible. (swagger api -> javascript client -> npm module)
testing/development will benefit from a docker env with a running Sinopia Server backend with Trellis (e.g. sinopia_server docker used for testing)
In an ideal world, we would validate any WebACL to be written to the server. However, here does not seem to be an existing WebACL validation package -- JSON schema, npm module, RDF shapes, whatever.
We separate out the CLI from the WebACL manipulation and the interaction with the Sinopia server.
We will see if we can use npm jsonacl https://www.npmjs.com/package/jsonacl for node ACL manipulation, or something similar
We publish an npm package that can be imported by a GUI
The CircleCI build is configured to perform these steps automatically on any successful build on the master
branch. If you need to manually build and push an image, you can do this:
$ docker build -t ld4p/sinopia_acl:latest .
$ docker push ld4p/sinopia_acl:latest
FAQs
Interact with WebACL data on Sinopia server
The npm package sinopia_acl receives a total of 0 weekly downloads. As such, sinopia_acl popularity was classified as not popular.
We found that sinopia_acl demonstrated a not healthy version release cadence and project activity because the last version was released 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
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.