A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.
Jump to
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:
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.
Labels:
auth,
design,
monitoring,
non-functional,
security,
spec
Jenkins admin notes
Some things to help on your Continuous Integration journey with Jenkins:
-- Jenkins ver. 1.642.2
- 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"
Log into a server using secure keys instead of typing a password
On the client:
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).
- ssh-keygen -t rsa
- accept the default filename
- press enter for a blank password
- a private (id_rsa) and public key (id_rsa.pub) will be created
- copy the public key to the server
- cat id_rsa.pub >> ~/.ssh/authorized_keys
- chmod 700 ~/.ssh
- chmod 644 ~/.ssh/authorized_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).
Subscribe to:
Posts (Atom)