How do I set the Chrome AutoSelectCertificateForUrls option in protractor - protractor

I am automating some tests with Protractor but cannot figure out how to auto select a certificate for the website under test.
It seems that the AutoSelectCertificateForUrls option of Google Chrome should do the trick, but it does not seem to work, or I am not setting it correctly.
This is what I have in my conf file:
...
chromeOptions: {
prefs: {
       AutoSelectCertificateForUrls: [
'{"pattern":"[*.]my.website.here","filter":{"ISSUER":{"CN":"My Issuer Here"}}}'
]
      }
...
(obviously the website url pattern and cert issuer are anonymised)

Related

Universal link configurations issue

I'm dealing with universal link issue for the past few days and I can't understand why it's not working.
sorry can't show the domain, so I show it as myDomain.nl
we uploaded the apple-app-site-association
https://myDomain.nl/.well-known/apple-app-site-association
and here are the contents
{
"applinks": {
"apps": [],
"details": [
{
"appID": "5LKNOW4KJS.app.appname.com", // teamID.app bundle identifier
"paths": ["*"]
}
]
}
}
And in the Xcode in the Associated Domains I added
applinks:myDomain.nl
The issue is simple, it will not open the app when myDomain.nl run on safari
I also tried to search for swdc the mac console on the iPhone device, but I found nothing, the logs will be completely empty after searching swdc
would be so appreciated if anyone help me what is the issue here.
Here are more details
I validated the AASA with here
And
"associated domains” capability is enabled for the app
I tested this process both from installed app from Xcode and TestFlight
The appID in my AASA includes two part -> 1- Team ID from Apple developer platform (see second image) and 2- app bundle identifier from Xcode
teamID.appBundleIdentifier
I also run in Terminal
martin#martins-MacBook-Pro ~ % curl --http1.1 -i https://myDomain.nl/.well-known/apple-app-site-association
HTTP/1.0 200 Found
cache-control: no-cache
content-type: application/json
{
"applinks": {
"apps": [],
"details": [
{
"appID": "5LKNOW4KJS.app.appname.com",
"paths": ["*"]
}
]
}
}
That third-party AASA validator (https://branch.io/resources/aasa-validator/) is reporting a ≥400 status code. That will prevent the universal links from working. Try opening https://yourdomain.nl/.well-known/apple-app-site-association from curl or a web browser, and see precisely what status code you receive.
Until this error is resolved, universal links will not function correctly. Once you have resolved that AASA server configuration issue, if it is still not working with TestFlight (or ad hoc) archive builds, then review the rest of the configuration (e.g., the implementation of the necessary methods in the app/scene delegates, etc.).
For more information, see See Supporting universal links in your app and Universal Links for Developers.
Once you have enabled developer mode on your device, you can diagnose universal links in “Settings” » “Developer” » “Universal links” » “Diagnostics”:
From your macOS console, you can also diagnose links on a device by monitoring swcd events from the Console app, and search for “beginning data”:
And once you see the identifier, you can see all events associated for that particular universal link:
And you can generate a sysdiagnose on your device and then look at the swcutil_show.txt:
Service: applinks
App ID: …
App Version: 302.0
App PI: <LSPersistentIdentifier 0x6e68185d0> { v = 0, t = 0x8, u = 0x16c8, db = 02350E0B-B10A-4D51-9FFD-F57CA687CF17, {length = 8, bytes = 0xc816000000000000} }
Domain: …
Patterns: {"/":"*"}
User Approval: unspecified
Site/Fmwk Approval: approved
Flags:
Last Checked: 2023-01-15 19:08:53 +0000
Next Check: 2023-01-20 18:15:34 +0000
See https://youtu.be/xxyEq_ySoO4.

Nuxtjs - Error 404 with post request in production while working in local

I'm actually trying to use nuxt-mail in a personnal project,
During my development phase, I receive all my testing mails. And from there I did the following adjustments to do the exact same request from my builded site :
//nuxt.config.js
env: {
baseUrl:
process.env.NODE_ENV === 'dev'
? 'http://localhost:3000'
: 'https://my-domain.netlify.app'
},
My code when using the 'send' function :
this.$axios.$post(process.env.baseUrl + "/mail/send", {
config: 'contact',
from: document.getElementById('input-2').value,
subject: document.getElementById('subject').value,
text: "This is a text message",
})
It continues to work well with localhost/3000/mail/send but I have a 404 error once I build my site and using https:/ /my-domain.netlify.app/mail/send :
POST https://my-domain.netlify.app/mail/send [HTTP/2 404 Not Found 186ms]
Uncaught (in promise) Error: Request failed with status code 404
I'm actually struggling to solve this problem, am I missing something ?
Alright, so if your target is static, you can only do yarn generate.
If you do have the default, aka target: server, you can only yarn build.
Then, as talked about it a bit here: Sending mail in Nuxt.js with nuxt-mail
You cannot use a Node.js package in a static environment, so neither yarn generate nor Netlify will help you here. You need to yarn build and host it on something like Heroku.
One last step that you can do, is to try it locally with the following:
target: server
yarn build
yarn start
make your POST call with Postman or alike
If it does not work here, it is a code issue and you can look into the hosting one.
If it does work locally, you can proceed to the hosting issue that you'll face.
Well you just misunderstood the env field in the nuxt.config.js file.
That env field is passed to the $config Object of the Nuxt App and not passed to process.env.
What you want is to set the BaseUrl for the Axios Module
// nuxt.config.js
axios: {
baseURL: process.env.NODE_ENV === 'dev'
? 'http://localhost:3000'
: 'https://my-domain.netlify.app'
},
// or provide a runtime config
// server and clientside
publicRuntimeConfig: {
axios: {
browserBaseURL: process.env.BROWSER_BASE_URL
}
},
// serverside only
privateRuntimeConfig: {
axios: {
baseURL: process.env.BASE_URL
}
},
Edit:
Also when calling axios just do it like that if you implement the above changes
this.$axios.$post("/mail/send", {
// ... the rest of your code

Ionic proxy config for different environments

I am new to ionic and I try to setup a proxy configuration for different environments. I have several environment-specific config files in place which get loaded using webpack and an environment variable which is set before ionic is served (see: https://github.com/gshigeto/ionic-environment-variables).
Everything works as expected but I don’t know how to solve following issue:
My proxy configuration (ionic.config.json) looks like this:
"proxies": [
{
"path": "/api",
"proxyUrl": "https://dv.mydomain.com/api",
"rejectUnauthorized": false
}
]
and one of my http calls looks like this:
return this.http.get<User[]>(ENV.apiUrl + '/api/users')
I have to remove ENV.apiUrl because otherwise the pattern specified in the proxy config doesn’t get matched, but if I do so, I cannot distinguish between different environments anymore. I have tried to add the domain to the path of the proxy configuration, which did not work.
Is there a way to solve this issue?
I asked the same question in the ionic forum but no one answered so far.
The way I "solved" it so far is not to use Ionic proxies anymore. I've installed this plugin for chrome, which basically disables chrome's CORS protection by adding Access-Control-Allow-Origin: * to the response headers.
Can't the apiUrl just be a URL path component? Ex:
// environment.pro.ts
export const environment: any = {
apiUrl: '/pro'
};
// environment.dev.ts
export const environment: any = {
apiUrl: '/dev'
};
Then, something like:
// ionic.config.json
"proxies": [
{
"path": "/pro/api",
"proxyUrl": "https://example.com/api",
"rejectUnauthorized": false
},
{
"path": "/dev/api",
"proxyUrl": "https://dev.example.com/api",
"rejectUnauthorized": false
}
]
CORS issue will only be specific to the local development as Ionic uses browser for local developement.
In mobile all the javascript will be copied as file://
Thus origin will not be exist.
So to handle this you can install the chrome extention
https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en
This should solve the problem.

Behat selenium tests trust self signed SSL cerificate

For our automated testing of our Drupal site, we are using Behat test scripts. On our local development machines we are using a self signed SSL certificate that is created by Acquia Devdesktop. Running the tests in the different browsers with Behat is no problem since you can trust the certificate in the browser itself. However for the REST interfaces where no browser is being opened it is a different story. Behat will not accept the self signed certificate since it is "unsecure".
When running the REST test this is the error we get:
cURL error 60: SSL certificate problem: self signed certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) (GuzzleHttp\Exception\RequestException)
With the testcase itself is nothing wrong because it worked before we enabled the SSL certificate. We tried to edit the configuration .yml file with the options from the documentation and other tickets but with no luck.
Is there a way to trust a self signed certificate for the REST interface tests? If you need more information please let me know.
Edit: Added the YML config and composer.json file
//composer.json
{
"require": {
"drupal/drupal-extension": "~3.0",
"emuse/behat-html-formatter": "dev-master",
"behatch/contexts": "*",
"guzzlehttp/guzzle": "dev-master",
"behat/mink-goutte-driver": "dev-master"
},
"config": {
"bin-dir": "bin/"
}
}
Note I removed my url from the yml file below.
default:
suites:
default:
contexts:
- FeatureContextDrupal
- behatch:browser
- Drupal\DrupalExtension\Context\MinkContext
- Drupal\DrupalExtension\Context\DrupalContext
- Drupal\DrupalExtension\Context\DrushContext
- Drupal\DrupalExtension\Context\MessageContext
- behatch:debug
- behatch:system
- behatch:json
- behatch:table
- behatch:rest
- behatch:xml
formatters:
html:
output_path: %paths.base%/build/html/behat
extensions:
Sanpi\Behatch\Extension: ~
emuse\BehatHTMLFormatter\BehatHTMLFormatterExtension:
name: html
Behat\MinkExtension:
goutte:
guzzle_parameters:
verify: false
ssl.certificate_authority: false
selenium2:
wd_host: http://localhost:4444/wd/hub
base_url: "https://myurl.devcloud.acquia-sites.com/"
Drupal\DrupalExtension:
blackbox: ~
api_driver: 'drupal'
drush:
alias: 'ns-test'
drupal:
drupal_root: '/var/www/html/utcfs.dev/docroot'
chrome:
extensions:
Behat\MinkExtension:
selenium2:
browser: chrome
capabilities: { "browser": "chrome", "browserName": "chrome", "version": "*", "browserVersion": "*" }
iexplore:
extensions:
Behat\MinkExtension:
selenium2:
browser: internet explorer
capabilities: { "browser": "internet explorer", "browserName": "internet explorer", "version": "*", "browserVersion": "*" }
Found my answer on GitHub:
For Behat3/MinkExtension2.2
extensions:
Behat\MinkExtension:
base_url: 'https://localhost'
sessions:
default:
goutte:
guzzle_parameters:
defaults:
verify: false
Lower versions (1.x)
extensions:
Behat\MinkExtension:
goutte:
guzzle_parameters:
verify: false

FiddlerCore Https Firefox Certifcate installation and Trust

I am playing with Fiddler core , trying to set up with a proxy and check Https traffic. For Chrome and Internet Explorer fiddler have great support:
if (!CertMaker.rootCertExists())
{
if (!CertMaker.createRootCert())
return false;
if (!CertMaker.trustRootCert())
return false;
}
Anyone knows what to do with Mozilla ? How to install certificate there ?
There's nothing in Fiddler/FiddlerCore itself that will do this. You can easily start the process from a Firefox extension (see overlay.js in Fiddler's install folder):
var certdb = Components.classes["#mozilla.org/security/x509certdb;1"].getService(Components.interfaces.nsIX509CertDB);
var file = Components.classes["#mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).
get("Desk", Components.interfaces.nsIFile);
file.append("FiddlerRoot.cer");
try {
alert("On the following screen, tick the first checkbox: 'Trust this CA to identify websites.'");
certdb.importCertsFromFile(null, file, Components.interfaces.nsIX509Cert.CA_CERT);
} catch (e) { alert("Trust function returned:\n\n" + e); }
From outside Firefox or to bypass all prompts, you'd need to poke their API; see e.g. How to add a trusted Certificate Autority to Firefox with JSS shows one approach.