Skip to content

Commit

Permalink
⚡ Added default security filters.
Browse files Browse the repository at this point in the history
  • Loading branch information
omegaui committed Jan 9, 2024
1 parent d2508ad commit acb0fb6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
20 changes: 20 additions & 0 deletions assets/exclusion-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"exclusions": [
{
"name": "GitHub Token",
"pattern": "^[a-zA-Z0-9]{40}$"
},
{
"name": "Gitlab Token",
"pattern": "^[a-zA-Z0-9_-]{20,}$"
},
{
"name": "Git HTTPS Url",
"pattern": "^https:\\/\\/([^:]+):([^@]+)@([^\\/]+)\\/(.+\/[^.]+)\\.git$"
},
{
"name": "SSH Key",
"pattern": "^ssh-rsa\\s+[A-Za-z0-9+/]+[=]{0,3}(\\s+[^\\s]+)?\\s*$"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class _SettingsInitializedStateViewState
active: widget.controller.settingsRepo.isForcingXClip(),
icon: AppIcons.clipboard,
enabled: Platform.environment['WAYLAND_DISPLAY'] != null,
disableCause: "You not using wayland display on your system",
disableCause: "Value of \$WAYLAND_DISPLAY is not set",
onChanged: (enabled) {
widget.controller.settingsRepo.setForceXClip(enabled);
setState(() {});
Expand Down Expand Up @@ -615,7 +615,7 @@ class _SettingsInitializedStateViewState
fallback: StorageValues.defaultAnimationEnabledKey),
),
Text(
"No content filter detected, looks like you also removed the default ones\nPlease not that any password or key you copy will be watched",
"No content filter detected, looks like you also removed the default ones\nPlease note that any password or key you copy will be watched",
textAlign: TextAlign.center,
style: AppTheme.fontSize(14).makeBold(),
),
Expand Down
11 changes: 11 additions & 0 deletions lib/core/storage/storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ class Storage {
['+x', commandExecutorScript.path],
);
}

// Writing Exclusion Config ...
final exclusionConfig = File(
combineHomePath(['.config', 'cliptopia', 'exclusion-config.json']));

if (!exclusionConfig.existsSync()) {
prettyLog(value: "Writing the default exclusion-config ...");
final contents =
await rootBundle.loadString('assets/exclusion-config.json');
exclusionConfig.writeAsStringSync(contents, flush: true);
}
}

static dynamic get(String key, {fallback}) {
Expand Down

0 comments on commit acb0fb6

Please sign in to comment.