How do I get all Security Advisories using github api?
github -> Project -> Security Advisories - View information about security vulnerabilities from this repository's maintainers.
Example Project:
https://github.com/tensorflow/tensorflow/security/advisories
analogous to the List Repo commands
curl https://api.github.com/repos/tensorflow/tensorflow/contributors
One more Example via github Explorer:
query
{
securityAdvisories(first: 100) {
totalCount
pageInfo {
endCursor
startCursor
}
nodes {
description
summary
cvss {
vectorString
}
databaseId
identifiers {
type
value
}
ghsaId
}
}
}
But i have no idea, how to get the security advisories for one project?
Thank you very much for any hints
Related
How to do Google Pay integration with DIRECT type?
I can't get what to do in this case. Is it possible at all to integrate Google Pay Test Environment with this type? Is it possible to work with test keys for tokenization?
Google provides guide for integration where only PAYMENT_GATEWAY type is described. Please help with some tips.
First, you will need to create a Business Profile to act as a merchant. This will give you a Merchant ID that will later be used in the PaymentDataRequest object.
You can sign up here (it's free and quick)
https://pay.google.com/business/console/home/
Next, you will need to generate a new key pair using OpenSSL, and add it to your Google Business profile.
Please see this link for more details on how to that.
https://developers.google.com/pay/api/web/guides/resources/payment-data-cryptography#key-rotation
Set the type in your tokenizationSpecification to "DIRECT". You will also need to add the below two parameters. Note that the publicKey is the public key you generated earlier and added to your business profile.
const tokenizationSpecification = {
"type": "DIRECT",
"parameters": {
"protocolVersion": "ECv2",
"publicKey": "BOdoXP1aiNp.....kh3JUhiSZKHYF2Y="
}
}
For testing, make sure you are using the 'TEST' environment. See here
function getGooglePaymentsClient() {
if ( paymentsClient === null ) {
paymentsClient = new google.payments.api.PaymentsClient({
environment: 'TEST',
paymentDataCallbacks: {
onPaymentAuthorized: onPaymentAuthorized
}
});
}
return paymentsClient;
}
I am currently working on a project that creates Discount Codes via API and I need to retrieve which orders have used a specified Discount Code (ex: TESTCODE123). I couldn't find the documentation or API endpoint mentioned in the Shopify API pages. Is it possible to guide me on this?
You will need to use Admin GraphQL for this and rely on the query parameter to filter them out.
Example:
{
orders(first: 10, query:"discount_code:TESTCODE123"){
edges {
node {
id
}
}
}
}
You can refer the docs here: https://shopify.dev/docs/admin-api/graphql/reference/queryroot?api[version]=2020-01
I am using swagger-ui-express and swagger-jsdoc for API Documentation of my node app. The point here is that I have two versions of API in my App and I want to document both of them. I have seen that in .NET Core there is an option available to define the specs and choose one from a dropdown in top bar. I am looking for a similar solution
As a dropdown can be seen in top bar I want similar via swagger-ui-express. Is it possible or if anybody has implemented the same for API Versioning?
Looking forward to your responses.
The solution I propose is not specific to API versioning, but you can have a dropdown of URLs the end-user can choose from. According to the docs, you would need to pass a swaggerOptions object:
const swaggerOptions = {
explorer: true,
swaggerOptions: {
urls: [
{
url: 'https://v1/swagger.json',
name: 'v1'
},
{
url: 'https://v2/swagger.json',
name: 'v2'
}
]
}
}
I'm using Apps - listRepos to get a list of all the repositories installed on my Probot GitHub application.
I want the response data to include the GitHub topics for each repository. This is currently only available as a preview feature:
The topics property for repositories on GitHub is currently available for developers to preview. To view the topics property in calls that return repository results, you must provide a custom media type in the Accept header:
application/vnd.github.mercy-preview+json
So I think I want to "provide a custom media type in the Accept header".
Is there a way to enable GitHub preview features in Probot? Perhaps by somehow setting RequestOptions?
Success: I added a headers object to my listRepos() call.
const repositories = await octokit.paginate(
octokit.apps.listRepos({
per_page: 100,
headers: {
accept: 'application/vnd.github.machine-man-preview+json,application/vnd.github.mercy-preview+json'
}
}),
res => res.data.repositories // Pull out only the list of repositories from each response.
);
I am trying to send a template email with Postmark in Node.js
I created a template on the Postmark App website. I've looked through their documentation, but cannot find any way to go about sending a templated email.
Documentation Sources:
http://blog.postmarkapp.com/post/125849089273/special-delivery-postmark-templates
http://developer.postmarkapp.com/developer-api-templates.html
I've tried a variety of methods, including:
client.emailWithTemplate("jenny#example.com",
"bob#example.com",<template-id>, {
"link" : "https://example.com/reset?key=secret",
"recipient_name" : "Jenny"
});
TypeError: Object # has no method 'emailWithTemplate'
client.sendEmail({
"TemplateModel" : {
"customer_name" : "Jenny",
},
"TemplateId" : 6882,
"From": "info#formulastocks.com",
"To": "lrroberts0122#gmail.com",
}, function(error, success) {
if(error) {
console.log(error);
} else {
console.log(success);
}
});
Console Log Error: { status: 422,
message: 'A \'TemplateId\' must not be used when sending a non-templated email.',
code: 1123 }
Thanks!
I'm the current maintainer of the node.js library (as well as one of the engineers that worked on Postmark Templates).
One of the possible reasons the original snippet doesn't work is that you could be using an older version of Postmark.js. We added the template endpoint capabilities in version 1.2.1 of the node.js package.
In the package.json file for your project you should make sure to update it to use version 1.2.1 or greater of the postmark.js library. If you've been using an older version of the library, you'll also need to run npm update
Also note that if you click "Edit Template" in the Postmark UI, and then "API Snippets," the UI provides a completed snippet for a number of languages (including node.js).
If all else fails, please contact support and we'll be happy to help you solve this issue.