
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
dash-auto-save-state
Advanced tools
A Dash hook that automatically saves and restores component states to prevent data loss. Perfect for long forms, complex dashboards, and any application where users might accidentally lose their work.
pip install dash-auto-save-state
from dash import Dash, html, dcc, Input, Output, callback
from dash_auto_save_state import enable_auto_save
app = Dash(__name__)
# Enable auto-save for the entire app
enable_auto_save(app)
app.layout = html.Div([
html.H1("My Dashboard"),
dcc.Input(
id="user-name",
type="text",
placeholder="Enter your name..."
),
dcc.Textarea(
id="user-comments",
placeholder="Enter your comments...",
style={"width": "100%", "height": 100}
),
dcc.Dropdown(
id="user-country",
options=[
{"label": "USA", "value": "usa"},
{"label": "Canada", "value": "canada"},
{"label": "UK", "value": "uk"}
],
placeholder="Select your country"
),
html.Div(id="output")
])
@callback(
Output("output", "children"),
Input("user-name", "value"),
Input("user-comments", "value"),
Input("user-country", "value")
)
def update_output(name, comments, country):
return f"Name: {name}, Comments: {comments}, Country: {country}"
if __name__ == "__main__":
app.run(debug=True)
from dash import Dash, html, dcc
from dash_auto_save_state import auto_save_state_hook
app = Dash(__name__)
app.layout = html.Div([
# Add the auto-save hook to your layout
auto_save_state_hook(debug=True),
html.H1("My Dashboard"),
dcc.Input(id="my-input", type="text", placeholder="Type something..."),
html.Div(id="output")
])
from dash_auto_save_state import enable_auto_save
enable_auto_save(
app=app,
storage_key="my_app_state", # Custom localStorage key
save_interval=2000, # Save every 2 seconds
excluded_components=["password-field", "secret-token"], # Exclude sensitive fields
sync_across_tabs=True, # Sync between browser tabs
debug=True # Enable debug logging
)
from dash_auto_save_state import secure_auto_save_hook
app.layout = html.Div([
# Automatically excludes password fields and other sensitive components
secure_auto_save_hook(debug=True),
html.H1("Secure Form"),
dcc.Input(id="username", type="text"),
dcc.Input(id="password", type="password"), # Automatically excluded
dcc.Input(id="email", type="email"),
])
The plugin automatically excludes common sensitive field patterns:
password, pwd, passsecret, token, keycredit-card, ssn, social-securityYou can also manually specify additional excluded components:
enable_auto_save(
app,
excluded_components=[
"api-key-input",
"bank-account-field",
"personal-id-number"
]
)
The plugin automatically detects and saves state for:
dcc.Input (text, email, number, etc.)dcc.Textareadcc.Dropdown (single and multi-select)dcc.Checklistdcc.RadioItemsdcc.Slider, dcc.RangeSliderdcc.DatePickerSingle, dcc.DatePickerRangeenable_auto_save(app, **kwargs)Enable auto-save functionality for a Dash app.
Parameters:
app (dash.Dash, optional): The Dash app instancestorage_key (str): Key for localStorage (default: "dash_auto_save_state")save_interval (int): Debounce interval in milliseconds (default: 1000)excluded_components (list): Component IDs to exclude from auto-savesync_across_tabs (bool): Enable cross-tab synchronization (default: True)debug (bool): Enable debug logging (default: False)auto_save_state_hook(**kwargs)Hook function that returns auto-save components for manual layout inclusion.
secure_auto_save_hook(**kwargs)Security-focused hook that excludes sensitive components by default.
Run tests with:
pip install -e ".[test]"
pytest
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ for the Plotly community
FAQs
Automatically save and restore Dash component states to prevent data loss
We found that dash-auto-save-state demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.