
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
core.io-view-generator
Advanced tools
Generate CRUD views from a (swagerish) model schema. If you are using Waterline, you can generate the schema using the waterline-to-json-schema module.
scaffold 0.1.3 - CRUD view generator
USAGE
scaffold <command> [options]
COMMANDS
compile [source] [output] Generate views from a GUI schema
open [source] [output] Generate views from a JSON schema
help <command> Display help for a specific command
GLOBAL OPTIONS
-h, --help Display help
-V, --version Display version
--no-color Disable colors
--quiet Quiet mode - only displays warn and error messages
-v, --verbose Verbose mode - will also output debug messages
For each model create the following views:
update
: Updatecreate
: Createindex
: Instancelist
: Tablesearch
: SearchWith two subviews:
_grid
_form
Attribute type mapping:
string
: Inputtext
: TextAreainteger
: Inputfloat
: Inputdate
: Inputtime
: Inputdatetime
: Inputboolean
: Checkbinary
: Inputarray
: Multi?json
: TextArea//Actual Box
var Box = Waterline.Collection.extend({
identity: 'box',
//TODO: change identity name, make
//as exportName, and remove exportName.
exportName: 'Box',
connection: connection,
attributes: {
name: {
type:'string',
// description: 'Box name'
},
uuid: {
type: 'string',
required: true,
defaultsTo: function() {
return uuid();
}
},
eventName: 'string',
eventResponse: 'string',
eventAction: {
type:'string',
defaultsTo: 'ACTIVATE'
},
boxset: {
model: 'boxset'
},
owner: {
model: 'boxowner'
},
status: {
type: 'string',
//Should this be 3 states only?
//available - assigned - broken? That way we do not
//have to update on "route"
enum: [ 'available', 'assigned', 'delivered', 'full', 'broken'],
defaultsTo: 'available'
}
}
});
https://github.com/balderdashy/waterline-docs/blob/master/models/validations.md
{
attributes: {
foo: {
required: true,+
empty: true,
notEmpty: true,
undefined: true,
falsey: true,
truthy: true,
null: true,
notNull: true,
after: '12/12/2001',
before: '12/12/2001',
equals: 45,
in: ['foo', 'bar'], // string contains one of this
notIn: ['foo', 'bar'],// string NOT contains one of this
contains: 'foobar',+
notContains: 'foobar',+
is: /ab+c/,+
regex: /ab+c/,+
not: /ab+c/,+
notRegex: /ab+c/,+
len: 35,+
max: 24,+
min: 4,+
minLength: 4,+
maxLength: 24,+
lowercase: true,+
uppercase: true,+
string: true,+
alpha: true,+
numeric: true,+
alphanumeric: true,+
int: true,+
integer: true,+
number: true,+
finite: true,+
decimal: true,+
float: true,+
boolean: true,+
array: true,+
date: true,+
hexColor: true,+
hexadecimal: true,+
email: true,+
url: true,+
urlish: true,+
ip: true,+
ipv4: true,+
ipv6: true,+
creditcard: true,+
uuid: true,+
uuidv3: true,+
uuidv4: true,+
}
}
}
The generated schema can be used in the definitions
part of a Swagger Manifest. If you use Swagger with your API you can extend the definitions
with the generated JSON.
{
type: 'object',
title: 'User',
properties: {
id: {
type: 'integer',
format: 'int32'
},
title: { type: 'string' },
description: { type: 'string' },
createdAt: {
type: 'string',
format: 'date-time'
},
updatedAt: {
type: 'string',
format: 'date-time'
}
}
}
{
"swagger": "2.0",
"info": {
"title": "API",
"version": "1.0.0"
},
"paths": {
"user": {
"get": {
"parameters": [ ],
"responses": {
"200": { "$ref": "#/definitions/user" }
}
}
}
},
"definitions": {
"user": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": 'int32'
},
"title": { "type": "string" },
"description": { "type": "string" },
"createdAt": {
"type": "string",
"format": "date-time"
},
"updatedAt": {
"type": "string",
"format": "date-time"
}
}
}
}
}
To debug you might want to show what a field metadata contains. You can add the following entry in the __inputs.swig
file on a field:
<code>{{ prop|json|safe -}}</code>
{
"name": "terminals",
"label": "Terminals",
"entityType": "array",
"uri": "/terminal",
"type": "text",
"element": "multiselect",
"items": {
"$ref": "#/definitions/terminal"
},
"subType": "array",
"relType": "many-to-one"
}
{
"name": "parent",
"label": "Parent",
"entityType": {
"$ref": "#/definitions/location"
},
"uri": "/location",
"type": "text",
"element": "select",
"relType": "one-to-many"
}
Flow:
waterline-schema collect ./src/models
(output: waterline.json)
waterline-schema generate
(output: schema.json)
scaffold-views generate schema.json ./output/ --clean --save-gui-schema
: Modify gui-schema.json to arrange fields as we want them, i.e move id field to be 1st.
scaffold-views compile gui-schema.json ./output/
A note on templates... potentially you are using templates to generate templates. The view generator uses the tags {%
and %}
. If you are mixing ejs
, make sure you don't open tags without noticing:
The following would break the cli template parsing:
<% pagination.getPages().forEach((page)=>{%>
<li class="<%= page.active ? 'active' : ''%>">
<a href="<%= page.link%>">
<%= page.index %>
</a>
</li>
<%})%>
Notice the forEach((page)=>{%>
, yup, that {%
it's an opening tag..
Here we fix the issues:
<% pagination.getPages().forEach((page)=> { %> <%# THIS! %>
<li class="<%= page.active ? 'active' : '' %>">
<a href="<%= page.link%>">
<%= page.index %>
</a>
</li>
<% }) %><%# THIS! %>
FAQs
CRUD view generator
We found that core.io-view-generator 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.