coppertone 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3752897202805df2380313ece71a3fda42830bc636b29f6c48c92a3d4b4e91d6
4
- data.tar.gz: 76cf7084e4f25c8198c9f534a66eb9cbf6584df5b3004aa4d07317aabd89fd99
3
+ metadata.gz: a3eb3fb44816bf803f4cc195a29d87ae442e23d4e7f61d71d31eeee858a2b0e8
4
+ data.tar.gz: f9211184ee03223a0aa04c0be495d7e7a90e6e294869a5469c2540c0dc8637a2
5
5
  SHA512:
6
- metadata.gz: 1d9b2a1e83a88e89c6226183ecf64db0cbe7206049dd34c922cbb707add141277c0b69edcffafb46100122a348fbecbe0a4ca339108882c389781514314ea324
7
- data.tar.gz: 71c1abefd7b43713bc00933d9448d3746da5d52d15552ffa9a18918fbb4ec1afbd105a0b0738a412f42d7df05208ab01badedc8fa3d3ae52bb83546af2045981
6
+ metadata.gz: 22fb16e9e7495392c976d1d22fd96c5ee31f788a03131aa070ce8a308a7641c86096781ff64642c497862254c9500a0bce78e9f70ed2099e56ccf78f0f30e632
7
+ data.tar.gz: 4aeb6e1a5f85c6492103267b75354cffb12cf5f74ab5be8f0cbb979c85113a54610f8c411d5239ad280ef9a0fa8f41216ccc8b5e2c44f73d6f0bf40f4330cdff
data/.circleci/config.yml CHANGED
@@ -1,79 +1,130 @@
1
- version: 2
2
- aliases:
3
- - &current_ruby_image
4
- circleci/ruby:2.7.2
1
+ # CircleCI 2.1: https://circleci.com/docs/2.0/configuration-reference/
2
+ version: 2.1
3
+
4
+ # To avoid DockerHub rate limiting we need to auth with our Valimail DockerHub
5
+ # user's API access token. If you add a new shared context, make sure
6
+ # these environment variables are added to it with the credentials from 1Password.
7
+ # https://app.circleci.com/settings/organization/github/ValiMail/contexts
8
+ docker-auth: &docker-auth
9
+ auth:
10
+ username: $DOCKERHUB_USERNAME
11
+ password: $DOCKERHUB_PASSWORD
12
+
13
+ # Orbs are packages of config that you can import by name or configure inline.
14
+ orbs:
15
+ # Our orb for managing dependencies
16
+ # Reference: https://circleci.com/orbs/registry/orb/valimail/dependency-manager
17
+ # Source: https://github.com/ValiMail/dependency-manager-orb
18
+ dependency-manager: valimail/dependency-manager@0.4.8
19
+
20
+
21
+ # Commands are reusable sets of steps invokable with parameters inside a job.
22
+ commands:
23
+ test:
24
+ steps:
25
+ - run:
26
+ name: Run test suite
27
+ command: bundle exec rspec --format progress --format RspecJunitFormatter --out /tmp/test-results/rspec/results.xml
28
+
29
+ build-gem:
30
+ steps:
31
+ - run:
32
+ name: Build gem
33
+ command: bundle exec rake build
34
+
35
+ report_coverage:
36
+ steps:
37
+ - run:
38
+ name: Report code coverage to Coveralls, in parallel
39
+ command: wget -cq https://coveralls.io/coveralls-linux.tar.gz -O - | tar -xz && ./coveralls --parallel
40
+
41
+ finish_coverage:
42
+ steps:
43
+ - run:
44
+ name: Inform Coveralls that parallel jobs are all done
45
+ command: wget -cq https://coveralls.io/coveralls-linux.tar.gz -O - | tar -xz && ./coveralls --done
46
+
47
+ # Executors define the environment in which the steps of a job will be run.
48
+ executors:
49
+ ruby-system:
50
+
51
+ parameters:
52
+ ruby-version:
53
+ description: Ruby version to use, passed in as a string
54
+ type: string
55
+ default: "2.7"
5
56
 
6
- - &defaults
7
- working_directory: ~/repo
8
57
  docker:
9
- - image: *current_ruby_image
10
-
11
- - &step_install_root_dependencies
12
- run:
13
- name: install root dependencies
14
- command: |
15
- gem install bundler && bundle install --jobs=4 --retry=3 --path vendor/bundle
16
-
17
- - &step_make_test_output_directory
18
- run:
19
- name: create test metadata directory
20
- command: mkdir /tmp/test-results
21
-
22
- - &step_run_rspec_tests
23
- run:
24
- name: run rspec with simplecov
25
- command: |
26
- TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
27
-
28
- COVERAGE=true bundle exec rspec \
29
- --format progress \
30
- --format RspecJunitFormatter \
31
- --out /tmp/test-results/rspec.xml \
32
- ${TEST_FILES}
33
-
34
- - &step_store_test_results
35
- store_test_results:
36
- path: /tmp/test-results
37
-
38
- - &step_store_test_artifacts
39
- store_artifacts:
40
- path: /tmp/test-results
41
- destination: test-results
42
-
43
- - &step_store_coverage_artifacts
44
- store_artifacts:
45
- path: coverage
46
- destination: coverage
58
+ - image: cimg/ruby:<< parameters.ruby-version >>
59
+ <<: *docker-auth
60
+ environment:
61
+ BUNDLE_PATH: vendor/bundle
47
62
 
63
+
64
+ # Jobs have two parts: the execution environment and a set of steps.
48
65
  jobs:
49
- code-quality-job:
50
- <<: *defaults
66
+ ruby-3_0:
67
+ executor:
68
+ name: ruby-system
69
+ ruby-version: "3.0"
70
+ steps:
71
+ - checkout
72
+ - dependency-manager/install-gems:
73
+ cache-version: v2
74
+ - test
75
+ - report_coverage
76
+ - build-gem
77
+
78
+ ruby-2_7:
79
+ executor:
80
+ name: ruby-system
81
+ ruby-version: "2.7"
51
82
  steps:
52
83
  - checkout
53
- - *step_install_root_dependencies
84
+ - dependency-manager/install-gems:
85
+ cache-version: v2
86
+ - test
87
+ - report_coverage
88
+ - build-gem
89
+
90
+ lint-job:
91
+ executor: ruby-system
92
+ steps:
93
+ - checkout
94
+ - dependency-manager/install-gems:
95
+ cache-version: v2
96
+ - run:
97
+ name: Lint Ruby
98
+ command: bundle exec rubocop
99
+ - run:
100
+ name: Scan for Ruby gem vulnerabilties
101
+ command: |
102
+ gem install bundler-audit
103
+ bundle audit check --update
54
104
  - run:
55
- name: Run Rubocop
105
+ name: Scan for Ruby and RubyGems vulnerabilties
56
106
  command: |
57
- bundle exec rubocop
107
+ bundle add ruby_audit --group "test"
108
+ bundle exec ruby-audit check
58
109
 
59
- current_ruby-job:
60
- working_directory: ~/repo
61
- docker:
62
- - image: *current_ruby_image
63
- steps: &test_run_steps
64
- - checkout
65
- - *step_install_root_dependencies
66
- - *step_make_test_output_directory
67
- - *step_run_rspec_tests
68
- - *step_store_test_results
69
- - *step_store_test_artifacts
70
- - *step_store_coverage_artifacts
110
+ finish-coverage:
111
+ resource_class: small
112
+ executor: ruby-system
113
+ steps:
114
+ - finish_coverage
71
115
 
116
+ # Workflows are sequences of jobs.
72
117
  workflows:
73
- version: 2
74
- build-test_current-ruby:
75
- jobs:
76
- - current_ruby-job
77
- - code-quality-job:
78
- requires:
79
- - current_ruby-job # let primary job fetch all dependencies first
118
+ build:
119
+ jobs:
120
+ - ruby-2_7:
121
+ context: valimail-saas-tokens
122
+ - ruby-3_0:
123
+ context: valimail-saas-tokens
124
+ - finish-coverage:
125
+ context: valimail-saas-tokens
126
+ requires:
127
+ - ruby-2_7
128
+ - ruby-3_0
129
+ - lint-job:
130
+ context: valimail-saas-tokens
@@ -66,7 +66,7 @@ module Coppertone
66
66
  end
67
67
 
68
68
  def self.valid_label?(l)
69
- !l.empty? && (l.length <= 63) && !l.match(/\s/)
69
+ !l.empty? && (l.length <= 63) && !l.match(/(\s|@)/)
70
70
  end
71
71
 
72
72
  def self.macro_expanded_domain(domain)
@@ -1,3 +1,3 @@
1
1
  module Coppertone
2
- VERSION = '0.0.12'.freeze
2
+ VERSION = '0.0.13'.freeze
3
3
  end
@@ -49,6 +49,12 @@ describe Coppertone::Utils::DomainUtils do
49
49
  expect(subject.valid?('rst.*.example.com')).to eq(true)
50
50
  end
51
51
 
52
+ it 'should reject domains with ampersands' do
53
+ expect(subject.valid?('@dmarc.126.com')).to eq(false)
54
+ expect(subject.valid?('abcd@domainkey.gmail.com')).to eq(false)
55
+ expect(subject.valid?('abcd.x@domainkey.gmail.com')).to eq(false)
56
+ end
57
+
52
58
  it 'should reject IP addresses' do
53
59
  expect(subject.valid?('192.38.7.14')).to eq(false)
54
60
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coppertone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter M. Goldstein
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-04 00:00:00.000000000 Z
11
+ date: 2021-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport