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

Readme environments updates #67

Closed
wants to merge 162 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
4baee31
feat: add models and migrations
rohan-chaturvedi Aug 7, 2023
3229aa2
feat: add permission utils
rohan-chaturvedi Aug 7, 2023
d51024c
refactor: split graphene types and resolvers
rohan-chaturvedi Aug 7, 2023
9ca2d58
feat: mutations for envs and secrets
rohan-chaturvedi Aug 7, 2023
84a4427
chore: update vscode settings
rohan-chaturvedi Aug 7, 2023
e9adc3e
fix: misc fixes to schema
rohan-chaturvedi Aug 7, 2023
1d51d61
feat: update graphql schema and types
rohan-chaturvedi Aug 7, 2023
569983a
chore: update graphql schema export command
rohan-chaturvedi Aug 7, 2023
aa69ae3
fix: add identity key to env model
rohan-chaturvedi Aug 11, 2023
41f9573
fix: misc fixes and updates to schema
rohan-chaturvedi Aug 11, 2023
b0201d9
chore: regenerate frontend schema and types
rohan-chaturvedi Aug 11, 2023
7509897
feat: add frontend queries and mutations
rohan-chaturvedi Aug 11, 2023
10d9cda
feat: crypto utils for asymmetric encryption
rohan-chaturvedi Aug 11, 2023
be97b5d
feat: env key utils
rohan-chaturvedi Aug 11, 2023
32151b8
feat: add string encrypt and decrypt utils
rohan-chaturvedi Aug 11, 2023
a462614
feat: add secrets page to app layout
rohan-chaturvedi Aug 11, 2023
b10f9c0
fix: env secret format
rohan-chaturvedi Aug 11, 2023
194ef50
fix: pss_env format
rohan-chaturvedi Aug 11, 2023
86916c8
feat: add secrets serializer
rohan-chaturvedi Aug 11, 2023
1fd6550
feat: add util to infer env from token
rohan-chaturvedi Aug 11, 2023
2f10bd3
feat: add rest api for secrets
rohan-chaturvedi Aug 11, 2023
8a14c61
fix: misc cleanup and fixes
rohan-chaturvedi Aug 11, 2023
31cf60b
feat: pass requests on /secrets to backend
rohan-chaturvedi Aug 11, 2023
0f2a537
fix: prefix and version ciphertexts
rohan-chaturvedi Aug 12, 2023
c92e9d3
fix: update wrapped value max length
rohan-chaturvedi Aug 12, 2023
8ac2ded
chore: format on save
rohan-chaturvedi Aug 12, 2023
dd260eb
fix: rename env secret model to env token, add user token model
rohan-chaturvedi Aug 12, 2023
30f513f
chore: update types and schema to use environmen token
rohan-chaturvedi Aug 12, 2023
76fd050
chore: regenerate types and schema
rohan-chaturvedi Aug 12, 2023
4e875a2
fix: update queries, mutations and utils for environment tokens
rohan-chaturvedi Aug 12, 2023
e75673b
feat: add util to generate user token
rohan-chaturvedi Aug 12, 2023
a23c5d1
feat: add schema, types and resolvers for user tokens
rohan-chaturvedi Aug 12, 2023
4fb654b
chore: regenerate schema.graphql and types
rohan-chaturvedi Aug 12, 2023
03e99e5
feat: query and mutation for user tokens
rohan-chaturvedi Aug 12, 2023
c4c6dc6
feat: test user tokens
rohan-chaturvedi Aug 12, 2023
36ce323
feat: add user token kms api, misc fixes
rohan-chaturvedi Aug 13, 2023
bddb6da
fix: add app context to env keys in token auth
rohan-chaturvedi Aug 16, 2023
9236cde
fix: use salt when hashing keys, encode hashes in hex
rohan-chaturvedi Aug 17, 2023
f230fd1
fix: secrets api POST
rohan-chaturvedi Aug 17, 2023
befe4ca
fix: secrets api DELETE
rohan-chaturvedi Aug 17, 2023
f07aca0
fix: don't return deleted secrets in graphql resolver
rohan-chaturvedi Aug 17, 2023
8b3133b
fix: secrets api PUT
rohan-chaturvedi Aug 17, 2023
d3d1d99
feat: modified user token response
nimish-ks Aug 19, 2023
d4b3e95
changed userId to snaky snakes
nimish-ks Aug 20, 2023
7c0ab61
refactor: frontend graphql setup
rohan-chaturvedi Aug 20, 2023
006ab2d
feat: create input type for environment mutation
rohan-chaturvedi Aug 20, 2023
418c148
feat: setup all three envs for app
rohan-chaturvedi Aug 20, 2023
141283d
fix: default env names
rohan-chaturvedi Aug 20, 2023
339346c
fix: reset version
rohan-chaturvedi Aug 21, 2023
7cc7552
fix: dont return keys for deleted apps
rohan-chaturvedi Aug 21, 2023
23dcdce
feat: user keyring context
rohan-chaturvedi Aug 22, 2023
8458fa2
fix: check that all secrets to be deleted exist
rohan-chaturvedi Aug 24, 2023
e06e919
fix: order of checks
rohan-chaturvedi Aug 24, 2023
c8dcb80
fix: allow querying specific environment
rohan-chaturvedi Aug 27, 2023
a0ab1d4
fix: misc fixes for secret mutations
rohan-chaturvedi Aug 27, 2023
f537428
chore: regenerate types and schema
rohan-chaturvedi Aug 27, 2023
bc5fba3
fix: update default input style
rohan-chaturvedi Aug 27, 2023
a408731
feat: add some utils
rohan-chaturvedi Aug 27, 2023
aa36c49
feat: add queries and mutations
rohan-chaturvedi Aug 27, 2023
e01a341
feat: update secrets overvew page, add environment page
rohan-chaturvedi Aug 27, 2023
fb62f97
fix: encrypting string util
rohan-chaturvedi Aug 28, 2023
9cfc6b8
fix: create org operation name
rohan-chaturvedi Aug 28, 2023
211ca91
fix: update models and schema for tags
rohan-chaturvedi Aug 29, 2023
4d31054
feat: update secrets query for new tags schema
rohan-chaturvedi Aug 29, 2023
4da0fa8
feat: mutation and query to create and fetch tags
rohan-chaturvedi Aug 29, 2023
711e1f8
fix: misc fixes for tags
rohan-chaturvedi Aug 30, 2023
1ba8dd6
feat: allow querying email and username for org members
rohan-chaturvedi Aug 30, 2023
876c6d0
fix: get secret history users
rohan-chaturvedi Aug 30, 2023
5bdc2d8
feat: added encryption key to user token response
nimish-ks Aug 30, 2023
727a464
feat: add warning button variant
rohan-chaturvedi Aug 31, 2023
b72fe95
feat: misc ui improvements to keyring unlock dialog
rohan-chaturvedi Aug 31, 2023
5d1d5f1
feat: misc ui improvements to secrets screen
rohan-chaturvedi Aug 31, 2023
93f9511
fix: use full screen width for secrets
rohan-chaturvedi Aug 31, 2023
268d79c
fix: misc improvements to secret row ui
rohan-chaturvedi Aug 31, 2023
e1c6c77
fix: active search query causes secret to appear modified
rohan-chaturvedi Aug 31, 2023
5420ca2
fix: focus styles
rohan-chaturvedi Aug 31, 2023
185616a
fix: misc fixes for light theme
rohan-chaturvedi Aug 31, 2023
41b242a
fix: correctly infer common secret names accross envs
rohan-chaturvedi Aug 31, 2023
9a0a58b
fix: col gap
rohan-chaturvedi Aug 31, 2023
24ac547
feat: add danger button variant
rohan-chaturvedi Aug 31, 2023
ee0da19
feat: use danger button variant for deletes
rohan-chaturvedi Aug 31, 2023
f165e27
fix: use danger button variant for inline delete button
rohan-chaturvedi Aug 31, 2023
a0be7ad
fix: delete button light theme
rohan-chaturvedi Aug 31, 2023
0cae6ab
fix: input buttons overlapping text
rohan-chaturvedi Sep 1, 2023
ff82751
feat: create new secrets client side only, add polling
rohan-chaturvedi Sep 1, 2023
0d47e23
fix: keep tags in single line
rohan-chaturvedi Sep 1, 2023
b28b471
fix: handle deleting new secrets that aren't deployed yet
rohan-chaturvedi Sep 1, 2023
942593d
feat: secrets breadcrumbs
rohan-chaturvedi Sep 1, 2023
0a1ca4a
fix: replace orange shades with amber
rohan-chaturvedi Sep 1, 2023
672ffed
feat: decrypt history
rohan-chaturvedi Sep 4, 2023
8bc4888
feat: show changed properties in history dialog
rohan-chaturvedi Sep 4, 2023
29a551e
fix: input bg
rohan-chaturvedi Sep 4, 2023
ba72b46
fix: input change handler, tag selector ui
rohan-chaturvedi Sep 4, 2023
bf9dde8
fix: remove unused util
rohan-chaturvedi Sep 4, 2023
d725235
feat: service tokens
rohan-chaturvedi Sep 6, 2023
cafe2ce
fix: allow service tokens to fetch secrets
rohan-chaturvedi Sep 7, 2023
3d9fffe
fix: only check user access for user tokens
rohan-chaturvedi Sep 7, 2023
6372329
fix: handle secret events for service tokens
rohan-chaturvedi Sep 7, 2023
4f53f41
refactor: tokens tab
rohan-chaturvedi Sep 8, 2023
238cea7
fix: reset dialog state when closed
rohan-chaturvedi Sep 8, 2023
bca4adb
fix: history log for service tokens
rohan-chaturvedi Sep 9, 2023
fe8ce3e
fix: return 403 for revoked tokens
rohan-chaturvedi Sep 9, 2023
429d3a2
feat: token expiry
rohan-chaturvedi Sep 9, 2023
5312bcb
feat: update copy and text color for expired tokens
rohan-chaturvedi Sep 9, 2023
32b96be
fix: radiogroup comparison function
rohan-chaturvedi Sep 9, 2023
7e4056a
test: print timestamps to debug
rohan-chaturvedi Sep 11, 2023
2709fd7
fix: check for expired tokens in kms views
rohan-chaturvedi Sep 11, 2023
284bc63
fix: expiry check for tokens with no expiry
rohan-chaturvedi Sep 11, 2023
5eaae40
fix: future timestamp math
rohan-chaturvedi Sep 11, 2023
be983fe
refactor: use single endpoint for secret tokens
rohan-chaturvedi Sep 11, 2023
9593548
fix: misc ui / ux improvements to tokens screen
rohan-chaturvedi Sep 11, 2023
3451af1
fix: calculate token expiry when creating tokens
rohan-chaturvedi Sep 12, 2023
7d234d9
fix: remove 2min expiry option
rohan-chaturvedi Sep 12, 2023
7c88797
feat: add invite model, schema, types and operations
rohan-chaturvedi Sep 12, 2023
7cc25e1
chore: regenerate schema and types
rohan-chaturvedi Sep 12, 2023
9d9ee77
feat: add invites query and mutation
rohan-chaturvedi Sep 12, 2023
61b6983
feat: add organisation context
rohan-chaturvedi Sep 12, 2023
69a4fa1
feat: increase free app limit to 5
rohan-chaturvedi Sep 13, 2023
7bc5426
feat: add role to invite model
rohan-chaturvedi Sep 14, 2023
e466a8c
feat: add invite validation query
rohan-chaturvedi Sep 14, 2023
d74c9a4
chore: regenerate schema and types
rohan-chaturvedi Sep 14, 2023
2537295
feat: members page
rohan-chaturvedi Sep 14, 2023
7ce8616
feat: invite page
rohan-chaturvedi Sep 14, 2023
45c06a6
fix: misc tweaks to organisation context
rohan-chaturvedi Sep 14, 2023
b8645be
fix: redirect to callback url on signin
rohan-chaturvedi Sep 14, 2023
ef9eb71
fix: button titles
rohan-chaturvedi Sep 14, 2023
3b6fd5d
feat: add apps, custom delete method to org member model
rohan-chaturvedi Sep 16, 2023
b4b67d2
feat: add create and delete org member mutations
rohan-chaturvedi Sep 16, 2023
52de662
chore: regenerate graphql schema
rohan-chaturvedi Sep 16, 2023
c84f2b2
feat: create and delete org member mutations
rohan-chaturvedi Sep 16, 2023
c77ba95
fix: input ring style
rohan-chaturvedi Sep 16, 2023
4e5c7b2
fix: account for repeated words in list index
rohan-chaturvedi Sep 16, 2023
9de9629
fix: remove redundant border
rohan-chaturvedi Sep 16, 2023
e79226b
fix: restyle password strength bar
rohan-chaturvedi Sep 16, 2023
ac4361d
feat: restyle dark mode toggle
rohan-chaturvedi Sep 16, 2023
b3cd68c
feat: new user onboarding flow
rohan-chaturvedi Sep 16, 2023
351e348
feat: add delete handler and ui to members page
rohan-chaturvedi Sep 16, 2023
5f6e1ab
fix: org member queries to account for soft deletes
rohan-chaturvedi Sep 16, 2023
c147bf1
fix: org member queries
rohan-chaturvedi Sep 16, 2023
04a2ab2
feat: improve mode toggle styling
rohan-chaturvedi Sep 18, 2023
e484f78
fix: misc styling fixes to account password input
rohan-chaturvedi Sep 18, 2023
839da58
fix: restyle sidebar
rohan-chaturvedi Sep 18, 2023
37880be
fix: add icons to mode toggle in onboarding navbar
rohan-chaturvedi Sep 18, 2023
b901573
feat: allow copying invite link from history, light theme fixes
rohan-chaturvedi Sep 18, 2023
babbfcf
feat: add success pane
rohan-chaturvedi Sep 18, 2023
41a09e1
fix: only return apps that a user has access too
rohan-chaturvedi Sep 18, 2023
a617450
fix: icon button color
rohan-chaturvedi Sep 18, 2023
5a2fe7a
fix: update role mutation
rohan-chaturvedi Sep 19, 2023
8a3b274
feat: update org member resolvers, add full name and avatar url
rohan-chaturvedi Sep 19, 2023
d00ffe0
chore: regenerate types
rohan-chaturvedi Sep 19, 2023
4171aa0
feat: update role mutation
rohan-chaturvedi Sep 19, 2023
340a63d
feat: query user full name and avatar
rohan-chaturvedi Sep 19, 2023
febff3f
feat: add referrer to head to fix google avatar 403s
rohan-chaturvedi Sep 19, 2023
a4e77ac
feat: allow updating user roles inline, restyle user row
rohan-chaturvedi Sep 19, 2023
b6520d8
feat: avatar component
rohan-chaturvedi Sep 19, 2023
2e4fb0e
feat: show user fullname and avatar in history
rohan-chaturvedi Sep 19, 2023
d4c04c6
feat: user app management
rohan-chaturvedi Sep 21, 2023
270ebc7
chore: remove commented code
rohan-chaturvedi Sep 21, 2023
375a7fd
feat: simplified nginx config
nimish-ks Sep 21, 2023
19d8249
Merge branch 'multi-user' into nginx-config
nimish-ks Sep 21, 2023
9586ee6
WIP
nimish-ks Sep 21, 2023
013b0b8
wip
nimish-ks Sep 21, 2023
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
8 changes: 6 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"package-lock.json": true
},
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": [
"source.addMissingImports",
"source.fixAll.eslint"
Expand All @@ -21,5 +21,9 @@
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.ignorePath": ".gitignore" // Don't run prettier for files listed in .gitignore
"prettier.ignorePath": ".gitignore",
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8",
"editor.formatOnSave": true
} // Don't run prettier for files listed in .gitignore
}
102 changes: 56 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<img height="68" width="306" src="img/phase-console-wordmark-dark.png" alt="Phase">
</h1>

<h3 align="center">Open Source, end-to-end encrypted key management platform for developers to encrypt data in their apps.</h3>
<h3 align="center">Open Source, end-to-end encrypted, self-hostable all in one platform for developers to manage secrets and environment variables. From their laptop 💻 to the cloud ☁️.</h3>

<div align="center">
<a href="https://phase.dev">Website</a> |
Expand All @@ -13,45 +13,70 @@
</div>

<hr/>

<img src="img/console-home.png" width="100%" alt="Phase Console" />

<div width="100%">
<img src="img/console-logs.png" alt="Phase Console" width="47%">
&nbsp; &nbsp; &nbsp; &nbsp;
<img src="img/vscode-demo.png" alt="Phase Console" width="47%"/>
</div>

<br>

[Phase Console](https://phase.dev) is an open source, end-to-end encrypted key management solution for developers to seamlessly encrypt production data in their apps.

We're on a mission to make strong encryption accessible to all developers, not just security teams. That means redesigning the entire developer experience from the ground up.
## Console

<img src="img/console-home.png" width="100%" alt="Phase Console" />

## Features
- **[Phase Console](https://console.phase.dev)**: Dashboard for seamlessly creating, managing, rotating secrets and environment variables

- **[Phase Console](https://console.phase.dev)**: Dashboard for seamlessly creating, managing, rotating and monitoring keys
- **[Phase KMS](https://phase.dev)**: A zero knowledge key management service
- **[Dual-Key Model](https://docs.phase.dev/security#dual-key-model)**: Avoid single point of compromise of the private key via [secret splitting schemes](https://en.wikipedia.org/wiki/Secret_sharing)
- **[Hold your keys](https://docs.phase.dev/security/phase-encryption#account-keyring)**: Maintain self-custody of your root keys via 24 word mnemonic phrase
- **Secret management**: Diffs, version control and Point-in-time Recovery
- Fine grained Role-based and cryptographic access control, per application, per environment.
- **Service Tokens**:
- **Secret referencing**: Inheritance
- **[Audit Logs]()**
- **[Self Hosting](https://docs.phase.dev)**: Run Phase on your own infrastructure
- **[Client SDKs](https://docs.phase.dev/sdks)**: Asynchronously encrypt data in the browsers of your users without any external API or sensitive keys [Live Demo](https://phase.dev/#use-cases)
- **[Server SDKs](https://docs.phase.dev/sdks)**: Securely decrypt and process data in memory only when you need to with 3 lines of code
- **[Phase I/O]()**: Self-hosted EaaS (Encryption as a Service) and a transparent proxy encryption (Coming Soon)
- **[Phase KMS](https://phase.dev)**: A zero knowledge key management service
- **[SDKs](https://docs.phase.dev/sdks)**: Encrypt / decrypt data with a few lines of code.

And much more.

---

## What about SSE?
## CLI

```fish
# Your existing secrets
> cat .env
AWS_ACCESS_KEY_ID="AKIA2OGYBAH63UA3VNFG"
AWS_SECRET_ACCESS_KEY="V5yWXDe82Gohf9DYBhpatYZ74a5fiKfJVx8rx6W1"

# Import your existing secrets
> phase secrets import .env
Successfully imported and encrypted 2 secrets.
To view them please run: phase secrets list

Relying on automatic database, disk or bucket level encryption has its limitations, since the data is automatically decrypted when retrieved and the keys typically belong to the hosting provider. A breach is a single SQL or a IAM misconfiguration away.
# View your secrets in Phase
> phase secrets list
KEY 🗝️ | VALUE ✨
----------------------------------------------------------------------------------------------------
AWS_ACCESS_KEY_ID | AKI**************NFG
AWS_SECRET_ACCESS_KEY | V5y**********************************6W1

See:
🥽 To uncover the secrets, use: phase secrets list --show

# Get rid of your .env
> rm .env

# Seamlessly inject secrets during runtime
> phase run yarn dev
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
```


- **CLI**: Fetch, decrypt and inject secrets and environment variables to your application. Zero code changes required.
- Inject
- Export secrets in a dotenv format
- **Cross platform**: Easily install the Phase CLI on macOS, Ubuntu/Arch/Redhat/Alpine Linux, Windows, Docker.
- **Keyring Integration** - Store keys and credentials securely in [macOS Keychain](https://en.wikipedia.org/wiki/Keychain_%28software%29), [Windows Credential Locker](https://learn.microsoft.com/en-us/windows/uwp/security/credential-locker), [KDE Wallet](https://en.wikipedia.org/wiki/KWallet), [GNOME Keyring](https://en.wikipedia.org/wiki/GNOME_Keyring) etc.
- **[Private Key Sharding](https://docs.phase.dev/security#dual-key-model)**: Avoid single point of compromise of the private key via [secret splitting schemes](https://en.wikipedia.org/wiki/Secret_sharing)

- [OWASP - Cryptographic Failures](https://owasp.org/Top10/A02_2021-Cryptographic_Failures/#example-attack-scenarios)
- [IAM misconfiguration](https://github.com/nagwww/s3-leaks)
- [Problems with S3 encryption](https://www.secwale.com/p/encryption)

---

Expand All @@ -65,11 +90,12 @@ The quickest and most reliable way to get started is making a new free account o

### Deploy Phase Console on your infrastructure

Deployment options:
- [Docker Compose](https://docs.phase.dev/self-hosting/docker-compose)
- [AWS](https://docs.phase.dev/self-hosting/aws)
- [Azure](https://docs.phase.dev/self-hosting/azure)
- [Google Cloud Platform](https://docs.phase.dev/self-hosting/gcp)
- [DigitalOcean](https://docs.phase.dev/self-hosting/digitalocean)

- Docker-compose
- AWS
- DigitalOcean

See: [Self-hosting Phase](https://docs.phase.dev/self-hosting)

Expand All @@ -83,29 +109,13 @@ See: [Self-hosting Phase](https://docs.phase.dev/self-hosting)

More coming soon!

Example:

```js
// Import & initialize
const Phase = require('@phase.dev/phase-node')
const phase = new Phase(APP_ID, APP_SECRET)

// Encrypt
const ciphertext = await phase.encrypt('hello world')

// Decrypt
const plaintext = await phase.decrypt(ciphertext)
console.log(plaintext)
$ hello world
```

---

## Community vs Enterprise edition

Phase operates on an [open-core](https://en.wikipedia.org/wiki/Open-core_model) model, similar to that of [GitLab](https://gitlab.com), [Infisical](https://infisical.com), [PostHog](https://posthog.com) etc.
Phase operates on an [open-core](https://en.wikipedia.org/wiki/Open-core_model) model, similar to that of [GitLab](https://gitlab.com).

This repo available under the [MIT expat license](/LICENSE), with the exception of the `ee` directory which will contain premium Pro or Enterprise features requiring a Phase license in the future.
This repo available under the [MIT expat license](/LICENSE), with the exception of the `ee` directory which will contain Pro or Enterprise features requiring a Phase license.

---

Expand All @@ -121,7 +131,7 @@ For more information see: [SECURITY.md](/SECURITY.md)

## Contributing

Whether it's big or small, we love contributions. See [CONTRIBUTING.md](/CONTRIBUTING.md)
We love contributions. See [CONTRIBUTING.md](/CONTRIBUTING.md)

You can join our [Slack](https://join.slack.com/t/phase-community/shared_invite/zt-1tkwzl31z-a6yCB5Uqlj~V2x43ep2Evg) if you have any questions!

Expand Down
4 changes: 2 additions & 2 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Phase Console - Backend

Python Django REST api + Postgres
Django + Graphene + DRF

### Generate graphql schema for frontend

```bash
./manage.py graphql_schema --schema backend.schema.schema --out ../dashboard/apollo/schema.graphql
./manage.py graphql_schema --schema backend.schema.schema --out ../frontend/apollo/schema.graphql
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Generated by Django 4.2.3 on 2023-07-31 10:52

from django.conf import settings
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

dependencies = [
('api', '0016_organisation_plan'),
]

operations = [
migrations.CreateModel(
name='Environment',
fields=[
('id', models.TextField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.CharField(max_length=64)),
('env_type', models.CharField(choices=[('dev', 'Development'), ('staging', 'Staging'), ('prod', 'Production')], default='dev', max_length=7)),
('wrapped_seed', models.CharField(max_length=208)),
('wrapped_salt', models.CharField(max_length=208)),
('created_at', models.DateTimeField(auto_now_add=True, null=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('deleted_at', models.DateTimeField(blank=True, null=True)),
('is_deleted', models.BooleanField(default=False)),
('app', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.app')),
],
),
migrations.CreateModel(
name='Secret',
fields=[
('id', models.TextField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('collection', models.TextField(blank=True, null=True)),
('key', models.TextField()),
('key_digest', models.TextField()),
('value', models.TextField()),
('version', models.IntegerField(default=1)),
('tags', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=64), size=10)),
('comment', models.TextField()),
('created_at', models.DateTimeField(auto_now_add=True, null=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('deleted_at', models.DateTimeField(blank=True, null=True)),
('environment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.environment')),
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='SecretTag',
fields=[
('id', models.TextField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.CharField(max_length=64)),
('organisation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.organisation')),
],
),
migrations.CreateModel(
name='SecretEvent',
fields=[
('id', models.TextField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('collection', models.TextField(blank=True, null=True)),
('key', models.TextField()),
('key_digest', models.TextField()),
('value', models.TextField()),
('version', models.IntegerField(default=1)),
('tags', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=64), size=10)),
('comment', models.TextField()),
('event_type', models.CharField(choices=[('C', 'Create'), ('R', 'Read'), ('U', 'Update'), ('D', 'Delete')], default='C', max_length=1)),
('timestamp', models.BigIntegerField()),
('environment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.environment')),
('secret', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.secret')),
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='EnvironmentSecret',
fields=[
('id', models.TextField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('identity_key', models.CharField(max_length=256)),
('environment_token', models.CharField(max_length=64)),
('wrapped_key_share', models.CharField(max_length=406)),
('token', models.CharField(max_length=64)),
('created_at', models.DateTimeField(auto_now_add=True, null=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('deleted_at', models.DateTimeField(blank=True, null=True)),
('environment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.environment')),
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='EnvironmentKey',
fields=[
('id', models.TextField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('identity_key', models.CharField(max_length=256)),
('environment_token', models.CharField(max_length=64)),
('wrapped_seed', models.CharField(max_length=208)),
('wrapped_salt', models.CharField(max_length=208)),
('created_at', models.DateTimeField(auto_now_add=True, null=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('deleted_at', models.DateTimeField(blank=True, null=True)),
('environment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.environment')),
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
],
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Generated by Django 4.2.3 on 2023-08-01 07:57

from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

dependencies = [
('api', '0017_environment_secret_secrettag_secretevent_and_more'),
]

operations = [
migrations.RenameField(
model_name='environmentsecret',
old_name='environment_token',
new_name='name',
),
migrations.RemoveField(
model_name='environmentkey',
name='environment_token',
),
migrations.RemoveField(
model_name='secret',
name='collection',
),
migrations.AddField(
model_name='secrettag',
name='created_at',
field=models.DateTimeField(auto_now_add=True, null=True),
),
migrations.AddField(
model_name='secrettag',
name='deleted_at',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AddField(
model_name='secrettag',
name='updated_at',
field=models.DateTimeField(auto_now=True),
),
migrations.CreateModel(
name='SecretFolder',
fields=[
('id', models.TextField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.CharField(max_length=64)),
('created_at', models.DateTimeField(auto_now_add=True, null=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('deleted_at', models.DateTimeField(blank=True, null=True)),
('environment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.environment')),
('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.secretfolder')),
],
),
migrations.AddField(
model_name='secret',
name='folder',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='api.secretfolder'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 4.2.3 on 2023-08-02 07:03

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('api', '0018_rename_environment_token_environmentsecret_name_and_more'),
]

operations = [
migrations.RemoveField(
model_name='secret',
name='user',
),
migrations.RemoveField(
model_name='secretevent',
name='collection',
),
migrations.AddField(
model_name='secretevent',
name='folder',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='api.secretfolder'),
),
]
Loading
Loading