Skip to content

Commit

Permalink
Remove references to AMA (except copyright), fix errors in README
Browse files Browse the repository at this point in the history
  • Loading branch information
zjullion committed Jan 16, 2024
1 parent c9c2ddc commit 3aa2608
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 138 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS

This file was deleted.

2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
name: Bug report
about: Describe a problem with sensitive-param-filter
title: '[BUG]:'
labels: ''
assignees: ''
---

**Describe the bug:**
Expand Down
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
name: Feature request
about: Suugest a new feature for sensitive-param-filter
title: '[FEATURE]:'
labels: ''
assignees: ''
---

**Describe the feature:**
Expand Down
6 changes: 1 addition & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
**Is this PR a bug fix, new feature, or security update?**

**Do you understand and accept that your contribution will be released under an MIT license?**
**Is this PR a bug fix, new feature, or dependency update?**

**Please describe this pull request:**

**PR Review Checklist**

- [ ] I have passing tests run via `npm run test` with a 100% coverage threshold
- [ ] I have updated the version in `package.json`
- [ ] I have updated any relevant documentation in `README.md`, `.github`, etc.
- [ ] I have not included any secret values or links to internal AMA URLs in my commits or PR message
59 changes: 6 additions & 53 deletions .github/workflows/cd-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,59 +6,12 @@ on:
- master

jobs:
install:
runs-on: macos-latest
publish:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: npm install
run: npm install
- name: Upload built artifact
uses: actions/upload-artifact@v3
with:
name: artifacts
path: src/

publish-package-to-github:
runs-on: macos-latest
needs: install
name: publish to github packages
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download built artifact
uses: actions/download-artifact@v3
with:
name: artifacts
path: src
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: 'https://npm.pkg.github.com'
- name: Publish to Github Packages
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-package-to-npm:
runs-on: macos-latest
needs: install
name: publish to npm
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download built artifact
uses: actions/download-artifact@v3
with:
name: artifacts
path: src
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
- name: Publish to NPM
run: npm publish
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: npm install
- run: npm run compile
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
12 changes: 4 additions & 8 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ jobs:
os: [windows-latest, macos-latest, ubuntu-latest]
node-version: ['18', '20']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Run validations
run: npm run validate
- run: npm install
- run: npm run validate
env:
CI: true
32 changes: 0 additions & 32 deletions CONTRIBUTING.md

This file was deleted.

1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Copyright (c) 2019 Alberta Motor Association
Copyright (c) 2024 Zach Jullion

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
42 changes: 13 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
# Sensitive Param Filter

[![Build Status](https://travis-ci.org/amaabca/sensitive-param-filter.svg?branch=master)](https://travis-ci.org/amaabca/sensitive-param-filter)

`sensitive-param-filter` is a zero-dependency package designed to filter sensitive values from JavaScript objects.
This package can be used to scrub logs, filer data before outputting to a UI, etc.
This package can be used to scrub logs, filter data before outputting to a UI, etc.
The defaults provided with sensitive-param-filter should work well for most applications.

## Installation

Install sensitive-param-filter to your project via either npm:

`npm install @amaabca/sensitive-param-filter`

or yarn:

`yarn add @amaabca/sensitive-param-filter`
`npm install sensitive-param-filter`

## Usage

```js
const { SensitiveParamFilter } = require('@amaabca/sensitive-param-filter')
```typescript
import { SensitiveParamFilter } from 'sensitive-param-filter'
const paramFilter = new SensitiveParamFilter()
const rawObject = {
Authorization: 'Bearer somedatatoken',
Expand All @@ -43,12 +35,12 @@ const filteredObject = paramFilter.filter(rawObject)
### Details

sensitive-param-filter examines keys to determine which values to filter.
Key matching is done in a case-insensitive, partial-macthing manner (that is, if the param `AUTH` is provided, `Authorization`, `AUTHENTICATION`, etc. will be filtered).
Partial matches and case-insensitive matches are filtered - if the key `AUTH` is provided, `Authorization`, `AUTHENTICATION`, etc. will be filtered.

### Key Features

- Does not modify input objects
- Performs a deep copy of the input object (note that booleans, numbers, and strings - which are immutable - are technically copied by reference)
- Performs a deep copy of the input object
- Can be configued to filter out or leave "unexpected" objects (such as functions)
- Handles circular references
- Filters valid JSON strings
Expand All @@ -57,11 +49,11 @@ Key matching is done in a case-insensitive, partial-macthing manner (that is, if

### Options

```js
const { SPFDefaultParams, SensitiveParamFilter } = require('@amaabca/sensitive-param-filter')
```typescript
import { SPFDefaultFilteredKeys, SensitiveParamFilter } from 'sensitive-param-filter'
const filter = new SensitiveParamFilter({
filterUnknown: false,
params: SPFDefaultParams.concat(['data', 'email']),
keysToFilter: SPFDefaultFilteredKeys.concat(['data', 'email']),
replacement: '***',
whitelist: ['authentic', 'encryption_standard'],
})
Expand All @@ -71,10 +63,10 @@ const filter = new SensitiveParamFilter({
Indicates whether "unexpected" objects (such as functions) should be filtered or returned as-is.
Defaults to `true`

- **params:**
An array of string params to filter.
- **keysToFilter:**
An array of string keys to filter.
These entries will be combined into a regex that is used by sensitive-param-filter.
Setting this option overwrites the default array (`SPFDefaultParams`).
Setting this option overwrites the default array (`SPFDefaultFilteredKeys`).

- **replacement:**
The object to replace filtered values with.
Expand All @@ -87,7 +79,7 @@ const filter = new SensitiveParamFilter({

## Default Values

See [defaults](src/defaults.js).
See [defaults](src/defaults.ts).
Note that all of these values can be overridden via the options.

The default keys that are filtered are:
Expand All @@ -102,11 +94,3 @@ The default keys that are filtered are:
- pass
- secret
- token

## License & Contributing

`sensitive-param-filter` uses the MIT license.
See the [license](LICENSE).

We welcome contributions.
See [contributing](CONTRIBUTING.md).
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
{
"name": "@amaabca/sensitive-param-filter",
"name": "sensitive-param-filter",
"version": "2.0.0",
"description": "A package for filtering sensitive data (parameters, keys) from a variety of JS objects",
"description": "A package for filtering sensitive data from any object - best used to sanitize logs.",
"main": "dist/index.js",
"author": "Alberta Motor Association",
"author": "zjullion",
"license": "MIT",
"keywords": [
"sensitive",
"filter",
"security"
"sanitize",
"security",
"logging"
],
"repository": {
"type": "git",
"url": "https://github.com/amaabca/sensitive-param-filter.git"
"url": "https://github.com/zjullion/sensitive-param-filter.git"
},
"homepage": "https://github.com/amaabca/sensitive-param-filter",
"homepage": "https://github.com/zjullion/sensitive-param-filter",
"devDependencies": {
"@types/jest": "^29.5.11",
"@typescript-eslint/eslint-plugin": "^5.57.0",
Expand Down

0 comments on commit 3aa2608

Please sign in to comment.