Coder Social home page Coder Social logo

ibm / qjslib Goto Github PK

View Code? Open in Web Editor NEW
6.0 7.0 11.0 551 KB

QJSLib is a JavaScript utility library that provides functionality for QRadar apps to simplify interactions with QRadar.

License: Apache License 2.0

JavaScript 99.48% Shell 0.52%
qradar qradar-apps javascript es6

qjslib's Introduction

Build Status Quality Gate Status

QRadar App JavaScript Library (qjslib)

QJSLib is a JavaScript utility library that provides functionality for QRadar apps to simplify interactions with QRadar.

How to use

Browser vs module

The build process for this project generates two separate files in lib/.

qappfw.js is not minified. It is designed to be bundled with your application code.

qappfw.min.js is minified with polyfills for browser compatibility. It is designed to be used directly in the browser.

As a module

  1. Install qjslib.
npm i qjslib
  1. Import it into your application.
import { QRadar } from "qjslib";
  1. You can now use the helper functions.
QRadar.fetch("/api/gui_app_framework/applications")
    .then((response) => response.json())
    .then((json) => console.log(json));

As a browser script

  1. Get the latest release of QJSLib.
  2. Download the latest tarball qjslib-(version).tgz.
  3. Extract package/lib/qappfw.min.js.
  4. Place this file in your QRadar app, e.g. in /app/static/qappfw.min.js
  5. Add a reference to the file from your HTML file.
  6. The utility class QRadar is added to the global scope - and can be accessed through window.qappfw.QRadar.
  7. You can now use qjslib like this:
const QRadar = window.qappfw.QRadar

// Using traditional xmlhttprequest callback
QRadar.rest({
    path: "/api/gui_app_framework/applications",
    onComplete: function() {console.log(this.response);},
    httpMethod: "GET"
});

// Using modern promise based fetch
// Not using arrow functions for older browser compatability
QRadar.fetch("/api/gui_app_framework/applications")
    .then(function(response) {return response.json();})
    .then(function(json) {console.log(json);});

console.log(QRadar.getWindowOrigin());

Developing this project

See setup in CONTRIBUTING

qjslib's People

Contributors

dependabot[bot] avatar jenboyleibm avatar jthomperoo avatar judedillon avatar mbengit avatar smokeykappa avatar wilhaddenibm avatar x4curt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

qjslib's Issues

Resolve js-yaml security alert

js-yaml vulnerability found in package-lock.json

Remediation
Upgrade js-yaml to version 3.13.1 or later. For example:

"dependencies": {
  "js-yaml": ">=3.13.1"
}

or…

"devDependencies": {
  "js-yaml": ">=3.13.1"
}

nodeca/js-yaml#480

WS-2019-0063 More information
Vulnerable versions: < 3.13.1
Patched version: 3.13.1
Js-yaml prior to 3.13.1 are vulnerable to Code Injection. The load() function may execute arbitrary code injected through a malicious YAML file.

Tests sometimes fail due to a timeout issue

Tests for fetch timeouts sometimes fail due to the threshold being too small (1 ms). Can cause the tests to fail, it would be better if there was a bigger threshold to allow for variations in time taken to process.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.