A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

Showing posts with label security. Show all posts
Showing posts with label security. Show all posts

Add Javascript to a security protected page

If you want to run some JQuery (or any other script) on a page that doesn't have it already, you can load it like this in the web browser console:

var script = document.createElement('script');
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(script);

But on pages with a strict security policy, you may get an error:

Refused to load the script '......' because it violates the following Content Security Policy directive: .....

Solution: Edit the DOM and replace the security policy with this one:

<meta http-equiv="Content-Security-Policy" content="default-src * self blob: data: gap:; style-src * self 'unsafe-inline' blob: data: gap:; script-src * 'self' 'unsafe-eval' 'unsafe-inline' blob: data: gap:; object-src * 'self' blob: data: gap:; img-src * self 'unsafe-inline' blob: data: gap:; connect-src self * 'unsafe-inline' blob: data: gap:; frame-src * self blob: data: gap:;">

(source)

Breakdown of policy from that guy:
  • default-src * self                 blob: data: gap:;
  • style-src   * self 'unsafe-inline' blob: data: gap:;
  • script-src  * 'self' 'unsafe-eval' 'unsafe-inline' blob: data: gap:;
  • object-src  * 'self'               blob: data: gap:;
  • img-src     * self 'unsafe-inline' blob: data: gap:;
  • connect-src self * 'unsafe-inline' blob: data: gap:;
  • frame-src   * self                 blob: data: gap:;
Hmm, that doesn't look quite right. Seems inconsistent.

Non-functional checklist

When writing a user story or writing a spec for a piece of development work, consider the following non-functional aspects:

  • Authentication
  • Session management
  • Access control
  • Input validation
  • Output encoding/escaping
  • Encryption
  • Error handling and logging
  • Data protection
  • Communication security
  • HTTP security features
  • Monitoring
    • Logging of significant code paths
    • Logging of expected events and errors
    • Catching and logging of unexpected errors (crashes)
    • Metrics for stats of usage and throughput (requests)
  • Performance, e.g. response time must be <500ms


This is especially useful when building new systems like a new app or API.

Jenkins admin notes

Some things to help on your Continuous Integration journey with Jenkins:

  • Use  docker pull jenkins  for a quick start
  • Security can be a bit fiddly to set up. Try these easy settings:
    • Jenkins’ own user database
    • Allow users to sign up
    • Logged-in users can do anything
  • There is a Role-Based Strategy plugin for more advanced use
  • If you accidentally lock yourself out, edit  $JENKINS_HOME/config.xml  to say false and restart Jenkins
  • To see a list of failing tests, configure a Post-build action for  "Publish JUnit test result report"

-- Jenkins ver. 1.642.2

Where to download oracle wallet mkstore

It looks like mkstore was the utility in 10r2 but by 11g it had been deprecated by orapki.

An article mentioning both tools.

Log into a server using secure keys instead of typing a password

On the client:
  1. ssh-keygen -t rsa
  2. accept the default filename
  3. press enter for a blank password
  4. a private (id_rsa) and public key (id_rsa.pub) will be created
  5. copy the public key to the server
On the server
  1. cat id_rsa.pub >> ~/.ssh/authorized_keys
  2. chmod 700 ~/.ssh
  3. chmod 644 ~/.ssh/authorized_keys
Now back up your keys.

See also this and this.
(Upon error "Agent admitted failure to sign using the key", log out of the client and log back in again to fix).

Allow different users to access MySQL

GRANT ALL PRIVILEGES ON *.* TO 'username'@'hostname';

The single quotes around username and hostname are required.