[ERROR]:Unable to set value to keychain Error Domain=com.samsoffes.sskeychain Code=-50 "errSecParam" UserInfo={NSLocalizedDescription=errSecParam} - appcelerator-titanium

I am using appcelerator titanium and bencoding. What could be the error with the following code? Error attached below
var securely = require('bencoding.securely');
var SecureProperties = securely.createProperties({
secret : "hidden_dont_tell",
identifier : "myPropertyIdentifier",
vi : "$H#Crit1c4L",
storageType:securely.PROPERTY_TYPE_KEYCHAIN ,
securityLevel : securely.PROPERTY_SECURE_LEVEL_HIGH
});
SecureProperties.setString('String', "p4$$M0RD");
[ERROR]:Unable to set value to keychain Error
Domain=com.samsoffes.sskeychain Code=-50 "errSecParam"
UserInfo={NSLocalizedDescription=errSecParam}

Use storage type as
PROPERTY_TYPE_PREFERENCES
instead

Related

Label ID was not found in the policy error in MIP SDK (C++)

I am implementing a MIP Server to apply labels to pdf files. I have created a setLabel function that gets the label from the portal and applies it to the file. The following code snippet explains my implementation.
MayBeValue<void*> MipProfile::SetLabel(const CommonParams& p,
const std::string& sourcePath,
const std::string& destPath,
const std::string& labelId,
bool isDryRun,
const LabelOptions& options) {
try {
auto engineId = getEngineId(p.ctx, p.tenantId, p.clientId, p.accountId, "");
if (engineId.getStatus() != STATUS_SUCCESS) {
return MayBeValue<void*>(STATUS_FAILED, "failed to get/create file engine");
}
auto authDelegateImpl = make_shared<AuthDelegateImpl>(p.clientId);
authDelegateImpl->SetTenant(p.tenantId);
authDelegateImpl->SetAccount(p.accountId);
LOG_INFO(p.ctx, "engine uuid : ", engineId.getValue());
FileEngine::Settings engineSettings(
engineId.getValue(), // pass engine Id if its available
authDelegateImpl, // auth token provider class
"<engine-state>", // User-defined engine state, not used
"en-US");
// Set up promise/future connection for async engine operations; add engine
// to profile asynchronously
auto enginePromise = make_shared<promise<shared_ptr<FileEngine>>>();
auto engineFuture = enginePromise->get_future();
// will load or add the engine
mProfile->AddEngineAsync(engineSettings, enginePromise);
// get the engine object and query labels
auto engine = engineFuture.get();
auto newLabel = engine->GetLabelById(labelId);
If I start the server and try to apply the label from the list of labels in the Microsoft Purview portal, it works as expected (the label is being applied to the file).
The problem occurs when I create a new label, add it to the policy and then try to add that label to the file, I get the following error.
{"level" : "ERROR", "caller" : "cmake/build/CMakeFiles/main.dir/compiler_depend.ts:328", "msg" : "An exception occurred... while labeling file : label ID was not found in the policy: 290c79ef-5dff-4617-8281-232e425cc557, BadInputError.Code=General, CorrelationId=4a7be23d-53a1-4e28-a775-093154b74d6c, CorrelationId.Description=PolicyEngine"
I have set the cache type as mip::CacheStorageType::InMemory as its a long-running process. I need to figure out how can I fetch the latest labels in the already-running policy engine. I am using MIP SDK version 1.12.101 macOS M1.

Error: VM Exception while processing transaction: out of gas, set mapping key value error

The contract function is
function _removeFlag(address sender) internal {
//remove if in record
if (mapping1[sender] > 0) {
mapping1[sender] = 0;
}
}
when my test case running into this function , show an error like:
truffle>: truffle test
Error: Returned error: VM Exception while processing transaction: out of gas
If I set it with mapping1[sender] = 1; the error disappears.
Version information:
  Truffle v5.4.0 (core: 5.4.0)
  Solidity v0.5.16 (solc-js)
  Node v16.4.2
  Web3.js v1.4.0
First check your account balance : balance = web3.eth.getBalance(someAddress); then try to specify the gaslimit contractInstance.createProposal("ADHD", "Foo", 2, {from: web3.eth.accounts[1], gas:3000000})

Python MongoDB ReferenceError: weakly-referenced object no longer exists

I am an error ReferenceError: weakly-referenced object no longer exists in my code, I have tried to debug it that I don't know why am I getting this.
I am using mongodb and python 3.6.10
here is my code, please help
a = 't1'
b = ['v1', 'v2', 'v3']
services = dict()
for value in b:
record = MyModel.objects.filter(myid=id, a=a, value=value).first()
keys = record['services'].keys()
for key in keys:
key_value = record['services'][key]
if key in services:
services[key].extend(key_value) # Getiing error here in this line
else:
services.update({key: key_value})
print(services)
MyModel looks like
{
"myid" : "1",
"a" : "t1",
"b" : "v1",
"services" : {
"service_1" : [
{
"serviceid" : "1012",
"service_type" : "service_1"
}
]
}
{
"myid" : "1",
"a" : "t1",
"b" : "v2",
"services" : {
"service_2" : [
{
"serviceid" : "1013",
"service_type" : "service_2"
}
]
}
code works fine if there is only one value in b, but if code iterate the second time and tries to perform services[key].extend(key_value), code generates the error.
I don't think it is related to this code phrase. It can be caused by your db connector. You may try to close the connection without closing the cursor.
It generally happens when you use a destructor __del__ for a weak referenced object. When your destructor runs before the garbage collector, it throws that kind of exception. You can read more about weakref here.
after a lot of try and error, I have found that if I put values in empty list then code works fine so I have updated my code. I am still don't know why the above code is giving me an error, this is just an alternative to the above code.
Hope this will help someone facing the same problem.
a = 't1'
b = ['v1', 'v2', 'v3']
services = dict()
for value in b:
record = MyModel.objects.filter(myid=id, a=a, value=value).first()
keys = record['services'].keys()
for key in keys:
key_value = record['services'][key]
if not key in services:
services[key] = list()
services[key].extend(key_value)
print(services)

AWS Device Farm CreateDevicePool internal error

I am trying to create device pool for a project using AWS DeviceFarm sdk in C#. I use the following command:
var createDevicePoolResponse = client.CreateDevicePool (new CreateDevicePoolRequest {
Name = "CustomDevicePool",
ProjectArn = projectArn,
Rules = new List<Rule> {
new Rule {
Attribute = DeviceAttribute.ARN,
Operator = RuleOperator.EQUALS_TO,
Value = "arn:aws:devicefarm:us-west-2::device:577DC08D6B964346B86610CFF090CD59"
}
}
});
It thinks for about a minute then I receive the following exception:
Error making request with Error Code InternalFailure and Http Status
Code InternalServerError. No further error information was returned by
the service.
ProjectArn is valid. I also tried different rules and get the same error every time.
Figured it out. Value needs to be surrounded with square brackets like so
var createDevicePoolResponse = client.CreateDevicePool (new CreateDevicePoolRequest {
Name = "CustomDevicePool",
ProjectArn = projectArn,
Rules = new List<Rule> {
new Rule {
Attribute = DeviceAttribute.ARN,
Operator = RuleOperator.IN,
Value = "[\"arn:aws:devicefarm:us-west-2::device:D45C750161314335924CE0B9B7D2558E\"]"
}
}
});

What Causes DynamoDB UpdateItem to Giv Fatal Error in Swift?

I am using Swift to let my app update an item on DynamoDB. I followed the example https://github.com/aws/aws-sdk-ios/blob/master/AWSiOSSDKTests/AWSDynamoDBTests.m#L244, the "- (void)testUpdateItem" method. My codes are as follows:
var dynamoDB = AWSDynamoDB()
var hashValue: AWSDynamoDBAttributeValue = AWSDynamoDBAttributeValue()
hashValue.S = userID
var updatedValue: AWSDynamoDBAttributeValue = AWSDynamoDBAttributeValue()
updatedValue.S = updatedContent
var updateInput: AWSDynamoDBUpdateItemInput = AWSDynamoDBUpdateItemInput()
updateInput.tableName = kAWSDynamoDBMoEndpointARNTableName
updateInput.key = ["UserID": hashValue]
var valueUpdate: AWSDynamoDBAttributeValueUpdate = AWSDynamoDBAttributeValueUpdate()
valueUpdate.value = updatedValue
valueUpdate.action = AWSDynamoDBAttributeAction.Put
updateInput.attributeUpdates = ["Updated": valueUpdate]
updateInput.returnValues = AWSDynamoDBReturnValue.UpdatedNew
dynamoDB.updateItem(updateInput).waitUntilFinished()
However, as I run the codes, it always returns fatal error: unexpectedly found nil while unwrapping an Optional value. Looking into the error, I can find it is from Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.Uint) -> () with Thread 1: EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xe7ffdefe)
I didn't use .continueWithBlock or .continueWithSuccessBlock cuz neither helps to catch the error.
Any idea why? THANKS
You need to get an instance of AWSDynamoDB as follows:
let dynamoDB = AWSDynamoDB.defaultDynamoDB()
You are using the default - init method without any parameter, and it causes AWSDynamoDB instance to have no AWSServiceConfiguration.
With the current AWS, found that this worked well for posting the updateItem in Swift.
dynamoDB.updateItem(updateInput) .continueWithExecutor(AWSExecutor.mainThreadExecutor(), withBlock: { (task:AWSTask!) -> AnyObject! in
if (task.error == nil) {
log.debug("task.error == nil")
}
return nil
})
// instead of
dynamoDB.updateItem(updateInput).waitUntilFinished()