A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
docs: tighten the startup-URL token note (#11333)
Dylan Madisettib594af4a6bae
diff --git a/docs/guides/deploying/authentication.md b/docs/guides/deploying/authentication.mdindex 451aa9cb52..031257d111 100644--- a/docs/guides/deploying/authentication.md+++ b/docs/guides/deploying/authentication.md@@ -4,12 +4,19 @@ marimo provides a simple way to add token/password protection to your marimo ser## Enabling Basic Authentication-Authentication is enabled by default when running `marimo edit/tutorial/new`. To disable authentication, you may pass `--no-token` to your `marimo edit/run/new` command from the Terminal. The auth token will be randomly generated when in `Edit mode` and deterministically generated in `Run mode` (based on the code of the notebook). However, you can also pass your own token/password using the `--token-password` flag.+Authentication is enabled by default when running `marimo edit/tutorial/new`. To disable authentication, you may pass `--no-token` to your `marimo edit/run/new` command from the Terminal. The auth token will be randomly generated when in `Edit mode` and deterministically generated in `Run mode` (based on the code of the notebook). However, you can also pass your own token/password using the `--token-password` flag, or `--token-password-file` to read it from a file or stdin.```bashmarimo run my_notebook.py --token --token-password="sup3rs3cr3t"```+!!! warning "The startup URL includes the token"+ marimo prints a clickable URL at startup, such as `http://localhost:2718?access_token=sup3rs3cr3t`. The URL includes the token whether marimo generates it, you pass it with `--token-password`, or you read it from a file or stdin with `--token-password-file`. If marimo runs as a service, the journal or container log records that line. Pass `-q` (`--quiet`) before the subcommand to suppress the startup banner:++ ```bash+ marimo -q run my_notebook.py --token --token-password-file /run/secrets/marimo-token+ ```+### Ways to AuthenticateIn order to authenticate, you must either pass the token as a password in the `Authorization` header, or as a query parameter under `access_token` in the URL.diff --git a/marimo/_cli/cli.py b/marimo/_cli/cli.pyindex 52cf914ff8..f6fb3fa3a5 100644--- a/marimo/_cli/cli.py+++ b/marimo/_cli/cli.py@@ -146,6 +146,13 @@ token_password_message = ("Use a specific token for authentication. ""This enables session-based authentication. ""A random token will be generated if not set. "+ "Pass -q before to this flag to suppress the "+ "connection message and keep the token out of logs. "+)++token_password_file_message = (+ "Path to file containing token password, or '-' for stdin. "+ "Mutually exclusive with --token-password. ")sandbox_message = (@@ -327,7 +334,7 @@ class _OptionalValueOption(click.Option):"--token-password-file",default=None,type=str,- help="Path to file containing token password, or '-' for stdin. Mutually exclusive with --token-password.",+ help=token_password_file_message,)@click.option("--base-url",@@ -704,7 +711,7 @@ new_help_msg = "\n".join("--token-password-file",default=None,type=str,- help="Path to file containing token password, or '-' for stdin. Mutually exclusive with --token-password.",+ help=token_password_file_message,)@click.option("--base-url",@@ -1023,7 +1030,7 @@ Example:"--token-password-file",default=None,type=str,- help="Path to file containing token password, or '-' for stdin. Mutually exclusive with --token-password.",+ help=token_password_file_message,)@click.option("--include-code",@@ -1375,7 +1382,7 @@ Recommended sequence:"--token-password-file",default=None,type=str,- help="Path to file containing token password, or '-' for stdin. Mutually exclusive with --token-password.",+ help=token_password_file_message,)@click.option("--skew-protection/--no-skew-protection",