Skip to content

Aerobridge Guardian (Version 0.2)#12

Open
1AwesomeDeveloper wants to merge 10 commits into
openutm-labs:aerobridge-guardianfrom
1AwesomeDeveloper:npnt
Open

Aerobridge Guardian (Version 0.2)#12
1AwesomeDeveloper wants to merge 10 commits into
openutm-labs:aerobridge-guardianfrom
1AwesomeDeveloper:npnt

Conversation

@1AwesomeDeveloper

Copy link
Copy Markdown
Collaborator

Features Implemented

  1. Upload Plan File ( KML ) to Management Server
  2. Create Operation Functionality
  3. Select and Load Plan Functionality
  4. Ask Management Server for Flight Permission
  5. Verify the signature (JWT Verification)

image

@not-vibhu

Copy link
Copy Markdown

Is it possible to add OpenSSL as an external submodule? from here ?

@botmayank botmayank left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1AwesomeDeveloper quite a lot of really nice work, have a look to see if the comments make sense.

@hrishiballal @not-vibhu @rhythmize

@@ -4,18 +4,14 @@
#include <QObject>
#include "QGCApplication.h"

///This class establishes a connection to the authentication server. If connection is succesful, it emits signal for the UI

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1AwesomeDeveloper do you want to leave at least one basic top level comment for the header?

Comment thread modifications/DataClass.cc Outdated
}

//API CALLS START
//*******************************************************************************************************************************************************************************

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems unnecessary to have API calls start and this comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Comment thread modifications/DataClass.cc Outdated
}
}

//*******************************************************************************************************************************************************************************

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this too I think

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread modifications/DataClass.cc Outdated
emit tokenNotGenerated();
showMessage("Unable to Connect to Server", statusCode);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor but connect and server need not be in capital, also if 201 and 200 checks are to be performed elsewhere, might be nice to have them as a #define/enum on top. Would help avoid having magic numbers in the code even though these are well known status codes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, error codes are already an enum, no need to define in a separate header file because all API calls are made using dataClass

Comment thread modifications/DataClass.cc Outdated
}
}

//*******************************************************************************************************************************************************************************

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this too I think

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread modifications/NpntProcess.qml Outdated
Column{
CheckBox {
id: c1
checked:myrect.hardwareConnected
text: qsTr("Hardware Connected")
text: qsTr("Connecting to the Flight Controller")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Connecting or connected?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both are fine, the status is represented by a checkbox. The text was given by @not-vibhu.
Currently changing it to "connected". Can be reverted if needed

EVP_PKEY * pRsaKey = EVP_PKEY_new();
RSA_set0_key(rr, modul, expon , kids);
EVP_PKEY_assign_RSA(pRsaKey, rr);
unsigned char * ss = new unsigned char[1024];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any way of doing this without new delete and using a unique_ptr?

@rhythmize

@rhythmize rhythmize Mar 19, 2022

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A follow up question: Why are we writing this SignatureVerifier::convertJwkToPem conversion ourselves and not using jwt-cpp approach since we're already using jwt-cpp?
Example: https://github.com/Thalhammer/jwt-cpp/blob/master/example/jwks-verify.cpp
Reference code: https://github.com/Thalhammer/jwt-cpp/blob/142d2d38e7bb1ad17b9787d776589e719d7494cb/include/jwt-cpp/jwt.h#L462

Comment thread modifications/SignatureVerifier.cc Outdated
{
std::error_code c;
try {
auto verify = jwt::verify().allow_algorithm(jwt::algorithm::rs256(strPubKey)).with_issuer("https://id.openskies.sh/");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this URL not coming from the globals dict?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

QStringList PlanMasterController::getAllPlans() const
{
QStringList allPlans = qgcApp()->getDataClass()->getAllPlans();
allPlans.push_front("No Plan Selected");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general in your logs, avoid unnecessary capitalization of common words. Like this one should be "No plan selected"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -155,5 +186,7 @@ private slots:
QmlObjectListModel* _planCreators = nullptr;
DataClass* _dataClass;
QString m_url;
int m_planIndex = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How many plans are we going to be holding? Sure int is enough right?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might make sense to have a larger data type if you need, or even with int, have a max bound for how many plans one is allowed to create/keep, and have a check to either delete older plans or overwrite in a circular fashion or alteast alert the operator.

@hrishiballal @rhythmize

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to atleast make it unsigned int. It'll double the current limit and then we can have some checks to prevent any rollovers.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to unsigned long long int

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants