# gmail-secure-sdk

> Package securing the GMAIL functionalities

Latest version **1.1.14** (published 2021-06-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install gmail-secure-sdk
pnpm add gmail-secure-sdk
yarn add gmail-secure-sdk
bun add gmail-secure-sdk
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.14 |
| Published | 2021-06-06 |
| First published | 2021-05-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 17.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Hubert Jarocki |
| Maintainers | hubert.jarocki |

## Links

- npm: https://www.npmjs.com/package/gmail-secure-sdk
- Repository: https://github.com/hubertjarocki/gmail-secure-sdk
- Homepage: https://github.com/hubertjarocki/gmail-secure-sdk#readme
- Issues: https://github.com/hubertjarocki/gmail-secure-sdk/issues
- npm.io page: https://npm.io/package/gmail-secure-sdk

## Recent versions

- 1.1.14 (latest) — 2021-06-06
- 1.1.13 — 2021-06-06
- 1.1.12 — 2021-06-04
- 1.1.11 — 2021-06-04
- 1.1.10 — 2021-06-04
- 1.1.9 — 2021-06-03
- 1.1.8 — 2021-06-03
- 1.1.7 — 2021-06-03
- 1.1.6 — 2021-06-03
- 1.1.5 — 2021-06-03
- 1.1.3 — 2021-06-03
- 1.1.2 — 2021-06-03
- 1.1.0 — 2021-06-03
- 1.0.12 — 2021-06-01
- 1.0.11 — 2021-06-01
- … 10 more at https://npm.io/package/gmail-secure-sdk/versions

## README

# GMAIL-SECURE-SDK | POC

Proof of concept of a package made for Bachelor Thesis about security in GMAIL addons. 
This package catches a few AppsScript functionalities that may harm the user and tries to 
inform and protect the users about the possibly malicious actions of the application.

This package is meant for GMAIL addon projects that were started using the [apps-script-starter](https://github.com/labnol/apps-script-starter) by [labnol](https://github.com/labnol).






## Installation


Use the node package manager to install gmail-secure-sdk.

```bash
npm install gmail-secure-sdk
```





## Usage

Example usage:

```javascript
import * as GmailSecure from "gmail-secure-sdk"

function sendData(){
    const url = 'www.someapiurl.com'

    const options = {
        'method': 'POST',
        'contentType': 'application/json',
        'payload': JSON.stringify(data),
    };

    GmailSecure.fetchSecured(url, options);
}
```




## Functions

**Note & reminder**:
These functionalities are meant for educational purposes only, you're using it at your own risk.


### GmailSecured.fetchSecured(url, options)
This function wraps and uses the *UrlFetchApp()* provided by Apps Script. 

It checks if any data was sent to a third party, based on the request type. 
In case of a POST/PUT or PATCH request, the user gets informed by an email to its own. 
That email contains: 
- the date the data was sent on
- where it was sent to 
- what data has been sent* 


### GmailSecured.deleteSecured(permanentDelete)

```javascript
import * as GmailSecure from "gmail-secure-sdk"

function moveAllEmailsToTrash(){
    //make sure to use return as it must load a new card! 
    return GmailSecure.deleteSecured(false);
}
```

This function wraps the deleting of all emails functions provided by AppsScript.
Before the actual deletion gets executed, the user gets informed about it in a new card
and gets the choice to cancel the action or to proceed.

![userConsentCard](https://i.ibb.co/wwjCQBD/delete-Consent-Card.png)

The method accepts "permanentDelete" as boolean parameter. 
If true, the whole inbox gets ***deleted permanently*** - (hard delete).
If false, the whole inbox will be simply put in trash (soft delete).

In both cases, the user receives an email afterwards which contains:
- the deleted data*
- the date of deletion and other metadata.


***Important note:** If the email size exceeds the maximum body size (200KB) - the user still gets informed,
but without the bodies of the deleted or sent to third party emails. 
This may be solved in the future by splitting up the data and sending it in separate emails.







## License
[ISC](https://choosealicense.com/licenses/isc/)

---
_Source: https://npm.io/package/gmail-secure-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
