Codemagic builds are not triggered from CodeCommit - amazon-sns

I was following the instructions provided by Codemagic to add a WebHook to CodeCommit. Which includes creating a topic, adding to it a subscription and then configuring Notify in repository.
Anyhow, after merging or changing my master directly no build is still triggered.
Here is my setup:
Webhook in Codemagic:
Topic with a subscription:
Notification rule targets:
What I did notice is that notification target status is unreachable. But I have no clue what it actually means.
Does my problem occur because of the unreachable status?
What exactly does it mean then?

do you reference this document? https://docs.codemagic.io/configuration/webhooks/#setting-up-webhooks-for-aws-codecommit
Have you done following steps and can you see any incoming requests from AWS in Codemagic?
6. In the Codemagic UI, navigate to your application and select the Webhooks tab.
7. Under Recent deliveries, choose the most recent webhook, and copy the subscription link under the Results tab to your browser.

Well, apparently the documentation here has been updated:
https://docs.codemagic.io/configuration/webhooks/#setting-up-webhooks-for-aws-codecommit
There is a configuration that you have to update for your topic's access policy:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "CodeNotification_publish",
"Effect": "Allow",
"Principal": {
"Service": "codestar-notifications.amazonaws.com"
},
"Action": "SNS:Publish",
"Resource": "arn:aws:sns:REGION:ACCOUNT_ID:REPOSITORY"
}
]
}
Make sure to update Resource!
"Resource": "arn:aws:sns:REGION:ACCOUNT_ID:REPOSITORY"
Copy ARN from your topic:
Apart from that(as said above) this step is important:
Under Recent deliveries (in Codemagic -> App -> Webhooks), choose the most recent webhook, and copy the
subscription link under the Results tab to your browser.

Related

Firebase Log-in events

I want to see Who and When login to the Firebase from UI side, as administrator.
It is not related data access from app etc.
So, I login to https://firebase.google.com/ as User/Manager/Admin and want to see it in logs.
It should be in GCP project related to firebase, if so how can I find it - did saw in Log explorer.
Or it should be in Firebase UI?
thank you in advance.
I would give you a workaround. You can use Firebase Management API which is in beta.
Consider you have to watch a project.
You can make a request like below to get the Project Details.
GET https://firebase.googleapis.com/v1beta1/projects/{YourProjectID}
Sample Response:
{
"projectId": "*****************",
"projectNumber": "*****************",
"displayName": "Sample App",
"name": "projects/*****************",
"resources": {
"hostingSite": "*****************",
"realtimeDatabaseInstance": "*****************"
},
"state": "ACTIVE",
"etag": "1_d15ff4d3-727e-431c-8eba-f33957805f23"
}
In the response, you have a key called ETAG. Basically, this changes whenever the project is opened by someone.
You cannot get who is logged-in or other details.
You can only know someone has opened, changed or made some operations in the project, using ETAG.
You can simply store the ETAG in your server and poll for the change.
If it is changed, then someone might have used the Project.
If you want the Updated Time of the project along with it, you can try this,
https://cloud.google.com/resource-manager/reference/rest/v3/projects/get

Unable to Add CodeStarNotification to CodePipeline with properly configured SNS access policy

Currently facing an issue about creating a notification rule for code pipeline
Resource handler returned message: "Invalid request provided: AWS::CodeStarNotifications::NotificationRule" (RequestToken: 4cf585ed-150e-78ee-6c23-d01870c1dbc4, HandlerErrorCode: InvalidRequest)
My problem is the same as in this StackOverflow post
CDK Unable to Add CodeStarNotification to CodePipeline.
Suggested solutions focus on whether or not access policy on topic is set and this is all taken care in my case
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AWSCodeStarNotifications_publish",
"Effect": "Allow",
"Principal": {
"Service": "codestar-notifications.amazonaws.com"
},
"Action": "SNS:Publish",
"Resource": "arn:aws:sns:us-east-1:123456789:PipelineNotifications"
}
]
}
I am importing already existing topic in that stack, that topic already have properly configured access policy so I don’t really understand what’s the problem - tried several times but it never succeeds creating it and it fails.
cdk version 2.31.0

Get object with aws:Referer works from one folder and not others

on a Wordpress site linking to pdfs successfully up till now, adding a new course and associated links to pdfs stored in S3.
here's my bucket policy
"Version": "2012-10-17",
"Id": "Policy1495663956019",
"Statement": [
{
"Sid": "Stmt1495663819956",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject",
"s3:GetObjectVersion"
],
"Resource": "arn:aws:s3:::courses-example-com/*",
"Condition": {
"StringLike": {
"aws:Referer": [
"http://example.com/*",
"http://www.example.com/*",
"https://example
"https://www.example.com/*"
]
}
}
}
]
}
The bucket has different folders for each course - course1/ course2/ etc
I copy the Object URL from S3 as the link within Wordpress
Here is an example of a link used
Download the course text here.
Some of the links, both those that work or do not (access denied) may have rel="nooperner noreferer", yet some of these work, while others do not. When trying to remove the noreferer - Wordpress just adds it back in.... changing the link to open in the same window is not desired as it loses the student's place in the course...
I am not sure how to check the header for the referer that is likely sent from the different pages... might provide a clue. Also, not sure how to override the Wordpress automatic addition of noreferer.
check S3 permissions, went over the bucket policy carefully, cleared cache, tried different browsers, rebooted, cleared cache on site host side,
ideas?
cheers,
Fred

Universal link common to both Full App and AppClip

I want to use universal link common to both Full App and AppClip ex: https://example.com, and the desired scenario is as follows:
  1. When users install AppClip, scan this link will show AppClip Card
  2. When users install Full App, scan this link will show Full App
This is the content in the file https://example.com/.well-known/apple-app-site-association I have installed:
`{
"applinks": {
"apps": [],
"details": [{
"appID": "teamId.xxx.yyy.Example",
"paths": ["*"]
}]
},
"appclips": {
"apps": ["teamId.xxx.yyy.Example.Clip"]
}
}
`
Here is the Associated Domains setting on the Xcode side:
Full App: applinks:example.com
AppClip: appclips:example.com
But the results are not as expected, when scanning the link, it always shows the AppClip Card with the message: "This app clip is not currently available in your country or region" (even when I don't have AppClip installed), and Every time you test the main app, you will have to use “Clear Experience Cache”
Please help, thanks a lot.

Apache NiFi write to encrypted SQS queue

We are encountering a very strange condition with Apache NiFi and SQS. We are using the AWSCredentialsProviderControllerService to manage our authentication. If we use an unencrypted queue it works fine, however, if using an encrypted queue it doesn't fail but nothing gets written. It doesn't appear to be generating anything in the NiFi or cloud trail logs either. Just wondered if there is anything special that needs to get done to support this condition. If it is failing, we are not able to figure out where that is occurring. Any suggestions or ideas would be greatly appreciated.
I was able to reproduce the silent failure with PutSQS under the following conditions:
SQS Queue configured with server-side encryption using a custom KMS customer master key rather than the default AWS key
AWS credentials used by NiFi had permission to send a message, but not permissions to use the custom KMS key
The solution was to provide NiFi's AWS credential with the permissions to use both SQS and KMS. I found the example policy below documented in What AWS KMS Permissions Do I Need to Use SSE for Amazon SQS?:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": [
"kms:GenerateDataKey",
"kms:Decrypt"
],
"Resource": "arn:aws:kms:us-east-2:123456789012:key/1234abcd-12ab-34cd-56ef-1234567890ab"
}, {
"Effect": "Allow",
"Action": [
"sqs:SendMessage",
"sqs:SendMessageBatch"
],
"Resource": "arn:aws:sqs:*:123456789012:MyQueue"
}]
}

Resources