Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to reflect latest rfc meeting #1

Merged
merged 2 commits into from
Aug 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions accepted/0027-add-app-id-env.md

This file was deleted.

50 changes: 50 additions & 0 deletions accepted/0027-audit-metadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Add `metadata` object to package.json to be sent in HTTP header

## Summary

HTTP header may contain `metadata` object which may be used in third-party applications.

## Motivation

Some third-party applications may enhance the audit reports provide and may need extra information to provide this capability

## Detailed Explanation

Developers and users who are using the npm audit tool, may want to get additional or finely tuned report information about their project.
For developers who perform `npm audit` or `npm install` with third-party applications there is no way to provide additional metadata.
Like `npm-session` is used by the npm registry to identify individual user sessions, it would be useful to provide a generic way for a maintainer to add additional metadata to their project which is sent during an `npm audit` or `npm install`.

## Rationale and Alternatives

* **Rationale:**
* This is easy to implement solution to provide such additional value in the HTTP request.
* Building this functionality will allow developers to easily set additional information that can be passed along in a header for third-party application use

* **Alternatives:**
* Use `preshrinkwrap` or/and `postshrinkwrap` scripts to install a custom value to the project like the `app-id`

## Implementation

* Define a new `metadata` object that can be added to the package.json file.
* The `metadata` JSON object is picked up by the [npm cli](https://github.com/npm/cli) and sent as a `metadata` attribute in the HTTP header requests

An illustrative `package.json` example:

```
{
"name": "npm_project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"qs": "^2.4.2"
},
"metadata": {
"npm-app-id": "my_application_id"
}
}
```
## Prior Art