Skip to content

Commit

Permalink
Merge pull request #1 from yardexx/release/v0.0.1-dev.1
Browse files Browse the repository at this point in the history
release/v0.0.1-dev.1
  • Loading branch information
yardexx authored Oct 15, 2022
2 parents 9ffdfbe + 8fe22cc commit 8dbfd87
Show file tree
Hide file tree
Showing 17 changed files with 351 additions and 28 deletions.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug Report
about: Create a report to help us improve
title: "fix: "
labels: bug
---

**Description**

A clear and concise description of what the bug is.

**Steps To Reproduce**

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected Behavior**

A clear and concise description of what you expected to happen.

**Screenshots**

If applicable, add screenshots to help explain your problem.

**Additional Context**

Add any other context about the problem here.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/chore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Chore
about: Other changes that don't modify src or test files
title: "chore: "
labels: chore
---

**Description**

Clearly describe what change is needed and why. If this changes code then please use another issue type.

**Requirements**

- [ ] No functional changes to the code
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Documentation
about: Improve the documentation so all collaborators have a common understanding
title: "docs: "
labels: documentation
---

**Description**

Clearly describe what documentation you are looking to add or improve.

**Requirements**

- [ ] Requirements go here
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Feature Request
about: A new feature to be added to the project
title: "feat: "
labels: feature
---

**Description**

Clearly describe what you are looking to add. The more context the better.

**Requirements**

- [ ] Checklist of requirements to be fulfilled

**Additional Context**

Add any other context or screenshots about the feature request go here.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/refactor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Refactor
about: A code change that neither fixes a bug nor adds a feature
title: "refactor: "
labels: refactor
---

**Description**

Clearly describe what needs to be refactored and why. Please provide links to related issues (bugs or upcoming features) in order to help prioritize.

**Requirements**

- [ ] There is no drop in test coverage.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/revert.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Revert Commit
about: Reverts a previous commit
title: "revert: "
labels: revert
---

**Description**

Provide a link to a PR/Commit that you are looking to revert and why.

**Requirements**

- [ ] Change has been reverted
- [ ] No change in test coverage has happened
- [ ] A new ticket is created for any follow on work that needs to happen
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/style.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Style Changes
about: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
title: "style: "
labels: style
---

**Description**

Clearly describe what you are looking to change and why.

**Requirements**

- [ ] There is no drop in test coverage.
27 changes: 27 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--
Thanks for contributing!
Provide a description of your changes below and a general summary in the title
Please look at the following checklist to ensure that your PR can be accepted quickly:
-->

## Status

**READY/IN DEVELOPMENT/HOLD**

## Description

<!--- Describe your changes in detail -->

## Type of Change

<!--- Put an `x` in all the boxes that apply: -->

- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 🛠️ Bug fix (non-breaking change which fixes an issue)
- [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change)
- [ ] 🧹 Code refactor
- [ ] ✅ Build configuration change
- [ ] 📝 Documentation
- [ ] 🗑️ Chore
22 changes: 21 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
TODO: Add your license here.
MIT License

Copyright (c) 2022 Jaroslav Novotny

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
64 changes: 58 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,73 @@
# freerasp_brick

[![Powered by Mason](https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge)](https://github.com/felangel/mason)
<p align="center">
<a href="https://github.com/felangel/mason"><img src="https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge" alt="Powered by Mason"></a>
<a href="https://pub.dev/packages/freerasp"><img src="https://img.shields.io/badge/Supported%20freeRASP-%5E3.0.0-brightgreen" alt="Supported freeRASP"/></a>
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-purple.svg" alt="License: MIT"></a>
</p>

A new brick created with the Mason CLI.
<p align="center">
A brick to automate configuration of freeRASP <a href="https://pub.dev/packages/freerasp">freeRASP</a>.
</p>

_Generated by [mason][1] 🧱_
> 🚧 This brick experimental and not stable! Changes to API reserved. 🚧
## Getting Started 🚀
## Overview
Setting up freeRASP can be quite tedious and repetitive. freerasp_brick provides you error-prone
way to create configuration.

This is a starting point for a new brick.
A few resources to get you started if this is your first brick template:
## Features 🧰
- 🛠 Configuration generation
- 🎯 Dependency check using `pub get`
- 🔧 Fix apply using `dart fix`

## How to use 🚀

Generate configuration:
```
mason make freerasp_brick
```

Import it and call `start()`:
```dart
import 'freerasp/freerasp.g.dart';
talsec.start();
```

You can edit `freerasp_callback.g.dart` to provide own reactions or made your own `TalsecCallback`
and provide it in `freerasp.g.dart`;

## Variables 📦
| Variable | Description | Default | Type | Conditional | When |
|--------------|-------------------------------|-----------------|--------|-------------|-----------------|
| watcher_mail | An email for security reports | N/A | String | false | N/A |
| android | Add Android configuration | true | bool | false | N/A |
| package_name | Android app package name | com.example.app | String | true | android == true |
| signing_hash | Android app signing hash | N/A | String | true | android == true |
| ios | Add iOS configuration | true | bool | false | N/A |
| bundle_id | iOS app id | com.example.app | String | true | ios == true |
| team_id | iOS team id | N/A | String | true | ios == true |

## Hooks 🎣
| Type | Enabled | Can be disabled |
|----------|---------|-----------------|
| pre-gen |||
| post-gen |||

## Getting started with [mason][1] 🧱

If this is your first touch with mason, please refer to resources to get started:

- [Mason on pub.dev][1]
- [Official Mason Documentation][2]
- [Code generation with Mason Blog][3]
- [Very Good Livestream: Felix Angelov Demos Mason][4]

[1]: https://github.com/felangel/mason

[2]: https://github.com/felangel/mason/tree/master/packages/mason_cli#readme

[3]: https://verygood.ventures/blog/code-generation-with-mason

[4]: https://youtu.be/G4PTjA6tpTU
1 change: 0 additions & 1 deletion __brick__/HELLO.md

This file was deleted.

19 changes: 19 additions & 0 deletions __brick__/lib/freerasp/freerasp.g.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'package:freerasp/talsec_app.dart';
part 'freerasp_callback.g.dart';

TalsecConfig _config = TalsecConfig(
watcherMail: '{{watcher_mail}}',{{#android}}
androidConfig: AndroidConfig(
expectedPackageName: '{{package_name}}',
expectedSigningCertificateHash: '{{signing_hash}}',
),{{/android}}{{#ios}}
iosConfig: IOSconfig(
appBundleId: '{{bundle_id}}',
appTeamId: '{{team_id}}',
),{{/ios}}
);

TalsecApp talsec = TalsecApp(
config: _config,
callback: callback,
);
23 changes: 23 additions & 0 deletions __brick__/lib/freerasp/freerasp_callback.g.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
part of 'freerasp.g.dart';

final callback = TalsecCallback({{#android}}
androidCallback: AndroidCallback(
onRootDetected: () => print('root'),
onEmulatorDetected: () => print('emulator'),
onHookDetected: () => print('hook'),
onTamperDetected: () => print('tamper'),
onDeviceBindingDetected: () => print('device binding'),
onUntrustedInstallationDetected: () => print('untrusted install'),
), {{/android}} {{#ios}}
iosCallback: IOSCallback(
onSignatureDetected: () => print('signature'),
onRuntimeManipulationDetected: () => print('runtime manipulation'),
onJailbreakDetected: () => print('jailbreak'),
onPasscodeDetected: () => print('passcode'),
onSimulatorDetected: () => print('simulator'),
onMissingSecureEnclaveDetected: () => print('secure enclave'),
onDeviceChangeDetected: () => print('device change'),
onDeviceIdDetected: () => print('device ID'),
onUnofficialStoreDetected: () => print('unofficial store')), {{/ios}}
onDebuggerDetected: () => print('debugger'),
);
35 changes: 15 additions & 20 deletions brick.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
name: freerasp_brick
description: A new brick created with the Mason CLI.
description: A brick for configuration generation and automatic setup for freeRASP.

# The following defines the version and build number for your brick.
# A version number is three numbers separated by dots, like 1.2.34
# followed by an optional build number (separated by a +).
version: 0.1.0+1
version: 0.0.1-dev.1

# The following defines the environment for the current brick.
# It includes the version of mason that the brick requires.
environment:
mason: ">=0.1.0-dev.26 <0.1.0"

# Variables specify dynamic values that your brick depends on.
# Zero or more variables can be specified for a given brick.
# Each variable has:
# * a type (string, number, boolean, enum, or array)
# * an optional short description
# * an optional default value
# * an optional list of default values (array only)
# * an optional prompt phrase used when asking for the variable
# * a list of values (enums only)
vars:
name:
watcher_mail:
type: string
description: Your name
default: Dash
prompt: What is your name?
description: Watcher mail
prompt: An email for security reports
android:
type: boolean
description: Add Android configuration
prompt: Add Android configuration?
default: true
ios:
type: boolean
description: Add iOS configuration
prompt: Add iOS configuration?
default: true
29 changes: 29 additions & 0 deletions hooks/post_gen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'dart:io';

import 'package:mason/mason.dart';

const String androidBuild = 'build.gradle';
const String flutterBuild = 'lib';

void run(HookContext context) async {
final logger = context.logger;

await _runPub(logger);
await _runDartFix(logger);
}

Future<void> _runPub(Logger logger) async {
final progress = logger.progress('Running dart pub get');
final result = await Process.run('dart', ['pub', 'get']);
return result.exitCode == 0
? progress.complete('Pub get run successfully')
: progress.fail('Pub get failed. Please handle dependency manually.');
}

Future<void> _runDartFix(Logger logger) async {
final progress = logger.progress('Running dart fix --apply');
final result = await Process.run('dart', ['fix', '--apply']);
return result.exitCode == 0
? progress.complete('Fix applied.')
: progress.fail('Fix couldn\'t be applied');
}
Loading

0 comments on commit 8dbfd87

Please sign in to comment.