Git Product home page Git Product logo

flashpaper's Introduction

FlashPaper

A one-time encrypted zero-knowledge password/secret sharing application focused on simplicity and security. No database or complicated set-up required.

Docker

Demo

https://flashpaper.io

Picture of Main Page

Installation

Docker (Recommended)

The latest release of FlashPaper is available at ghcr.io/andrewpaglusch/flashpaper.

  1. Download docker-compose.yml from this repo
  2. Edit docker-compose.yml with your customizations
  3. Run docker-compose up -d to start FlashPaper
  4. Set up a reverse-proxy in front of FlashPaper that terminates SSL/TLS

Building an Image

You can build your own image using the provided Dockerfile in the docker/ folder.

In order to build FlashPaper, run docker build . -t flashpaper -f docker/Dockerfile. If you would like to build FlashPaper for a different CPU architecture, replace docker/Dockerfile with the appropriate Dockerfile. You can also build via docker-compose by replacing the image: line in docker-compose.yml with the following (make sure to choose the Dockerfile for your architecture):

build:
    context: .
    dockerfile: docker/Dockerfile

Traditional

Requirements: PHP 7.0+ and a web server

  1. Download and extract the latest release of FlashPaper to the document root of your web server
  2. Copy settings.example.php to settings.php and make customizations to that file
  3. Disable access logging in your web server's configuration so nothing sensitive (IP addresses, user agent strings, timestamps, etc) are logged to disk

How It Works

Submitting Secret

  1. <random>--secrets.sqlite sqlite database created (if it doesn't already exist)
  2. <random>--aes-static.key randomized 256-bit AES static key created (if one doesn't exist already)
  3. Random 256-bit AES key created
  4. Random 128-bit IV created
  5. Random 64-bit ID created
  6. ID + AES key hashed with bcrypt
  7. Submitted text encrypted with AES-256-CBC using AES key and random IV
  8. Ciphertext now encrypted with AES-256-CBC using static AES key and random IV
  9. ID and AES key joined (known as k)
  10. Random prune date/time generated using prune->min_days/max_days
  11. ID, IV, bcrypt hash, ciphertext, and prune epoch stored in DB
  12. k value returned to user in one-time URL

Retrieving Secret

  1. k value removed from URL
  2. k value split into two parts: ID and AES key
  3. IV, bcrypt hash, ciphertext looked up in DB with ID from k
  4. k bcrypt hash compared against bcrypt hash from DB (prevents tampering of URL)
  5. Ciphertext decrypted with static AES key and IV
  6. Ciphertext decrypted with AES key from k and IV
  7. Entry deleted from DB
  8. Decrypted text sent to user

Submitting Secrets via the API (with curl)

FlashPaper can accept secret submissions through a simple API. The retrieval URL will be returned in a JSON object.

Here's what it looks like to submit a secret with curl:

$ curl -s -X POST -d "secret=my secret&json=true" https://flashpaper.io
{"url":"https://flashpaper.io/?k=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}

Settings

prune:

  • enabled: Turn on/off auto-pruning of old secrets from the database upon page load
  • min_days/max_days: When a secret is submitted, a random date/time is generated between min_days and max_days in the future. After that date/time has elapsed, the secret will be pruned from the database if enabled is set to true. This is to prevent your database from being filled with secrets that are never retrieved. NOTE: Even if enabled is set to false, the prune value will still be generated and stored in the database, but secrets will not be pruned unless enabled is switched to true.

base_url:

FlashPaper will try to generate the secret retrieval URL based on information provided by the upstream webserver. This process isn't always 100% accurate. If the secret retrieval URL that FlashPaper creates isn't correct for your setup (this usually happens when you're using a reverse proxy upstream), you can manually specify the URL that FlashPaper will use. For example: A base_url of "https://foo.com/flashpaper" will result in retrieval URLs like "https://foo.com/flashpaper/?k=xxxxxxxxxxxxx".

display_logo:

  • true: The logo set in site_logo (either a file path or a URL) will be displayed at the top of the page. If site_logo isn't set, the default FlashPaper logo at img/logo.png will be displayed
  • false: No logo will be displayed on your FlashPaper instance

display_title:

  • true: The setting site_title will be displayed at the top of the page. If display_logo is enabled, the text will appear to the right of the logo.
  • false: The setting site_title will not be displayed.

Donations

PayPal: https://paypal.me/AndrewPaglusch

BitCoin: 1EYDa33S14ejuQGMhSjtBUmBHTBB8mbTRs

Donations are not expected, but they are very appreciated!

flashpaper's People

Contributors

andrewpaglusch avatar barry-smithjr avatar darkkronicle avatar dehlirious avatar dependabot[bot] avatar mattburchett avatar matthew-jenkins avatar modem7 avatar sokai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

flashpaper's Issues

PHP Undefined Variable Warning

display_secret_code($json); # secret submitted. display url/code

The above line references the variable $json, which is not defined. I believe it should be replaced with false. This results in the following warning being logged:

PHP message: PHP Warning:  Undefined variable $json in /var/www/html/index.php on line 27

Suggestion: Color Themes

I'd love a way to set a docker container variable to change the color of certain elements, or possibly even to add a logo somewhere on the page. I'd love to use this for work to request password data from clients.

Right now we are using a branded version of onetimesecret with our primary color, a favicon, and our logo, but it doesn't play very nice on a mobile phone.

If I could replicate our use case for that and set this up instead, I think that would be easier/better for us, but we'd want it branded and to have our logo in it.

Or perhaps we could just embed this via an iFrame on on our website instead?

PS - How can we edit the templates via Docker install?

ARM image

Is it possible to start the container with docker-compose on ARM?

Testing it I get this error:
ERROR: no matching manifest for linux/arm64/v8 in the manifest list entries

Customization

It would be nice if we could customize the style and some basic settings with a YAML configuration file or something similar.

Some of the details I'd like to customize:

  • Automatically redirect to HTTPS
  • Page <title>
  • Add a simple announcement message
  • Stylesheet (e.g. load theme.css to customize look and feel)

Doing it this way makes software updates (without losing settings) easier.

Translation of template?

Hi,

Thanks for this app!

I would like to know if it was possible to translate all the "bloc" of template + credentials and credit card?

Thanks in advance :)

Get URL without HTML

Hello! Is there any way to get a secret from a POST request without the entire HTML page? I just want to be able to make a request and get the URL to send somewhere else.

I'm using the request curl -s -X POST -d "secret=<secret>&submit=" https://<flashpaper>/ and it returns the full view_code.php webpage.

I'm pretty sure this is where it is requested: https://github.com/AndrewPaglusch/FlashPaper/blob/master/index.php#L19-L23

Am I missing something? Or should I just fork and add the ability to add a parameter like json?

Feature Request: Email URL

Use Case

We use FlashPaper when requesting sensitive information from clients. Even though we provide simple, stey-by-step instructions for how to use FlashPaper, many of our clients still don't send us the URLs to decrypt their messages.

As much as this is a people problem, instead of a technical problem, I'd love if it could be addressed.

Possible Solution

Allow us to enable automatically sending URLs to an email address of our choice. It could use the PHP mail() function to keep it simple or PHPMailer if something more robust is needed. This feature be disabled by default unless manually enabled in settings.php for extra security.

settings.php:

'email_secure_url' => '[email protected]',

max_secret_length not quite working as expected

First, I wanted to say thanks - this is a great little project. Being able to encrypt a message both via a simple web page and via a simple curl command is very handy.

I recently changed my max_secret_length in /settings.php to 10240. When I went to test it by pasting a giant blob of text into FlashPaper, I noticed a couple things:

  1. The input box limits me to the first 10240 characters of pasted text, as expected. That's good.
  2. Pressing the "encrypt" button afterward results in a generic "Input length too long" message. Maybe newline characters are being counted differently between the text input box validation and the strlen comparison in line 70 of /index.php?
    if ( strlen($_POST['secret']) > $settings['max_secret_length'] ) { throw new exception("Input length too long"); }
  3. Although you can customize error_secret_too_long in /settings.php, it doesn't seem to be referenced anywhere, e.g. in the exception message above.

In case it matters, the server environment is:
FlashPaper release 2.0.0
PHP 7.4.28
Apache 2.4.6
Red Hat Enterprise Linux 7.9 on x86_64

The client environment for the test above was:
Windows 10 on x86_64
Chrome 102.0.5005.115 and Firefox Nightly 103.0a1
... so maybe some Windows line ending or UTF character encoding shenanigans are at play?

flashpaper-test-input-long.txt

Trying to get in touch regarding a security issue

Hey there!

I'd like to report a security issue but cannot find contact instructions on your repository.

If not a hassle, might you kindly add a SECURITY.md file with an email, or another contact method? GitHub recommends this best practice to ensure security issues are responsibly disclosed, and it would serve as a simple instruction for security researchers in the future.

Thank you for your consideration, and I look forward to hearing from you!

(cc @huntr-helper)

Onboarding Message

I think the copy could provide a more self-explanatory user experience.

Create New

  • Self-Destructing Message → Create A New Self-Destructing Message
  • Submit → Encrypt Message

Self-Destructing URL

  • Needs some language to explain what to do next. It's not obvious to an end-user that the URL isn't automatically shared with the host.: e.g. “Share this URL via email, chat or other messaging service. It will self-destruct after being viewed once.”

Configure generated links to use full domain instead of private hostame?

I'm running the application in a docker container and had no issues getting it to work via reverse proxy, but the links that are being generated are using the hostname and mapped port instead of the full domain. So for example, the site is https://website.com/flashpaper but the URL is http://hostname:8989/?k=abcdef...

I am not seeing any information on how to configure the software to use a specific server or domain name for the generated URLs. Is this currently implemented?

add autofocus to textarea

Just a very small new feature: add autofocus in textarea in html/submit_secret.php just like so:

<textarea autofocus class="form-control"...

Would be a good idea to put the latest version of FlashPaper at https://flashpaper.io/

Characters in 'secret' POST Variable Break Results

Adding an ampersand in the secret variable when using the nostyle=true argument to generate links will break the resulting message.

For example:

Request
curl -s -X POST -d "nostyle=true&secret=1&2&3&4&5" http://password.paglusch.com

Will return:
http://password.paglusch.com/?k=OeLX-jHAm-Wc6ijRMvScfoYFG1p9mr2dwSTSPafRoss$

Which is recovered incorrectly:
curl -s -X POST -d "nostyle=true" http://password.paglusch.com/?k=OeLX-jHAm-Wc6ijRMvScfoYFG1p9mr2dwSTSPafRoss$ 1

Requiring incoming data in the secret argument to be Base64 encoded beforehand may solve this. The "/" character, which is occasionally returned by Base64 encoding, may also cause problems. This will have to be tested.

Add header/footer

I'd recommend adding a constant header and footer with a dynamic body. Not too complicated for a simple secret sharing app and not too simple for a potential secret management system.

Cheers!

Unable to update to 2.2.3

Hi mate,

Firstly, really love your work - it's much appreciated.

When trying to update to your latest release, I'm hitting a snag trying to pull it - getting an error message:
no matching manifest for linux/amd64 in the manifest list entries

I can see that you have arm64 mentioned in the repo, but that's it - is there something I'm missing here?

Thanks!
Dave

Cloudflare Tunnel Access Flashpaper?

I installed Flashpaper on my homelab server and it comes up locally, however when I add it to my Cloudflare zero trust tunnel 'http' with :8080 and path /flashpaper (and without) I hear a tiny electronic laughter as it doesn't come up. It seems to be redirecting to http from my public hostname sub-domain link. Any help would be most grateful as I love the program
5

All generated link return 404 not found

I thought everything was working (since it generated the link, etc) however when I tried to test by opening the link I'm consistently getting this error page. Sorry I failed to actually test it. Any ideas other than OE (operator error)?
9

Copy Button

Greetings from reddit :)

I added a Copy button in 2 pages (view_code and view_secret) in case you are interested.

First, in html/view_code.php, doesn't make sense to have a textarea for a URL so here it is in input text:
<input type="text" readonly class="form-control" name="secret" style="resize: vertical;" value="<?php echo $message ?>" />

html/header.html

<script>
function copyText() {
     var textToCopy = document.getElementById("copy");
     textToCopy.select();
     document.execCommand("copy");
}
</script>

html/view_secret.php

<div class="col">
<button class="btn btn-primary" type="button" onclick="copyText()">Copy</button>
</div>

Also, you need to add id="copy" in the textarea

html/view_code.php

<div class="col">
<button class="btn btn-primary" type="button" onclick="copyText()">Copy</button>
</div>

Would be a nice feature with multi-languages like with gettext. Code would automatically detects the browser language and translate the text accordingly.

Ability to decrypt secret into JSON payload

Now that we have the ability to submit secrets via JSON payloads, we should be
able to also decrypt a secret via a JSON payload.

My thought is to send a payload of something like this:

{
	"key": "abcdefg1234567890",
	"message": "Foobar"
}

Request, dual logos

Hi, thanks for your awesome software, with the new update there is now dark mode. Can there be two logos one for dark mode and one for light mode?

Message size limits?

What are the limits for input length? I've run in to the following error multiple times.

Input length too long

Can a counter (e.g. 2456/10000 characters) be added so we know when we're close to the limitation? The <textarea> could also be given a maxlength.

Suggestion: Change "requirements" section

Hello,
thank you for this lightweight and very useful software.
I'm running it on Windows 2016 with IIS and PHP 7.x and it works perfectly so having Linux as a requirement should not be necessary.
Regards,

Red.

Need Docker Documentation

Now that Docker is a supported install method, we need to add some documentation on how to do that.

Proper DNS name

Hi sorry, if this has been answered, how can I set the valid URL that I want to return? Im running nginx with proxy outside the docker, and the site works just fine, but when the URL is generated its giving me an http://127.0.0.1:8080 (which is the nginx proxy listener). Is there a setting to put the URL I want in? I tested with full url=false which didnt seem to have any effect, and also tried setting some nginx settings like proxy host and such. Not sure if there is a setting to force set the URL or if this is an nginx proxy issue.

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.