webapps-secrets - Manage web app server secrets on Windows, Linux, and macOS systems - MATLAB (original) (raw)

Manage web app server secrets on Windows, Linux, and macOS systems

Since R2024a

Syntax

Description

webapps-secrets set [keyName](#mw%5F67170861-dfa0-4fd5-a78f-be8bc53e31f9) [keyValue](#mw%5Ff389274a-d9f9-403f-a4ab-160677ce2e3f) [--mode Overwrite|FailIfExists] assigns the value keyValue to the secret keyName and adds the key to the vault. Optionally, you can configure whether to overwritekeyName or abort if the key already exists.

example

webapps-secrets remove [keyName](#mw%5F67170861-dfa0-4fd5-a78f-be8bc53e31f9) [keyValue](#mw%5Ff389274a-d9f9-403f-a4ab-160677ce2e3f) [--scope [scopeValue](#mw%5Fdfb3417a-baf0-4035-a4b3-21ddb50ee7a4)] removes the secret keyName from the vault.

example

webapps-secrets set-attributes --secret-key [keyName](#mw%5F67170861-dfa0-4fd5-a78f-be8bc53e31f9) [[attrName](#mw%5Fd70f9d93-a477-46b5-93bf-4d9cbd89cd88) [attrValue](#mw%5F8eb05d9c-4396-454a-89dd-d2deafa80f81)] [--scope [scopeValue](#mw%5Fdfb3417a-baf0-4035-a4b3-21ddb50ee7a4)] [--mode Add|Merge|Replace] sets the attributes of the secret keyName. Optionally, you can configure whether to add new attributes to the key, merge the new and existing attributes, or replace all existing attributes with new ones.

example

webapps-secrets get-attributes --secret-key [keyName](#mw%5F67170861-dfa0-4fd5-a78f-be8bc53e31f9) [--scope [scopeValue](#mw%5Fdfb3417a-baf0-4035-a4b3-21ddb50ee7a4)] returns the attributes of the secret with name keyName.

example

webapps-secrets list [--scope [scopeValue](#mw%5Fdfb3417a-baf0-4035-a4b3-21ddb50ee7a4)] lists all currently configured secret keys in the scopescopeValue.

example

webapps-secrets listAll lists all currently configured secret keys in all scopes.

example

webapps-secrets --help displays help text for the command.

example

webapps-secrets --version displays version information for the command.

example

Examples

Set Value for Specific Secret Key

To set a value for a specific secret key, at the system command line, type:

webapps-secrets set mypassword hunter2

Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml MATLAB Web App Server secrets configuration has been updated.

Verify that the secret has been added.

Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml List of secret keys configured: scope:, secret key:mypassword

Remove Secret from Server

To remove the existing secret key mypassword from the server, at the system command line, type:

webapps-secrets remove mypassword

Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml MATLAB Web App Server secrets configuration has been updated.

Set Attributes for Secret Key

An attribute is unencrypted metadata that is stored along with the secret key and encrypted value in the webapps_secrets XML file.

To set a value for the secret key myusername, at the system command line, type:

webapps-secrets set myusername mluser

Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml MATLAB Web App Server secrets configuration has been updated.

To set attributes of the secret key myusername, at the system command line, type:

webapps-secrets set-attributes --secret-key myusername hostname myhost port 8080

Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml MATLAB Web App Server secrets configuration has been updated.

You can modify existing attributes of a secret key using the --mode operator.

webapps-secrets set-attributes --secret-key myusername port 422 --mode Merge

Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml MATLAB Web App Server secrets configuration has been updated.

Get Attributes for Secret Key

To retrieve the attributes for the secret keymyusername, at the system command line, type:

webapps-secrets get-attributes --secret-key myusername

Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml List of secret keys configured: hostname --->myhost port --->422

List Secrets by Scope

To set a secret with a specific scope, at the system command line, type:

webapps-secrets set mysecret2 97e846a4-a913-4a26 --scope $UserID

Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml MATLAB Web App Server secrets configuration has been updated.

To list all currently configured secret keys with the scope $UserID, at the system command line, type:

webapps-secrets list --scope $UserID

Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml List of secret keys configured: scope:$UserID, secret key:mysecret2

List All Secrets

To list all currently configured secret keys, at the system command line, type:

Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml List of secret keys configured: scope:, secret key:myusername scope:$UserID, secret key:mysecret2

Display Help Text

To print the webapps-secrets help text, at the system command line, type:

Usage: webapps-secrets [--help | -h] Display this help message webapps-secrets [--version | -v] Display the version of MATLAB Web App Server webapps-secrets list [--scope ] List currently configured secret keys webapps-secrets listAll List all currently configured secret keys in all scopes webapps-secrets set [--scope ] [--mode Overwrite|FailIfExists] Set a secret to MATLAB Web App Server webapps-secrets remove [--scope ] Remove a secret key from MATLAB Web App Server webapps-secrets set-attributes --secret-key [ ] [--scope ] [--mode Add|Merge|Replace]
Set attributes of a secret to MATLAB Web App Server webapps-secrets get-attributes --secret-key [--scope ] Get attributes of a secret from MATLAB Web App Server

Display Version

To print the MATLAB® Web App Server™ version information, at the system command line, type:

MATLAB Web App Server (R2025a)

Input Arguments

collapse all

Secret key name to identify the secret, specified as a unique string. If the name contains spaces, keyName must be surrounded by double quotes (").

Wildcards (*) are supported at the end of the secret name. For example, "myapp1.*".

Example: "my password"

Secret key value, specified as a string. The value is encrypted and stored in theMATLAB Web App Server vault. You can retrieve the value from a web app using the getSecret (MATLAB) function.

If the value contains spaces, keyValue must be surrounded by double quotes (").

Example: "AdL3DS2$CyMEgCQQCo9+BpMoYQJxRF+j6ctTi3"

Scope value, specified as any static string or a string with macros. The scope can specify users, groups, or specific web apps to allow access to the designated secret.

The following macros are supported:

If a secret has a scope other than the default, you must specify the scope value using the --scope argument when callingset-attributes, get-attributes,list, or remove.

Example: "$AppName.$UserID"

Attribute name, specified as a string. An attribute is unencrypted metadata that is stored along with the secret key name and encrypted value in thewebapps_secrets XML file. The attribute name describes the associated attribute value, specified by attrValue.

Example: port

Attribute value, specified as a string. An attribute is unencrypted metadata that is stored along with the secret key name and encrypted value in thewebapps_secrets XML file. The attribute value is described by the associated attrName.

Example: 8080

More About

collapse all

The command-line scripts are located in the script folder in yourMATLAB Web App Server installation folder. For instance, the default locations for R2025a are as follows:

Operating System Default Location of Command-Line Scripts
Windows® (Administrator) C:\Program Files\MATLAB\MATLAB Web App Server\R2025a\script
Linux® (sudo) /usr/local/MATLAB/MATLAB_Web_App_Server/R2025a/script
macOS (Intel® processor) (sudo) /Applications/MATLAB/MATLAB_Web_App_Server/R2025a/script

Version History

Introduced in R2024a