Skip to content

Core 1828 Docs Migration- Security: Topic and Subtopics#4

Merged
DavidCockerill merged 10 commits into
mainfrom
CORE-1828
Nov 15, 2022
Merged

Core 1828 Docs Migration- Security: Topic and Subtopics#4
DavidCockerill merged 10 commits into
mainfrom
CORE-1828

Conversation

@terraHDB

@terraHDB terraHDB commented Oct 6, 2022

Copy link
Copy Markdown
Contributor

This PR migrates Topic: Security and its subtopics. I updated operations in tables in Subtopic: users and roles.

This is the link to this page currently: https://harperdb.io/docs/security/users-roles/

Comment thread docs/security/basic-auth.md Outdated
@@ -0,0 +1,64 @@
# Authentication

HarperDB utilizes Basic Auth to secure our REST requests. In the context of an HTTP transaction, **basic access authentication** is a method for an HTTP user agent to provide a user name and password when making a request.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe reword this to say its one type of auth we use - we also utilize JWTs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment thread docs/security/basic-auth.md Outdated
Below is a code sample from HarperDB Studio. On Line 14 you will see where we are adding the authorization header to each request. Again this needs to be added for each and every REST request for HarperDB.

```bash
function callHarperDB(call_object,operation, callback){

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we should update this code to something more modern? async/await... not use var etc

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, whole page needs a rewrite. turning to draft

Comment thread docs/security/basic-auth.md Outdated



## Using HarperDB Studio

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im confused by this part, why is HarperDB Studio under basic auth?

Comment thread docs/security/configuration.md Outdated

1) Open the HarperDB harperdb.config file this can be found in /HDB_ROOT, the location you specified during install.

2) In harperdb.config there should be 2 entries under `operationsApi.network`: cors and corsWhitelist.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

White list has been update to access list

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This applies to all corsWhitelist ref

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment thread docs/security/configuration.md Outdated



HarperDB automatically generates a certificate and a privateKey file which live at `HDB_ROOT/keys/`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dont use HDB_ROOT anymore, maybe use <ROOTPATH>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment thread docs/security/jwt-auth.md Outdated
@@ -0,0 +1,96 @@
# JWT Authentication

HarperDB introduced Token based authentication in version 2.3.0 with JWTs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we need this line anymore

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment thread docs/security/jwt-auth.md Outdated

## Token Expiration

`operation_token` expires at a set interval. Once it expires it will no longer be accepted by HarperDB. This duration defaults to one day, and is configurable in [harperdb.conf](https://harperdb.io/docs/reference/configuration-file/). To generate a new `operation_token`, the `refresh_operation_token` operation is used, passing the `refresh_token` in the Bearer Token Authorization Header. A full cURL example can be seen here:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config file is now harperdb-config.yaml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment thread docs/security/jwt-auth.md Outdated
}
```

The `refresh_token` also expires at a set interval, but a longer interval. Once it expires it will no longer be accepted by HarperDB. This duration defaults to thirty days, and is configurable in [harperdb.conf](https://harperdb.io/docs/reference/configuration-file/). To generate a new `operation_token` and a new `refresh_token` the `create_authentication_tokensoperation` is called.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update config file name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment thread docs/security/jwt-auth.md Outdated

Token timeouts are configurable in [harperdb.conf](https://harperdb.io/docs/reference/configuration-file/) with the following parameters:

* `OPERATION_TOKEN_TIMEOUT`: Defines the length of time until the operation_token expires (default 1d).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these params are from old config

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty
✔️

Comment thread docs/security/users-and-roles.md Outdated
@@ -0,0 +1,282 @@
# Users & Roles

*Role Permissions documentation below for HarperDB version 2.2.0 and above.*

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think you need this line, we are way past 2.2.0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment thread docs/security/basic-auth.md Outdated
@@ -0,0 +1,64 @@
# Authentication

HarperDB utilizes Basic Auth to secure our REST requests. In the context of an HTTP transaction, **basic access authentication** is a method for an HTTP user agent to provide a user name and password when making a request.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"our REST requests" -> "our HTTP requests"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment thread docs/security/basic-auth.md Outdated



A header is added to each REST request. The header key is **“Authorization”** the header value is **“Basic <<your username and password buffer token>>”**

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"each REST request" -> "each HTTP request"
Same with rest of the doc, won't tag each one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment thread docs/security/basic-auth.md Outdated

## Using HarperDB Studio

Below is a code sample from HarperDB Studio. On Line 14 you will see where we are adding the authorization header to each request. Again this needs to be added for each and every REST request for HarperDB.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we literally just include line 14? Also, that line is node specific. The appropriate cross-platform code for the header is (that should work in browsers):
{ Authorization: "Basic " + btoa(username + ':' + password) }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see using the whole function for context (simplified and modernized); I can also see using a cross-platform approach and just using line 14. This whole page needs to be rewritten; I wasn't aware of that until after I sent this PR. With the rewrite, I will solve this issue.

Comment thread docs/security/configuration.md Outdated

## CORS

HarperDB allows for managing [cross-origin HTTP requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS). By default, HarperDB enables CORS for all domains if you need to disable CORS completely or set up whitelisted domains you can do the following:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"set up whitelisted domains" -> "set up an access list of domains"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment thread docs/security/configuration.md Outdated



These default ports can be changed by updating the `operationsApi.network.port` value in `HDB_ROOT/harperdb.config`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HDB_ROOT/harperdb.config -> HDB_ROOT/harperdb-config.yaml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the root var here also

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment thread docs/security/configuration.md Outdated



By default, HTTPS is turned off and HTTP is turned on.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default, HTTPS is turned off and HTTP is turned on. However, it is recommended that you never directly expose HarperDB's HTTP interface through a publicly available port. HTTP is intended for local or private network use.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment thread docs/security/index.md Outdated
@@ -1 +1,9 @@
# Security

HarperDB uses role-based, attribute-level security to ensure that users can only gain access to the data they’re supposed to be able to access. Our granular permissions allow for unparalleled flexibility and control, and can actually lower the Total Cost of Ownership compared to other database solutions, since you no longer have to replicate subsets of your data to isolate use cases.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the effort to emphasize TCO, but total cost of ownership really isn't a proper noun, I don't think (shouldn't be capitalized).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment thread docs/security/users-and-roles.md Outdated



**Database Manipulation**: A role defines CRUD permissions against database resources (i.e. data) in a HarperDB instance.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably define acronym on first use: "create, read, update, and delete (CRUD)"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment thread docs/security/users-and-roles.md Outdated

* `role` name used to easily identify the role assigned to individual users.

*Important: starting with 3.0, roles are assigned to users and altered/dropped based on the role name used in and returned from a successful `add_role` , `alter_role`, or `list_roles` operation.*

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How far back do we have to mention "starting with"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

Comment thread docs/security/users-and-roles.md Outdated

Example JSON for `add_role` request

```bash

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably json, not bash.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

@terraHDB
terraHDB marked this pull request as draft October 20, 2022 15:54
terraHDB and others added 4 commits October 28, 2022 15:31
* added mac, added/updated windows, added/updated node version requirements, and added offline docs

* go requirements

* docs adjustments

* testing variable usage

* testing variable usage

* Update other.md

Update installation for other operating systems.

* added link to download

* node version

* exact replica download button

* functional download link

* deleted old link

* node version

Co-authored-by: Kris Zyp <kriszyp@gmail.com>
* added mac, added/updated windows, added/updated node version requirements, and added offline docs

* 1/3 through studio subtopics

* 2/3 through studio subtopics

* 3/3 through studio subtopics

* corrected harperdb operations api

* removed icon descriptions and fixed typos

* removed icon descriptions

* primary key vs hash_attribute change

* primary key vs hash attribute qualifier
@terraHDB
terraHDB marked this pull request as ready for review November 14, 2022 22:53
@DavidCockerill
DavidCockerill merged commit 81c7630 into main Nov 15, 2022
DavidCockerill pushed a commit that referenced this pull request Nov 29, 2022
* testing variable syntax

* testing variable syntax

* testing variable syntax

* testing variable syntax

* testing variable syntax

* testing variable syntax

* testing variable syntax

* testing variable syntax

* testing variable syntax

* testing variable syntax

* testing variable syntax

* testing variable syntax

* testing variable syntax

* testing variable syntax

* testing variable syntax

* testing variable syntax

* reverted changes from variable testing

* added diagrams and clustering docs

* more formatting

* formatted the rest of clustering docs

* Core 1828 Docs Migration- Security: Topic and Subtopics (#4)

* doc migration epic branch

* 3/4 progress of security

* finished configuration.md, began users and roles

* users and roles migrated; still needs updates

* updated user and roles operations

* corrections to security docs

* CORE-1825 Add/Update "install harpedb" subtopics (#1)

* added mac, added/updated windows, added/updated node version requirements, and added offline docs

* go requirements

* docs adjustments

* testing variable usage

* testing variable usage

* Update other.md

Update installation for other operating systems.

* added link to download

* node version

* exact replica download button

* functional download link

* deleted old link

* node version

Co-authored-by: Kris Zyp <kriszyp@gmail.com>

* Core 1826 add/update harperdb studio topic and subtopics (#2)

* added mac, added/updated windows, added/updated node version requirements, and added offline docs

* 1/3 through studio subtopics

* 2/3 through studio subtopics

* 3/3 through studio subtopics

* corrected harperdb operations api

* removed icon descriptions and fixed typos

* removed icon descriptions

* primary key vs hash_attribute change

* primary key vs hash attribute qualifier

* minor change to example function

Co-authored-by: Kris Zyp <kriszyp@gmail.com>

* added more context to clustering intro page; adjusted subscription behavior description

Co-authored-by: Kris Zyp <kriszyp@gmail.com>
@Ethan-Arrowood
Ethan-Arrowood deleted the CORE-1828 branch August 12, 2025 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants